PDA

View Full Version : My Teensy 3.1 Commodore SID Emulation / Player



syso123
12-15-2015, 02:10 PM
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):

https://www.youtube.com/watch?v=zscG4F1qie8

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.

Frank B
12-15-2015, 04:40 PM
Awesome :-)

PaulStoffregen
12-15-2015, 05:14 PM
Oh my, you're going to be *very* popular with this one!

adrian
12-15-2015, 05:24 PM
Oh my goodness

nevvkid
12-16-2015, 02:23 PM
Awesome!!!!!!!!!!!! :-)

syso123
12-16-2015, 02:39 PM
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) ;)

Frank B
12-16-2015, 04:07 PM
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.

syso123
12-16-2015, 04:10 PM
Oh, i 'm interested, esp. in porting the 6502-emulation.
I've already ported some things to teensy, like flac or mp3 playback.

Cool! Can you send me a PM? I will add you as a user to my git repo!

braincell
12-19-2015, 11:34 AM
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

Frank B
12-19-2015, 11:37 AM
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)

braincell
12-19-2015, 11:53 AM
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 .

Frank B
12-19-2015, 02:18 PM
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.

Frank B
12-19-2015, 07:53 PM
Hi,

first reSID recorded sound (a DMP File):

https://drive.google.com/file/d/0Bx2Jw84lqebkd18xV1o4X2hjRms/view?pref=2&pli=1
(MP3 Download)

..still do not know the CPU Usage, but will measure it tomorrow or in the next days.

I've turned the SID-Emulation to a Audio-Lib object, instead of the play() method, theres a method to set all virtual registers.

Frank B
12-19-2015, 09:26 PM
...

Ghostbusters !

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

http://images.google.de/imgres?imgurl=https%3A%2F%2Fupload.wikimedia.org%2 Fwikipedia%2Fde%2Fthumb%2F3%2F3d%2FGhostbusters.sv g%2F220px-Ghostbusters.svg.png&imgrefurl=https%3A%2F%2Fde.wikipedia.org%2Fwiki%2F Ghostbusters_%25E2%2580%2593_Die_Geisterj%25C3%25A 4ger&h=192&w=220&tbnid=tbGvV11TXS8bmM%3A&docid=Nxe2qDsJKGeT0M&ei=ftl1VuTEJouxUdyEndgD&tbm=isch&iact=rc&uact=3&dur=309&page=1&start=0&ndsp=22&ved=0ahUKEwjk-9Hv--jJAhWLWBQKHVxCBzsQrQMIOTAB5859

Frank B
12-19-2015, 11:11 PM
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.

Constantin
12-20-2015, 04:45 PM
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.

Frank B
12-20-2015, 08:19 PM
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.)

JLS
12-20-2015, 08:52 PM
Many thanks great work

how to convert *.sid file to *.dmp ?

braincell
12-21-2015, 12:24 PM
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 ????

Frank B
12-21-2015, 07:20 PM
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

Frank B
12-21-2015, 07:21 PM
@jls, if you find a way, let me know.

braincell
12-21-2015, 07:46 PM
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

Frank B
12-21-2015, 07:50 PM
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.

braincell
12-21-2015, 08:04 PM
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.

Frank B
12-21-2015, 08:12 PM
Import this into the GUI-Tool:


#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)

braincell
12-21-2015, 08:30 PM
Frank you are "The Man" :D

Im going to solder a pinheader onto the teensy after work tommorrow and give all this a go over xmas :)

braincell
12-28-2015, 07:57 PM
hi i have just installed arduino 1.6.7 and teensyduino Beta, but im getting a compile error ???

C:\Users\user\AppData\Local\Temp\buildb5c805015305 3bebccae74d3bf254918.tmp\sketch\sid.cpp:29:29: fatal error: reSID\envelope.cc: No such file or directory
#include "reSID\envelope.cc"
^
compilation terminated.

Any ideas anyone ??

edit - sketch folder is C:\Users\user\Documents\Arduino\reSID
Arduino dir is G:\tools and stuff\arduino-1.6.7

thanks lee

