Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
8bit_chiptune:sn76489 [2019/11/19 16:08] admin [6. The imperfect SN76489] |
8bit_chiptune:sn76489 [2019/11/19 16:14] admin [7. Playing samples on the SN76489] |
||
---|---|---|---|
Line 549: | Line 549: | ||
It is possible to play samples in two ways: | It is possible to play samples in two ways: | ||
- | 1. Pulse Code Modulation | + | === 1. Pulse Code Modulation |
- | This is the usual way to store, process and output waves. The data is | + | This is the usual way to store, process and output waves. The data is in the form of voltages (corresponding to the desired speaker position which in turn goves corresponding pressure waves in the air) which are stored digitally, often as 16-bit or 8-bit signed numbers. |
- | in the form of voltages (corresponding to the desired speaker | + | |
- | position which in turn goves corresponding pressure waves in the air) | + | |
- | which are stored digitally, often as 16-bit or 8-bit signed numbers. | + | |
- | On the SN76489, this is done by: | + | On the SN76489, this is done by:\\ |
+ | 1. Setting all 3 tone channels to frequency 0x000\\ | ||
+ | 2. At rapid, closely timed intervals, setting the output volume of all 3 to values stored in ROM.\\ | ||
- | 1. Setting all 3 tone channels to frequency 0x000 | + | In other words, the volume setting is used as a 4-bit DAC. All three tone channels |
- | 2. At rapid, closely timed intervals, setting the output | + | |
- | all 3 to values stored in ROM. | + | |
- | In other words, the volume setting is used as a 4-bit DAC. All three | + | The problem is that the output levels of the SN76489 are not linearly scaled: |
- | tone channels are usually used together to get maximum volume. | + | |
- | + | ||
- | The problem is that the output levels of the SN76489 are not linearly | + | |
- | scaled: | + | |
| | ||
| ||||| | | | | | | ||||| | | | | | ||
- | The source wave could be prepared with this in mind, using some | + | The source wave could be prepared with this in mind, using some specialised software, but I am not aware of any consumer-level wave editor capable of doing this. However, ignoring this and outputting " |
- | specialised software, but I am not aware of any consumer-level wave | + | |
- | editor capable of doing this. However, ignoring this and outputting | + | |
- | " | + | |
- | significantly quieter than it would be on a linear scale. | + | |
- | + | ||
- | The quality depends on the rate at which data is sent to the chip; on | + | |
- | most systems, the limit is more likely to be memory space than CPU | + | |
- | speed (8kHz 4-bit audio will fit 4.1 seconds into 16KB). | + | |
- | + | ||
- | One could use the combined logarithmic volume levels of the three | + | |
- | tone channels to give more output levels, but this additional | + | |
- | | + | |
- | | + | |
- | 2. Pulse Width Modulation | + | The quality depends on the rate at which data is sent to the chip; on most systems, the limit is more likely to be memory space than CPU speed (8kHz 4-bit audio will fit 4.1 seconds into 16KB). |
- | This works by outputting pulses at constant volume whose pattern | + | One could use the combined logarithmic volume levels |
- | | + | |
- | how samples are played on PC internal speakers and some CD players. | + | |
- | | + | |
- | 1. Setting all 3 tone channels to frequency 0x000 | + | === 2. Pulse Width Modulation === |
- | 2. At rapid, closely timed intervals, setting | + | This works by outputting pulses at constant volume whose pattern gives the effect |
- | all 3 to either 0xf (off) or 0x0 (full) depending | + | |
- | stored in ROM. | + | |
- | All three channels | + | On the SN76489, this is done by:\\ |
+ | 1. Setting all 3 tone channels to frequency 0x000\\ | ||
+ | 2. At rapid, closely timed intervals, setting the output | ||
- | This is equivalent | + | All three channels are used to get maximum volume. |
- | | + | |
- | an 8kHz 8-bit sample can be output as a 64kHz 1-bit sample and it | + | |
- | will sound much the same. It is somewhat dependent on the output | + | |
- | | + | |
- | The advantage of this is that it allows for a sample based on a | + | This is equivalent |
- | | + | |
- | for louder sounds) and it can potentially output any bitdepth source | + | |
- | | + | |
- | | + | |
- | input sample: with a maximum output rate of 20kHz, for example, one | + | |
- | may choose a 6.67kHz 3-bit source | + | |
- | etc. This can be severely limiting for the qaulity. | + | |
- | | + | The advantage of this is that it allows for a sample based on a linear PCM scale to be output accurately on the SN76489, (allowing for louder sounds) and it can potentially output any bitdepth source audio. The disadvantage |
- | is unintelligible, for example Alex Kidd: the Lost Stars' " | + | |
- | the Miracle Ball" | + | |
- | | + | |
+ | On the Master System, PWM is not very good quality (often the sound is unintelligible, | ||
- | 8. Game Gear stereo extension | + | ---- |
- | ============================= | + | ==== 8. Game Gear stereo extension ==== |
When a byte is written to port 0x06 on the Game Gear, the SN76489 | When a byte is written to port 0x06 on the Game Gear, the SN76489 |