My Teensy 3.1 Commodore SID Emulation / Player

Status
Not open for further replies.

syso123

New member
I had a bit of fun with the Teensy Audio Library and implemented a MOS6581 / SID emulation using the
Teensy 3.1. It can play SID-Dump Files, which are register dumps of 25 registers updating 50/60 times a
second and setting the corresponding SID-Registers.

I am handling the register changes in a simple routine and setting the corresponding oscillator frequencies, filter cutoff frequency,
filter routing, filter resonance etc. according to it.

Here is how it sounds (sorry for the shaky video):

Features supported so far:
* Write to 25 of the SID registers
* Set global volume via register
* Set each oscillators frequency smoothly via registers
* Change waveform of each voice
* Noise (Linear Feedback Shift Register) implemented and working
* Filter controls / routing working
* Filter masks working
* Envelope registers working (timing needs to be verified, though)

There are still a few bugs:
* The ring modulation doesn't work so well yet - the output gets too silent.
* Oscillator sync is not implemented yet

And also a few things I'd like to include one day (possibly one of you could help?):
* 6502 CPU Emulation, for supporting real SID files (can be ported from libsidplay)
* Making a library out of it, for easier usage
* Combined waveforms support

I will release the source code soon - it's just a big mess of spaghetti-code now, but it works.
 
Last edited:
Thanks for the Feedback. I would certainly need help porting the 6502 CPU Emulation in order to support real SID file playback.
Would be also nice, if somebody could help me track down the ring modulation issues.

Quick warning: Please be ready to see some spaghetti code, cause right now it's not really a clean implementation (but as I said, it works) ;)
 
Thanks for the Feedback. I would certainly need help porting the 6502 CPU Emulation in order to support real SID file playback.
Would be also nice, if somebody could help me track down the ring modulation issues.

Quick warning: Please be ready to see some spaghetti code, cause right now it's not really a clean implementation (but as I said, it works) ;)

Oh, i 'm interested, esp. in porting the 6502-emulation.
I've already ported some things to teensy, like flac or mp3 playback.
 
Awesome!!!!!!!!!!!! :)

HOLY SH!T !!!!

I have just bought a teensy 3.2 and audio board after seeing the audio library and thinking i could make a 4 channel sid-like deal with extras like the chorus.

I am just finishing building my first analogue synth and wanted 4 adjustable sid voices , this looks great.

All of the registers could be read from pots on the SPI giving complete control in a patchable synth :)

Is the filter emulation working ? Will you be releasing the source into the wild ?

Lee
 
We're working on a port of "reSID", which is a very good emulation of the SID chip. I think it's just a matter of days. It allows to use every register of the virtual chip.

Edit:
For a sidplayer, there is an issue - i'm not sure if can solve it with the Teensy. For a real c64-6502 emulation we need 64KB RAM (sids are 6502-machine code)
Perhaps there is a way to use less, but at the moment, its more likely that we have to wait for the next-gen Teensy with way more RAM (should come 2016)
 
Last edited:
Thats great. For me just the patchable bit would be fine. How much cpu time does the code take ??

Although not much use to me but the sid player soft 6502 wouldnt neccesarily need to access the whole 64k would it ? Just a bank where the tune code was located ?

Or maybe code up a relocator routine for the sid to always occupy a certain bank ?my 6502 is far too rusty but im sure someone could do it .
 
Thats great. For me just the patchable bit would be fine. How much cpu time does the code take ??

Although not much use to me but the sid player soft 6502 wouldnt neccesarily need to access the whole 64k would it ? Just a bank where the tune code was located ?

Or maybe code up a relocator routine for the sid to always occupy a certain bank ?my 6502 is far too rusty but im sure someone could do it .

CPU-Time: Too early to say :)
Relocation: Yeah, maybe that's possible.. my 6502 is very rusty, too... i don't remember much.
 
...

Ghostbusters !

https://drive.google.com/open?id=0Bx2Jw84lqebkRnYtZ2JLZWlEZ28

imgres
700px-Ghostbusters.svg.png
 
Thats great. For me just the patchable bit would be fine. How much cpu time does the code take ??

Here's a first version:
https://github.com/FrankBoesing/Teensy-reSID