Frank B
12-28-2015, 08:51 PM
but that file is included :)
Sounds like a wrong installation.
1 Close Arduino.
2. Create a subirectory "reSID" inside your private "libraries" -folder under "Documents\Arduino"
3. Copy the contens of the directory from the zipfile into the newly created folder "reSID" - there will be another "reSID" folder inside the first, like this : Documents\Arduino\libraries\reSID\reSID
(..here's the missing file "envelope.cc", too)
4... i just noticed that the directory-structure is for the example is wrong. Just double - click on the reSID.ino file in your explorer. Arduinio will ask you how to proceed (click "ok")

braincell
12-29-2015, 08:33 PM
but that file is included :)
Sounds like a wrong installation.
1 Close Arduino.
2. Create a subirectory "reSID" inside your private "libraries" -folder under "Documents\Arduino"
3. Copy the contens of the directory from the zipfile into the newly created folder "reSID" - there will be another "reSID" folder inside the first, like this : Documents\Arduino\libraries\reSID\reSID
(..here's the missing file "envelope.cc", too)
4... i just noticed that the directory-structure is for the example is wrong. Just double - click on the reSID.ino file in your explorer. Arduinio will ask you how to proceed (click "ok")

OK Im still having major trouble with this.

Im on windows 7 , i was running arduino IDE from a zip download , i had programmed several non-teensy boards before so i know it had worked , I installed 1.6.7 also from zip and the teensyduino, Thats how i got yesterdays results.

Today i cleared the installation , downloaded the 1.6.7 package installer and installed and also installed teensyduino , so far so good.

created "reSID" folder in ARDUINO.
copied contents of the zip directory into above .
Inside ARDUINO/reSID/ there is another reSID folder.
moved reSID.ino into ARDUINO/reSID.

verified and got....

C:\Users\user\AppData\Local\Temp\buildb5c805015305 3bebccae74d3bf254918.tmp\sketch\sid.cpp:29:29: fatal error: reSID/envelope.cc: No such file or directory
#include "reSID/envelope.cc"
^
compilation terminated.

The envelope.cc is in the ARDUINO/reSID/reSID folder.

what have i messed up ??? :(

defragster
12-29-2015, 10:57 PM
For my 'private' libraries, in the IDE I did "File / Preferences / Sketchbook Location" to a directory as "C:\tCode". That directory is where I save all my private sketches and it also has a "C:\tCode\libraries" directory where I put any 'private' local libraries.

If you did a layout like this you should put the files there in libraries\reSID and have all the files needed in that single directory.

I only do the 'unzip installs' at this time ( to I:\... ) as then the installer doesn't impute any knowledge or control over my system so I can have multiple 'zip installs' that all work.

The sketchbook independent of any install lets me wipe and install any IDE with no harm to my 'private' stuff that works across any install.

A library there takes precedence over other installed libraries and the IDE confirms that on compiling, thanks to Paul.

<edit> I'm not ready to try this yet - but pulled the ZIP to my indicated libraries folder.

The IDE 1.6.7 no longer shows 'libraries' as a folder under 'sketchbook' as it did before, and I look to 'examples' to see 'Teensy-reSID' where I see reSID twice and no EXAMPLES? [ this is odd layout? ]

So I opened first reSID and it compiled for me as dumped from the ZIP file - and I had a private "SdFat" that I had to remove from my libraries as it is now old.


Directory of C:\tCode\libraries\Teensy-reSID
12/29/2015 04:20 PM <DIR> examples
12/29/2015 04:20 PM 59 README.md
12/29/2015 04:20 PM <DIR> reSID
12/29/2015 04:20 PM 2,457 reSID.cpp
12/29/2015 04:20 PM 1,986 reSID.h
12/29/2015 04:20 PM 2,072 sid.cpp
12/29/2015 04:20 PM 1,616 sid.h

braincell
12-29-2015, 11:42 PM
*Facepalm*

I feel such a pilchard.......

OK, I created C:\Teensycode\Libraries\reSID

dumped the contents of the zip directory into above

Created C:\Teensycode\reSID

copied reSID.ino alone into above.

set my IDE to read C:\Teensycode as sketchfolder

And......... IT COMPILES !!! :D

Many thanks all , think i have so much too learn......

braincell
01-12-2016, 12:09 PM
SO.......

I'm learning a little bit and have hacked the SIDASTER synth into the teensy along with the reSID code from frank.

So far, so good , mono synth is working under usbmidi control with access too all 3 voices and there options.

Im working on some new POLY synth code which will give 2 modes.....

duo mode - 2 notes using the whole sid each for each note , 3osc etc but sharing wave / adsr / filter / ring / sync settings between virtual SIDS (hopefully if i get 2 sids running along with my spaghetti code)

poly mode - 6 notes using 1 voice per note (again , if i get 2 sids running)

Else it will be 3 notes and duo will be mono :D

Lee

Frank B
01-12-2016, 08:45 PM
I was told, that there might a problem with two SIDs.
I'm currently very busy, but i look at this, as soon as i can.

I started working on the 6502-emulation too - i can't promise that it will be fast enough together with reSID, but i'm very curious if the T3.2 is able to play SID-files... the needed RAM-relocation for the c64emulation adds some more cpu-cycles. i reall don't know if this all will work , but, hopefully, i can say more in feb.

Frank

Frank B
01-12-2016, 09:01 PM
...does anybody know wether it would be allowed to include a copy of the C64-ROMs ?
Running the C64-Basic interpreter on the Teensy would be cool :)

adrian
01-12-2016, 11:29 PM
Are you asking about copyright?? the rule for game roms is that you can't use them unless you are licensed ... and that is usually meaning "own the rom itself" ... even then you would have to wonder about format shifting ... depends on the terms of the license you have... I'm guessing copyright isn't up yet on C64 roms ... then there is the whole copyright in software / hardware issue

braincell
01-13-2016, 08:19 AM
Problem ?

I'm going to try assigning 1 SID to each channel as a start.

I may even try to set up a master slaves type deal at some point with multiple teensys :D

but even with 1 SID and once polyphony and pitchbend , patchs etc work i will work on adding 1v/octave and CV support.

As for copyright......... (there's always 1) Vice supplies roms with its emulator .
And, As this is a hobby project would anyone really be bothered about coming after (legally) a sid player ??

fms1961
01-13-2016, 08:56 AM
...does anybody know wether it would be allowed to include a copy of the C64-ROMs ?
Perhaps you may ask some authors of C64 emulators/simulators how they solved this problem.

braincell
01-13-2016, 01:03 PM
hmmmm..Yep definately a problem , tried 2 SIDS and it locked teensy :/

Frank B
01-21-2016, 10:00 PM
hmmmm..Yep definately a problem , tried 2 SIDS and it locked teensy :/

Hi,

i have good & bad news:

good news: i have a 2 SID working version
bad news: you have to compile it with 144MHz -O2

But maybe this is ok for a synthesizer...

I want to clean up it a bit first, and upload it soon (maybe tomorrow)

(edit: just for fun i'm playing two different DMP-Files parallel at the moment..sounds like funfair..)

braincell
01-22-2016, 07:40 AM
Hi,

i have good & bad news:

good news: i have a 2 SID working version
bad news: you have to compile it with 144MHz -O2

But maybe this is ok for a synthesizer...

I want to clean up it a bit first, and upload it soon (maybe tomorrow)

(edit: just for fun i'm playing two different DMP-Files parallel at the moment..sounds like funfair..)

For a synth 1 sid is fine , Have re-written the midi code from Sidaster almost completely and 3 voice poly mode is working very well.

Im trying to implement some effects that normally would be done from the 6502 , Tremolo , Vibrato , anything that alters settings at 50hz etc

Does the resid code use so much cpu time by itself ?

Maybe a master / slave arrangement for multisids a'la midibox :)

Wondering if a teensy and resid could be used in a real c64 like the swinsid ?

lee

Frank B
01-23-2016, 02:31 PM
For a synth 1 sid is fine , Have re-written the midi code from Sidaster almost completely and 3 voice poly mode is working very well.

Im trying to implement some effects that normally would be done from the 6502 , Tremolo , Vibrato , anything that alters settings at 50hz etc

Does the resid code use so much cpu time by itself ?

Maybe a master / slave arrangement for multisids a'la midibox :)

Wondering if a teensy and resid could be used in a real c64 like the swinsid ?

lee

Yes, the reSID code needs much cpu time. Keep in mind that it was written for desktop-computers!
But there are not much places to optimize.

I've done some updates and (small)optimizations during the last days (..and there are more planned)

And i've uploaded an example for two sids.

Regards,
Frank.

edit: add 6 voices poly mode to sidaster :)

Frank B
02-01-2016, 07:48 PM
I've done some little optimizations, and took some improvements from the newest, not seperately published version of reSID (Version 1.0)
"DemoSauce" speed is increased by some FPS.
The code needs some cleanup, and i think in some days i can update the github-version.

The main reason for this post is: I have decided to put the SID-Player and 6502-Emulation on hold until the the next Teensy with more RAM is released.
That additional RAM is really needed, and it will be faster. So, it makes more sense to wait.

Regards,
Frank.

braincell
02-10-2016, 12:36 PM
I've done some little optimizations, and took some improvements from the newest, not seperately published version of reSID (Version 1.0)
"DemoSauce" speed is increased by some FPS.
The code needs some cleanup, and i think in some days i can update the github-version.

The main reason for this post is: I have decided to put the SID-Player and 6502-Emulation on hold until the the next Teensy with more RAM is released.
That additional RAM is really needed, and it will be faster. So, it makes more sense to wait.

Regards,
Frank.

A new Teensy !!!!! **** Facepalm **** will it be pin compatible ??

I have designed some pcb boards for a mega SID implementation ala MIDIBOX based on all this and im current doing a CV pcb board :D

so far i have a routing board that splits the midi into 16 and also houses a Teensy SID voice , A SPI board with 24 analogue inputs and 16 Digital inputs & 16 Digital outputs.

PaulStoffregen
02-10-2016, 03:59 PM
will it be pin compatible ??


Yes. The plan is a 48 pin form factor, where the 28 left-most pins are exactly the same.

If you're designing a board or project now, perhaps keep any tall part outside of the 1.0 by 0.7 inch region to the right side of the Teensy, so you'll be able to let the larger board hang into that space.

braincell
02-11-2016, 07:35 AM
Yes. The plan is a 48 pin form factor, where the 28 left-most pins are exactly the same.

If you're designing a board or project now, perhaps keep any tall part outside of the 1.0 by 0.7 inch region to the right side of the Teensy, so you'll be able to let the larger board hang into that space.

FANTASTIC...... I couldnt find any specs anywhere for the upcoming teensy though.

I got the best "bang for buck" out of the pcb's i sent to the board house so they will no doubt be revised. :D

Frank B
05-29-2016, 08:51 PM
A little update:
I had not much time (job..) , but had some minutes today and got my Teensy-C64 running :)
Currently it's not very compatible, due to not enough RAM (that will change with the new Teensy) - But it does a 6510 CPU emulation (including "unofficial opcodes + interrupts) , emulation of both CIAs, the PLA-Chip , and the VIC (i'm still working on a fast sprites-emulation - theoretical, it is compatible enought to do some nice raster-line effects - but not tested)
I myself am curious whether the teensy will be fast enough for Sound - the SID emulation is still very very cpu-expensive. Worst case, i'll add an additional teensy for sound. It will be not too much work, because it's already running standalone - just have to include as soon i have enough RAM.

I'm tried to upload a video but youtube is hanging.. maybe later...

Frank B
05-29-2016, 09:18 PM
http://www.youtube.com/watch?v=fxzgse5cpN8

defragster
05-29-2016, 10:41 PM
Cool. Could 4 bit parallel 128MB RAM chip at 24 MHz be used on T_3.2? Like you did for ParFlash. Maybe with a couple cache blocks in Teensy Ram? Depends on how widely the C64 code accesses the full extent of its RAM and READONLY versus write.

Frank B
05-30-2016, 06:46 PM
Hm, i think no. You can run BASIC-Programs, usually the don't need the RAM > 40KB, since it is not usable for Basic (with a small hole at $C000)
For games and machine-code it makes almost no difference where they run and which regions they (random-)access, and they do it :) It would be too slow.
The pure 6510-emu is able to run @ 3x speed of the original, but all the other chips are emulated too, they need the remaining cpu-cycles.. currently i'm @ 1.5x speed, but without SID and the sprites are only partially done..

