SID Chip and 8 Bit Arduino DAC

Hi people there,

I'm new to the Arduino community and started to play with an Arduino board 3 weeks ago. I have been through several schematics, eventually implemented a good Midi interface, played a lot with PWM and R2R ladder DACs, and made a simple but efficient shield for the Commodore SID chip.

Just wanted to share two things here :

A "DIY" SPI 8 bit DAC worth 0,85€ using R2R ladders and a 74HC595. It has been proved to work very well and allowed 8 bit R2R DAC on my Uno without using 8 pins of the board, and reaching output rate of 330kHz, far higher than any audio rate you'd expect.

The SIDaster shield is an Arduino shield for the SID (MOS6581 and nexts) audio chips from Commodore. It has been test proven to work well with diodes and a real SID chip.

However, I'm sharing the stuff, and would be glad to gather any feedback you have.

Loving the Arduino,

Vincent

Hi Vincent,

Would make a very nice signal generator.

about extending to 16 bit: by using 2 595's you could create a stereo 8 bit too

Can you post some code you used to test?

Thanks, Rob

You're right ! added some code samples and digged a little into the details of how my DDS works. I hope this helps, Vincent

Hi Vincent,

Thanks for the code, is an improvement,

not to nag, a complete running sketch is what most people (and I) like the best ;)

Rob

This looks like a small bump indeed, but thanks to the help of another enthusiast Arduino SID user, the SID shield has produced its first sounds a few hours ago. The code will be updated with the bugs found, but it's alive, ALIVE ! :)

So did anyone had any luck in interfacing with MOS 6581 \ 8580 SID? I want to do that, but have no idea where to start =( For instance, if I have Arduino mega2560 and MOS 6581 - I'd like to be able to play sound directly from the arduino itself (take the sound bytes from an SD, and put them into 6581's registers - no emulation, no external MIDI source). And, possibly, seeking a way to decode SID files into registers that I can send to the SID and play. Any ideas? Googled a lot, still haven't found a decent solution, where everything's explained.

To answer your question : the Arduino SID Shield & Library I propose >>here<< is the solution to control a SID side. Thanks to the help of another SID enthusiast Matthew (who kindly gifted me with one of his SIDs when i broke mine), it has been proven to be working good.
We both made our SIDs sound great using the same schematic. For the library itslef, matthew and i are improving it at the moment, I shall release an updated version end of next week.

But the schematic in itslef is perfectly working: you can use an Arduino to both :

  • generate the SID clock and manage it
  • access its memory registers using HW SPI through two 74hc595

I also have a shield prototype under construction, as you can see in the image attached.

Concerning the SD card: you need to dig elsewhere, like the shields from Rugged Circuits which are a good choice. You will however encounter SPI concurrent access though, so you’ll have to make chip select tweaks.

So I guess I just need to omit the MIDI IN part of the scheme, and I'm good to go =) I've decided to use an external 1MHz quartz generator to minimize pain with clocking; and, concerning SD, I believe, I am gonna read the SID data in 512B blocks to an internal buffer in RAM, and I'll have to switch between two fours of SPI pins on the fly: SPI to SD -> Read data to a buffer -> switch to SID -> resume playing from RAM. Hopefully I will have enough time for all this to not to interrupt playing =) I just need to wait for my SID package to arrive =)

Timing is THE thing I'm working on actually.

As per now, a SID 8 bit Write takes rouglhy 600us, including the 300us delay needed byt the SID to "digest" the data before being available for a new Write.

By the way, could you share the full code, that can play the midi from midi-in according to your schematic? =)

Sure, here it is, the debug code for a mono 3 harmonics Synth.

Note that the Midi handlers are built to maintain memory of the previous note played, to enhance the playability of the synth when playing legato on a keyboard (i.e. pressing the nex note while the previous one is still pressed, to avoid note off collison).

The SID library is being updated atm, but it shall work with this one.

Have fun !