An example DMP Player is included.
CPU-Usage is somewhat 30%..50% at the moment - i hope it can be reduced.
But, that's not bad for 3 voices including effects & filters.
The oversampling runs at nearly 1MHz!

It would be great if you could help developing it further. The reSID is quite old, but was the best one at it's time.
But there my be issues, introduced by my porting. Nevertheless, most "DMP" Files are playing good.
 
Last edited:
Frank, you are amazing. Every once in a while I go back to those soundtracks. Pretty incredible what they were able to tickle out of the hardware.
 
Last edited:
Every once in a while I go back to those soundtracks.
me too..
Pretty incredible what they were able to tickle out of the hardware.
Yes, and the hardware was imperfect, had bugs and so on - those bugs made some things possible where commodore did not even think of.
Esp. the SID had some Hardwarebugs. The "sample" playback for example were only possible because a part of it produced a "klick" under certain circumstances.(I think the reSID emulation above reproduces this bug.)
 
Here's a first version:
https://github.com/FrankBoesing/Teensy-reSID

An example DMP Player is included.
CPU-Usage is somewhat 30%..50% at the moment - i hope it can be reduced.
But, that's not bad for 3 voices including effects & filters.
The oversampling runs at nearly 1MHz!

It would be great if you could help developing it further. The reSID is quite old, but was the best one at it's time.
But there my be issues, introduced by my porting. Nevertheless, most "DMP" Files are playing good.

This is fantastic ..... running a dual sid on a teensy with a load of adc inputs dangling off the SPI bus is almost a reality :D

Looks like im gonna have to build another synth :D !!!!!!!

EDIT - can this be used without an audio board using the built in 12bit DAC output ????
 
Last edited:
i did'nt try two sids.
it's independend of the output.
if you want, you can use SPDIF, DAC, or every other audiolib-output object
 
i did'nt try two sids.
it's independend of the output.
if you want, you can use SPDIF, DAC, or every other audiolib-output object

Sorry for the noobish question but i just got my teensy 3 days ago and my audio shield today........

does the audio library require the audio shield, I mean if i use DAC out can i without the shield ??

How can you use 2 instances of the library??? I tried importing your GUI code into the online designer but the sid part was missing ?

lee
 
The library does not require the shield.
There is no need to use two instances of the library. Use the mixer object.
There can only be one output - but all signals can be combined with a mixer.
You might want to visit this page: http://www.pjrc.com/teensy/td_libs_Audio.html
, and the design tool.


..and most important: try the examples first, to get used with it.

Edit: Ah, yes, of course the sid part is missing. The design tool does not know that it exists.

I don't know wether Paul is interest to include it, or not. It's not easy to use, there isn't a simple "play()" method due to the nature of chip-emulation. The registers want to be set :)
But you can use any other input, and rename the input-object in the xported code.
 
Last edited:
The library does not require the shield.
There is no need to use two instances of the library. Use the mixer object.
There can only be one output - but all signals can be combined with a mixer.
You might want to visit this page: http://www.pjrc.com/teensy/td_libs_Audio.html
, and the design tool.


..and most important: try the examples first, to get used with it.

Edit: Ah, yes, of course the sid part is missing. The design tool does not know that it exists.

I don't know wether Paul is interest to include it, or not. It's not easy to use, there isn't a simple "play()" method due to the nature of chip-emulation. The registers want to be set :)
But you can use any other input, and rename the input-object in the xported code.

What i meant was how too invoke two instances of the SID library , I understand there is only the 1 dac output and everything must be mixed down to this.
 
Import this into the GUI-Tool:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioPlayMemory          playMem1;       //xy=99,89
AudioPlayMemory          playMem2;       //xy=102,148
AudioMixer4              mixer1;         //xy=337,97
AudioOutputAnalog        dac1;           //xy=541,84
AudioConnection          patchCord1(playMem1, 0, mixer1, 0);
AudioConnection          patchCord2(playMem2, 0, mixer1, 1);
AudioConnection          patchCord3(mixer1, dac1);
// GUItool: end automatically generated code

and replace "AudioPlayMemory" by "AudioPlaySID" after export.
But, again, i did not test two SIDs. But i have more time after christmas and am willing to bring it to work (if it does NOT work now)
 
Status
Not open for further replies.
Back
Top