defragster
05-31-2016, 08:29 AM
:eek: - Finished reading the page I had open - RAM used were already 100ns. That would be tough to achieve with other stuff going on and no cryo cooling and software addressing. Get used to everything having changed so much (CPU speed *100) - and some things not so much - RAM/HDD. Next Teensy should be a big help with RAM and Speed - spare SPI etc.

bcnx
07-14-2018, 10:24 PM
Hi all,

I was googling for a way to build a synthesizer by means of the SID chip. I then stumbled on this thread. Can someone confirm I can use this library to create a synth (choose sounds, generate sounds, change filters, ...)?

Cheers all!

BC

PaulStoffregen
07-31-2018, 03:07 PM
Can someone confirm I can use this library to create a synth (choose sounds, generate sounds, change filters, ...)?


How's this?

https://hackaday.com/2018/07/24/sad-without-a-sid-this-comes-pretty-close/

bcnx
07-31-2018, 05:00 PM
How's this?

https://hackaday.com/2018/07/24/sad-without-a-sid-this-comes-pretty-close/

Awesome, Paul thanks for sharing!

BC

bcnx
07-31-2018, 06:16 PM
I was actually more interested in the capabilities of Frank's library. Tried contacting him, to no avail. Will need to experiment on my own!

BC

bcnx
07-31-2018, 06:28 PM
It seems like his library's primary aim is to play SID dmp files, so no real usability as a software synth. Will have a look at the SID hardware emulation now, maybe that is useable,