(and again : credit for the SID Library last release goes to Matthew D.)

SID.zip (4.34 KB)

I am damn very much grateful!!! XD Since I’m a newbie, that’ll help me greatly to adapt the code for my project for the ongoing 8bit event =) I would certainly mention that it would not be possible without this library (well maybe it could be, but I wouldn’t have finished my work in time =) )
Can’t wait for my SID to arrive to start tinkering around with SD read. I’m planning to make it switchable: option 1 - play from SD, option 2 - play from a midi synth, option 3 - input 8bit pcm and decode it. I’ll post here when I achieve at least something =) also it would be nice to see lib updates here, as they occur =) Thanks again !!! :grin:

D4p0up: Thanks to the help of another SID enthusiast Matthew (who kindly gifted me with one of his SIDs when i broke mine), it has been proven to be working good

Would you please update your website, stating that it indeed does work with a working SID chip ? I stumbled upon your site earlier, and left because the site tells me that you never really had it working besides with an "dummmy" SID...

// Per.

Hi.

Sorry you stumbled upon it, unfortunately it has been successfully "Real-Sid-tested" last thursday night ... and i could only update the website yesterday night.

So now the article has been updated, and more than anything : MAH SID IZ MAKIN NOYZ !

http://fullmaj.rd-h.fr/wordpress/?page_id=262

Regards

Ohh, nice!!

Can you upload a sound sample somewhere so i can hear the noise ? :wink:

// Per.

Late coding night for me tonight, blog updated with a "brute" sound sample of the shield.

Also added timing measurements and a scope screen of the Midiframe VS sound delay.

Peace, Vince

MOS 6581 Arduino Synth Beta 1 released.

Midi implementation completed, the SID is configurable with midi CC messages. Lots of fun out of it, a few samples indeed:

Jungle Bass<< Pattern from Laphaze
Vintage Chord<< They still rock
Vintage Keyb<< sooo groovy

More details on the blog, I’m tired but very happy!

Finally, I’ve got some results! :stuck_out_tongue: https://plus.google.com/u/0/photos/118406236768471008972/albums/5669397511077380353
So, we’ve managed to make Arduino play SID dumps from an SD card (A text file containing addresses and data to send). However, it’s currently very buggy - my project partner wrote his own code - not based on D4p0up’s work, and currently we have some problems, probably with timing - the SID occasionally plays extra notes where it shouldn’t - that can be seen on slow music with low amounts of data to send - like Super Mario Bros. Still, as you can see from the video, playing files with high note density goes okay. Any ideas? I’v attached the code below.

SID_Test.ino (3.24 KB)

Hi! First congratulations with getting sound out of the SID, it's always a huge moment :)

Concerning your ghost notes issue, I had the same one with my own SW, which I eventually solved by adding a 300us wait command after each SID write (see the library, inside the SID.cpp). It seems, but I could not verify it firmly with other internet sources, that the SID somehow needs time to store Data, event if the transmission time is announced to be much faster in the datasheet. 300us is Ok for sound devices.

I'm curently in the process of building a MOS6581/8580 datasheet using feedback from my own work and scanned versions of the datasheet from SID websites. you can find it here, I added other tricks and tips that shall help (note: it's not finished and will be improved alongside with the SIDaster updates).

Concerning the SIDaster Shield & Synth, 5x5cm Shield prototype is almost finished, as you can see here. I'm still waiting for another development board I have designed to continue with SW programming. Next release will include Preset handling through Dedicated Sysex Messages, Polyphonic - 3 notes - mode, and first release VST Gui that handles patch editing and preset saving (Windows only). Preset format and Midi implementation is already detailed on the project page.

I don't want to commit on a date, but it's moving on. This is a spare time project and I'm quite busy with regular job stuff ATM.

Regards,

Hmm, I tried delays in various places, does not seem to have any effect. Moreover, with delay = 600us it plays slowly, but still with extra notes popping out absolutely randomly. Don't have a clue =(