Archive for the ‘SID 6582 (Commodore64)’ Category

SID Oscillator Verilog Fun

Monday, April 12th, 2010

The past few days I’ve been waiting for Pokey synth front panel circuit boards to come in, so I thought I’d play around with some “soundchip” Verilog. Kevtris has already done a SID emulation in an FPGA (and understands the internals of the SID far better than I do), but I haven’t seen any code posted. I saw this blog post and eventually ended up at this interview I bookmarked a year or so ago.

I wrote some Verilog strictly according to the interview, specifically making an oscillator with triangle, saw, pulse, and noise outputs. I added in the logic “AND” of the triangle and saw waves as an additional waveform, according to Bob Yannes’ comments about multiple waveforms being selected at once. Here’s what the digital outputs looks like:

Only the Waviest

Only the Waviest

My source code is available here. I included excerpts from the interview as comments because it just felt so right. Open it with Notepad++ for best results (if you want all the formatting to line up properly).

What I still need to figure out:

The interview mentions that the LFSR for noise generation is clocked by one of the accumulator bits. Which bit is it?

Another excerpt from the interview that I’m partially unclear about: “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.” A linear feedback shift register shouldn’t be able to get filled with all zeros on its own.┬áThis implies that the LFSR shift register does not take feedback taps from itself, but actually taps somewhere further down the line (after the logical AND). Is it actually feeding back from the Waveform D/A input bits? In that case, what happens to the LFSR while it isn’t selected as a waveform?

Are the inputs to the Waveform D/A registered synchronously to the master clock, or do glitches pop up from not having every bit change at exactly the same time?

At this point I really need to fire up an actual SID to start checking my assumptions, but I’m afraid that if I touch a SID now then I’ll end up too distracted when the Pokey synth prototype PCBs come in.

Just Some Chips

Saturday, March 21st, 2009
I had a pretty big breakthrough on the analog module side of things this week, but it is too boring and technical to write a post about until I get some audio going. Instead, here is a picture of a bunch of chips.
Its always good to have spares

It's always good to have spares

You might wonder, “Why so many chips? Are those all going into one single 1000-voice ultimate chip synth? Is mortality really a limitation, or is it a freedom from this ‘mortal’ coil?”

The answer to all of those is that I do plan to sell finished versions of these designs. I wanted to do kits for a while, but it is too time-consuming to make DIY solutions to all the digital work involved here. On the other hand, if I can get a streamlined manufacturing process then I can sell finished modules for less than what I would’ve been able to sell kits for. I can also fit more into less space using surface mount parts.

The definite designs are:

Pokey.synth analog module

Pokey MIDI

Nintendo analog module

Nintendo MIDI

YM2413 analog module

I have some plans together for a monster SID synth module with ridiculous features, but I don’t think anyone would be willing to pay what it would cost. Also, it would take up two full rack spaces.

Filter Test inSIDents and a Hardware Hiatus

Saturday, October 18th, 2008

The past couple days have been mainly about dissecting the SID 6582 datasheet, with an emphasis on the filter section.

“Both capacitors should be the same value” – pg. 7

No reason for this is given. I read some claims online that matching the capacitors provides the most resonance, but wanted to see for myself. My result is the opposite, that using unmatched capacitors can provide much more resonance. The next question is… why?

“These pins are used to connect the two integrating capacitors required by the programmable Filter” – pg. 7

This implies the filter uses integrators, which likely leads to a topology that follows the schematic at Antti Lankila’s 6581 distortion page.

So I worked out the transfer functions from that circuit and tossed them into Octave (the MATLAB alternative for all of us no-longer-students) for simulation. It turns out the resonance is augmented proportionally by the ratio of the cap values. The cutoff frequency depends on the geometric mean of the capacitor values, sqrt(C1*C2).

…so what does more resonance from a SID sound like?

Filter sweep using an internal SID oscillator:
Matched caps set to maximum resonance
Unmatched caps set to maximum resonance

Filter sweep using external audio input with a drum loop:
Matched caps set to maximum resonance
Unmatched caps set to maximum resonance

For those of us using the SID in synthesizers, more resonance is very welcome if it can be manipulated properly. My 6582 is not behaving according to the aforementioned schematic in terms of the bandpass response to unmatched capacitor values. Where the simulation shows more bandpass resonance, the real 6582 is choking into a no-pass filter. Off the top of my head I do not have any guesses as to why. There are a couple other, more expected inconsistencies:

“The approximate maximum Cutoff Frequency of the Filter is given by:
FCmax = 8.2E – 5/C” – pg. 7

This is not true at all according to tests with a real SID, and is most likely based on the assumption:

“Together these [FC Lo/FC Hi] registers form an 11-bit number which linearly controls the Cutoff Frequency of the programmable Filter.” – pg. 5

It is more likely a tanh-type function, saturating in the extreme ranges. I need to do a lot more testing to confirm.

This week I am moving across the country, so as of today I am packing up all my circuit projects to ship ahead of me. It is unlikely that I will be able to resume on them until I am settled in at my new job, so all my projects will slow down for a while. In the meantime I might be able to get some measurement tools coded.

inSIDious Filtering

Wednesday, October 15th, 2008

Serendipitously, I came across some poly film capacitors in just the right range for the SID 6582.
I changed my program code to sweep through the standard filter configurations.

Click Here for the resulting sound file. The order is low-pass, high-pass, band-pass, band-reject. Each type gets 16 up/down sweeps, each time increasing the resonance by 1.

The SID filter control is linear (ie, not musical), giving resolution that gets worse for decreasing octaves. I used 22nF for the control capacitors, which is nice for low frequency resolution but limits the maximum cutoff quite a bit.

The next step is to run lots and lots of testing on the filter for cold, hard statistics.

SID Vicious

Tuesday, October 14th, 2008

Sid Saw

Click Here for a quick audio test. It is just oscillator one doing two frequency sweeps (sawtooth then noise) and a few PWM sweeps with the pulse wave. I don’t have the right filter caps to do anything too funky yet.

Yesterday I worked out routines for controlling a SID 6582 chip directly from a microcontroller. Now I have complete control of all the registers and relatively fast updating (~9 microseconds per update, which can be cut down much further). I looked into the current SID synths, such as the MIDIbox SID, SidStation, and HardSID, but they all had a different design goal in mind. I want fast voltage control for interfacing with a modular synthesizer. The SID can handle 1,000,000 bytes of data per second, making it a great candidate for faster-than-MIDI-can-ever-dream manipulation.

…and not just frequency and amplitude modulation. Each oscillator on the SID has a bit that can be used for hard-sync to external signals. It really is the soundchip to rule them all, I’ve just been putting off messing with it due to the extravagant cost.

2A03: $5
YM2413: $8
SID: $20+

Hopefully I can get a few more 6582s before the MIDIbox crew buys out all the remaining stock in existence : )