BC

mogs
08-14-2018, 12:57 AM
Hi BC

The example Paul linked above (https://github.com/kokotisp/6581-SID-teensy/blob/master/6581-SID-teensy.ino) makes use of Frank's library.
It simply includes Frank's reSID at the top, and then forwards address/data appearing on the teensy 3.6 pins whenever the R/W line goes low by calling setreg()


#include "reSID.h"
...
playSID.setreg(address_lines & B00011111 ,data_lines);
...
etc.

I have previously written code for teensy 3.1/3.2 which was able to successfully make a real SID work.
It was successfully receiving MIDI notes through USB and full control of SID configuration registers through OSC on one of the serial ports (sent from TouchOSC via an ESP8266).
I don't see why this library wouldn't respond well to what I've written, I'll perform some experiments and see if it works.

mogs

bcnx
08-15-2018, 03:00 PM
Hi,

Thanks.
What's not clear to me at this point is how to actually use the library and for instance activate oscillators or any other function the original SID chip can do.

Cheers,

BC

mogs
08-16-2018, 10:31 PM
Hi BC

The library is emulating a SID chip which is a synthesizer digitally controlled at a register level.
So to be able to change the pitch and waveforms etc you'd need to send sequences to modify these register values.

I've encountered several libraries which have been written to provide more friendly function calls to interface with the synthesizer. (e.g. CharlotteGore (https://github.com/CharlotteGore/MOS6581)), and also implemented my own library to do this.
Almost all of these including mine have been created to make use of some sort of SPI IO expander, so these would need some modification to talk to a software SID. Although I imagine most of the code would be re-usable.

mogs.

bcnx
08-17-2018, 12:13 PM
Hi BC

The library is emulating a SID chip which is a synthesizer digitally controlled at a register level.
So to be able to change the pitch and waveforms etc you'd need to send sequences to modify these register values.

I've encountered several libraries which have been written to provide more friendly function calls to interface with the synthesizer. (e.g. CharlotteGore (https://github.com/CharlotteGore/MOS6581)), and also implemented my own library to do this.
Almost all of these including mine have been created to make use of some sort of SPI IO expander, so these would need some modification to talk to a software SID. Although I imagine most of the code would be re-usable.

mogs.

Hi Mogs,

all clear, basically hardware emulation.
I will do further research to see if I can develop a SID based synth,

cheers,

BC

Frank B
09-17-2018, 06:22 PM
That's easy. Just use playSID.setreg(reg, value)

Here is an sound-example: https://forum.pjrc.com/threads/32167-My-Teensy-3-1-Commodore-SID-Emulation-Player?p=91471&viewfull=1#post91471 ("Ghostbusters")
or here: https://raw.githubusercontent.com/FrankBoesing/Teensy64/master/examples/SDCARD/C64/Monty%20On%20The%20Run.mp3 (https://github.com/FrankBoesing/Teensy64/blob/master/examples/SDCARD/C64/Monty%20On%20The%20Run.mp3?raw=true) ("Monty On The Run")

Edit: Somehow the 2. link does not work with Chrome for me..don't know why. Try FireFox :)