Changes

SID

14,648 bytes added, 21 April
/* Links */
The Sound Interface Device (Contains extracts from wikipedia's pageSID)is a sound chip designed by MOS Technology in 1981. It is the "legendary" sound chip used by the [[Commodore 64]].
MOS Technology SID. The "legendary" sound chip used by the [[Commodore 64|C64]]. It was indeed better than the [[AY]] used in many other computers of the era (Amstrad's too) because it could produce many different (3) wave signal signals while AY could only produce rectangular wave signals.
Make your own judgment: [https://youtu.be/_LWbnjvXN4g AY vs SID sound comparison]
"SID" refers to a SIDfile, *.SID, too. Now playable -with some less quality- on CPC with Geco's Player. [httphttps://www.hvsc.c64.org/ SID Resource sitedownload/C64Music/DOCUMENTS/SID_file_format.txt SID File Format]
<br>
* three separately programmable independent audio oscillators (8 octave range, approximately 16 - 4000 Hz)
* four different waveforms per audio oscillator : pulse (with variable duty cycle), sawtooth, triangle, pulse, noise). Multiple waveform types may be selected simultaneously, which produces certain complex/combined waveforms.
* one multi mode filter featuring low-pass, high-pass and band-pass outputs with 6 dB/oct (bandpass) or 12 dB/octave (lowpass/highpass) rolloff. The different filter-modes are sometimes combined to produce additional timbres, for instance a notch-reject filter.
* three attack/decay/sustain/release (ADSR) volume controls, one for each audio oscillator.
==Technical details==
 
6581 Pin configuration
The SID is a mixed-signal integrated circuit, featuring both digital and analog circuitry. All control ports are digital, while the output ports are analog. The SID features three-voice synthesis, where each voice may use one of at least five different waveforms: square wave (with variable duty cycle), triangle wave, sawtooth wave, pseudo-random (but not white) noise, and certain complex/combined waveforms when multiple waveforms are selected simultaneously. A voice playing Triangle waveform may be ring-modulated with one of the other voices, where the triangle waveform's bits are inverted when the modulating voice's msb is set, producing a discontinuity and change of direction with the Triangle's ramp. Oscillators may also be hard-synced to each other, where the synced oscillator is reset whenever the syncing oscillator's msb raises.
Each voice may be routed into a common, digitally controlled analog 12dB multistate filter, which is constructed with aid of external capacitors to the chip. The filter has lowpass, bandpass and highpass outputs, which can be individually selected for final output amplification via master volume register. Using a combined state of lowpass and highpass results in a notch (or inverted bandpass) output.[1] The programmer may vary the filter's cut-off frequency and resonance. An external audio-in port enables external audio to be passed through the filter.
The ring modulation, filter, and programming techniques such as arpeggio (rapid cycling between 2 or more frequencies to make chord-like sounds) together produce the characteristic feel of SID music.
Despite its documented shortcomings, many SID musicians prefer the flawed 6581 chip over the corrected 8580 chip. The main reason for this is that the filter produces strong distortion that is sometimes used to produce simulation of instruments such as a distorted electric guitar. Also, the highpass component of the filter was mixed in 3 dB attenuated compared to the other outputs, making the sound more bassy. In addition to nonlinearities in filter, the D/A circuitry used in the waveform generators produces yet more additional distortion that made its sound richer in character.
 
<br>
 
==SID registers==
 
{| class="wikitable" style="text-align: center;"
|-
! Category
! Reg
! Name
! 7
! 6
! 5
! 4
! 3
! 2
! 1
! 0
|-
| rowspan="7" | Voice 1 || $00 (W) || FREQLO1 || colspan="8" | Channel 1 Frequency Low-Byte
|-
| $01 (W) || FREQHI1 || colspan="8" | Channel 1 Frequency High-Byte
|-
| $02 (W) || PWLO1 || colspan="8" | Channel 1 Pulse Width Low
|-
| $03 (W) || PWHI1 || colspan="4" style="background:#E0E0E0;" | unused || colspan="4" | Channel 1 Pulse Width High
|-
| $04 (W) || CR1 || NOISE || PULSE || SAW || TRI || TEST || RING || SYNC || GATE
|-
| $05 (W) || AD1 || colspan="4" | Channel 1 Attack || colspan="4" | Channel 1 Decay
|-
| $06 (W) || SR1 || colspan="4" | Channel 1 Sustain || colspan="4" | Channel 1 Release
|-
| rowspan="7" | Voice 2 || $07 (W) || FREQLO2 || colspan="8" | Channel 2 Frequency Low-Byte
|-
| $08 (W) || FREQHI2 || colspan="8" | Channel 2 Frequency High-Byte
|-
| $09 (W) || PWLO2 || colspan="8" | Channel 2 Pulse Width Low
|-
| $0A (W) || PWHI2 || colspan="4" style="background:#E0E0E0;" | unused || colspan="4" | Channel 2 Pulse Width High
|-
| $0B (W) || CR2 || NOISE || PULSE || SAW || TRI || TEST || RING || SYNC || GATE
|-
| $0C (W) || AD2 || colspan="4" | Channel 2 Attack || colspan="4" | Channel 2 Decay
|-
| $0D (W) || SR2 || colspan="4" | Channel 2 Sustain || colspan="4" | Channel 2 Release
|-
| rowspan="7" | Voice 3 || $0E (W) || FREQLO3 || colspan="8" | Channel 3 Frequency Low-Byte
|-
| $0F (W) || FREQHI3 || colspan="8" | Channel 3 Frequency High-Byte
|-
| $10 (W) || PWLO3 || colspan="8" | Channel 3 Pulse Width Low
|-
| $11 (W) || PWHI3 || colspan="4" style="background:#E0E0E0;" | unused || colspan="4" | Channel 3 Pulse Width High
|-
| $12 (W) || CR3 || NOISE || PULSE || SAW || TRI || TEST || RING || SYNC || GATE
|-
| $13 (W) || AD3 || colspan="4" | Channel 3 Attack || colspan="4" | Channel 3 Decay
|-
| $14 (W) || SR3 || colspan="4" | Channel 3 Sustain || colspan="4" | Channel 3 Release
|-
| rowspan="4" | Filter || $15 (W) || FCLO || colspan="5" style="background:#E0E0E0;" | unused || colspan="3" | Filter Cutoff Low
|-
| $16 (W) || FCHI || colspan="8" | Filter Cutoff High
|-
| $17 (W) || Res/Filt || colspan="4" | Filter Resonance || Filt Ex || Filt 3 || Filt 2 || Filt 1
|-
| $18 (W) || Mode/Vol || Chan 3 Off || High Pass || Band Pass || Low Pass || colspan="4" | Volume
|-
| rowspan="4" | Other || $19 (R) || POTX || colspan="8" | Potentiometer X
|-
| $1A (R) || POTY || colspan="8" | Potentiometer Y
|-
| $1B (R) || OSC3 || colspan="8" | Channel 3 Oscillator
|-
| $1C (R) || ENV3 || colspan="8" | Channel 3 Envelope
|}
 
<br>
 
== SID Internal Architecture ==
 
From an interview in August 1996 with Bob Yannes, the designer of the SID chip. [https://trondal.com/c64sid/yannes.html Source]
 
It's pretty brute-force, I didn't have time to be elegant. Each "voice" consisted of an Oscillator, a Waveform Generator, a Waveform Selector, a Waveform D/A converter, a Multiplying D/A converter for amplitude control and an Envelope Generator for modulation. The analog output of each voice could be sent through a Multimode Analog Filter or bypass the filter and a final Multiplying D/A converter provided overall manual volume control.
 
As I recall, the Oscillator is a 24-bit phase-accumulating design of which thelower 16-bits are programmable for pitch control. The output of the accumulator goes directly to a D/A converter through a waveform selector. Normally, the output of a phase-accumulating oscillator would be used as an address into memory which contained a wavetable, but SID had to be entirely self-contained and there was no room at all for a wavetable on the chip.
 
The Sawtooth waveform was created by sending the upper 12-bits of the accumulator to the 12-bit Waveform D/A.
 
The Triangle waveform was created by using the MSB of the accumulator to invert the remaining upper 11 accumulator bits using EXOR gates. These 11 bits were then left-shifted (throwing away the MSB) and sent to the Waveform D/A (so the resolution of the triangle waveform was half that of the sawtooth, but the amplitude and frequency were the same).
 
The Pulse waveform was created by sending the upper 12-bits of the accumulator to a 12-bit digital comparator. The output of the comparator was either a one or a zero. This single output was then sent to all 12 bits of the Waveform D/A.
 
The Noise waveform was created using a 23-bit pseudo-random sequence generator (i.e., a shift register with specific outputs fed back to the input through combinatorial logic). The shift register was clocked by one of the intermediate bits of the accumulator to keep the frequency content of the noise waveform relatively the same as the pitched waveforms. The upper 12-bits of the shift register were sent to the Waveform D/A.
 
Since all of the waveforms were just digital bits, the Waveform Selector consisted of multiplexers that selected which waveform bits would be sent to the Waveform D/A. The multiplexers were single transistors and did not provide a "lock-out", allowing combinations of the waveforms to be selected. The combination was actually a logical ANDing of the bits of each waveform, which produced unpredictable results, so I didn't encourage this, especially since it could lock up the pseudo-random sequence generator by filling it with zeroes.
 
The output of the Waveform D/A (which was an analog voltage at this point) was fed into the reference input of an 8-bit multiplying D/A, creating a DCA (digitally-controlled-amplifier). The digital control word which modulated the amplitude of the waveform came from the Envelope Generator.
 
The Envelope Generator was simply an 8-bit up/down counter which, when triggered by the Gate bit, counted from 0 to 255 at the Attack rate, from 255 down to the programmed Sustain value at the Decay rate, remained at the Sustain value until the Gate bit was cleared then counted down from the Sustain value to 0 at the Release rate.
 
A programmable frequency divider was used to set the various rates (unfortunately I don't remember how many bits the divider was, either 12 or 16 bits). A small look-up table translated the 16 register-programmable values to the appropriate number to load into the frequency divider. Depending on what state the Envelope Generator was in (i.e. ADS or R), the appropriate register would be selected and that number would be translated and loaded into the divider. Obviously it would have been better to have individual bit control of the divider which would have provided great resolution for each rate, however I did not have enough silicon area for a lot of register bits. Using this approach, I was able to cram a wide range of rates into 4 bits, allowing the ADSR to be defined in two bytes instead of eight. The actual numbers in the look-up table were arrived at subjectively by setting up typical patches on a Sequential Circuits Pro-1 and measuring the envelope times by ear (which is why the available rates seem strange)!
 
In order to more closely model the exponential decay of sounds, another look-up table on the output of the Envelope Generator would sequentially divide the clock to the Envelope Generator by two at specific counts in the Decay and Release cycles. This created a piece-wise linear approximation of an exponential. I was particularly happy how well this worked considering the simplicity of the circuitry. The Attack, however, was linear, but this sounded fine.
 
A digital comparator was used for the Sustain function. The upper four bits of the Up/Down counter were compared to the programmed Sustain value and would stop the clock to the Envelope Generator when the counter counted down to the Sustain value. This created 16 linearly spaced sustain levels without havingto go through a look-up table translation between the 4-bit register value and the 8-bit Envelope Generator output. It also meant that sustain levels were adjustable in steps of 16. Again, more register bits would have provided higher resolution.
 
When the Gate bit was cleared, the clock would again be enabled, allowing the counter to count down to zero. Like an analog envelope generator, the SID Envelope Generator would track the Sustain level if it was changed to a lower value during the Sustain portion of the envelope, however, it would not count UP if the Sustain level were set higher.
 
The 8-bit output of the Envelope Generator was then sent to the Multiplying D/A converter to modulate the amplitude of the selected Oscillator Waveform (to be technically accurate, actually the waveform was modulating the output of the Envelope Generator, but the result is the same).
 
Hard Sync was accomplished by clearing the accumulator of an Oscillator based on the accumulator MSB of the previous oscillator.
 
Ring Modulation was accomplished by substituting the accumulator MSB of an oscillator in the EXOR function of the triangle waveform generator with the accumulator MSB of the previous oscillator. That is why the triangle waveform must be selected to use Ring Modulation.
 
The Filter was a classic multi-mode (state variable) VCF design. There was no way to create a variable transconductance amplifier in our NMOS process, so I simply used FETs as voltage-controlled resistors to control the cutoff frequency. An 11-bit D/A converter generates the control voltage for the FETs (it's actually a 12-bit D/A, but the LSB had no audible affect so I disconnected it!).
 
Filter resonance was controlled by a 4-bit weighted resistor ladder. Each bit would turn on one of the weighted resistors and allow a portion of the output to feed back to the input. The state-variable design provided simultaneous low-pass, band-pass and high-pass outputs. Analog switches selected which combination of outputs were sent to the final amplifier (a notch filter was created by enabling both the high and low-pass outputs simultaneously).
 
The filter is the worst part of SID because I could not create high-gain op-amps in NMOS, which were essential to a resonant filter. In addition, the resistance of the FETs varied considerably with processing, so different lots of SID chips had different cutoff frequency characteristics. I knew it wouldn't work very well, but it was better than nothing and I didn't have time to make it better.
 
Analog switches were also used to either route an Oscillator output through or around the filter to the final amplifier. The final amp was a 4-bit multiplying D/A converter which allowed the volume of the output signal to be controlled. By stopping an Oscillator, it was possible to apply a DC voltage to this D/A. Audio could then be created by having the microprocessor write the Final Volume register in real-time. Game programs often used this method to synthesize speech or play "sampled" sounds.
 
An external audio input could also be mixed in at the final amp or processed through the filter.
 
The Modulation registers were probably never used since they could easily be simulated in software without having to give up a voice. For novice programmers they provided a way to create vibrato or filter sweeps without having to write much code (just read the value from the modulation register and write it back to the frequency register). These registers just give microprocessor access to the upper 8 bits of the instantaneous value of the waveform and envelope of Voice 3. Since you probably wouldn't want to hear the modulation source in the audio output, an analog switch was provided to turn off the audio output of Voice 3.
<br>
[[File:SID Block Diagram.png|600px]]
 
<br>
 
== Differences between SID chips ==
 
Based on the empirical data from 20 SID chips, the conclusion is that: [https://ultimatesid.dk/ Source]
*There are no inherent and identifiable differences that can be attributed purely to the revision number of a 6581 SID chip
*The differences between batches of the same revision can be larger than the differences between revision numbers
*There can be differences within the same batch, but less so than between different batches
*The ceramic filter caps at C10+C11 in the C64 play an important part in the filter offset point – regardless of the actual fitted SID
 
The 6581 and 8580 SID chips differ from each other in several ways: [https://en.wikipedia.org/wiki/MOS_Technology_6581 Source]
*The original 6581 was manufactured using the older NMOS process, which used 12V DC to operate. The 6581 is very sensitive to static discharge and if they weren't handled properly the filters would stop working, explaining the large number of dead 6581s in the market.
*The 8580 was made using the HMOS-II process, which requires less power (9V DC), and therefore makes the IC run cooler. The 8580 is thus far more durable than the 6581. Also, due to more stable waveform generators, the bit-mixing effects are less noticeable and thus the combined waveforms come close to matching the original SID specification (which stated that they will be combined as a binary AND).
*The filter is also very different between the two models. The 6581 cutoff range resembles a sigmoid function on a log scale, while the cutoff range on the 8580 is a straight line on a linear scale.
 
[https://youtu.be/yadWu7hs4MU Oscilloscope comparison of 4 different SID chips]
<br>
Finally, you could play it with hardware too, with an extension. Read about it on:
* [http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/cpc-sid/ Bryce's CPCSID interface ]. Bryce never actually built the CPCSID, it only made it as far as a design concept on paper. [httphttps://www.cpcwiki.eu/forum/amstrad-cpc-hardware/new-amstrad-cpc-sound-board-(aka-sonique-sound-board)-sid-part-(wip)/ on CPCWiki forummsg114468/#msg114468 Source].* DaDMaN's Sonique Sound Board [http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/new-amstrad-cpc-sound-board-%28aka-sonique-sound-board%29-sid-part-%28wip%29/ DaDMaN's Sonique Sound Board], based on CPCWiki forumthe SwinSID SID clone. You can hear how DaDMaN's interface sounds here: [https://soundcloud.com/david-donaire-s-nchez/sets/amstrad-cpc-sonique-sound/ Playlist on SoundCloud]* [https://github.com/lambdamikel/Speak-SID LambdaMikel's Speak&SID] Speak&SID can use the original 6581, the 8580, as well as modern re-implementations of the SID chip such as SwinSID or ARMSID.* [[RSF3|TMTLogic's RSF3]]The ARM chip emulates the SID.
You can hear how DaDMaN's interface sounds here: According to [https://soundcloudpatents.google.com/david-donaire-s-nchezpatent/setsUS4677890A/amstrad-cpc-sonique-sound/ Playlist on SoundClouden Google patents for US4677890A], the patent for the SID chip is now expired.
*[https://youtu.be/yadWu7hs4MU Oscilloscope comparison of 4 different CIo93AE8Fsw SID chipsPhase Accumulator explained] by [[Jeri Ellsworth]]*[https://youtu.be/fQU-WZZ67yM C64 SID vs Amiga Paula sound chip] [https://youtu.be/ioZRUVTKLx0 C64 SID vs Atari Pokey]* [[Media:Mos 6581 sid.pdf|SID chip datasheet]] [https://www.waitingforfriday.com/?p=661 Web version]*[http://www.sidmusic.org/sid/sidtech.html Technical SID documentation]* [https://github.com/libsidplayfp/SID_schematics/wiki SID internals documentation] [http://forum.6502.org/viewtopic.php?f=8&t=4150 Understanding the SID]
*[https://www.oxyron.de/html/registers_sid.html Oxyron SID reference]
*[https://ultimatesid.dk/ Ultimate SID Collection]
*[https://www.hvsc.c64.org/ High Voltage SID Collection]
*[https://youtu.be/Li-y42ie8-k Mix I] [https://youtu.be/b8ERcaXtK6E Mix II] [https://youtu.be/285q-PfYUYc Mix III] [https://youtu.be/NctPQfYFbI8 Mix IV] C64 Commodore music 1 hour
*[https://www.wothke.ch/tinyrsid/index.php webSID] [https://deepsid.chordian.net/ DeepSID] Online SID chip emulators
<br>
[[Category:Non CPC Computers]][[Category:Music and sound|*]] [[Category:Electronic Component]]
12,789
edits