Wow, this is amazing. Thanks for such an incredible emulator!
I FINALLY have had a chance to play with this a bit, and still have some questions. I have not finished fine tuning my hardware, so sd card is still not working. I can't wait to get that going.
But first, and most important, does anyone have experience with the Midi in object in OBEX. I opened it up, but couldn't find DOC on how the midi stream is output. I see to call event check, but not sure what to do after. It sounds like you other guys have this figured out so any help, hints?
Also something others have figured out, so I wanted to ask. Running multiple instances of sidcog should be easy. Declare multiple instances of sidcog in OBJ, then access each one just like normal. What I'm wondering is, do I need a pin for EACH INSTANCE?
Antoine has a great start on what I'd like to get running, but still trying to understand his code. I'm also trying to figure out what I need to change from "SidSynth_02_110718"
Thank you again Johannes,
*EDIT*
I figured out the midi in object... Had to read the htm. *Once again the noob in me strikes!*
So I have been trying to get midi working properly and it seems as if the OSC is not fully turning off on note off? I hacked in midi note on and off, just in attempts to get this working.
pfw.clearscreen(0)
pfw.setChar(0, 0, 0, 0, $0, $FFFF)
pfw.size(1)
pfw.str(string("Starting Sid Midi"))
Midi.Start(26,MidiInMode)
SID.start(rightPin, leftPin) 'Start the emulated SID chip in one cog
SID.resetRegisters 'Reset all SID registers
SID.setVolume(15) 'Set volume to max
wait.pause1s(1)
SID.setWaveform(0, SID#SQUARE) 'Set waveform type on channel1 to square wave
SID.setPulseWidth(0, 1928) 'Set the pulse width on channel1 to 47:53
SID.setADSR(0, 2, 5, 9, 6) 'Set Envelope on channel1
SID.setWaveform(1, SID#NOISE) 'Set waveform type on channel2 to noise (drum sound)
SID.setADSR(1, 0, 8, 4, 7) 'Set Envelope on channel2
SID.setWaveform(2, SID#SAW) 'Set waveform type on channel3 to saw wave
SID.setADSR(2, 7, 4, 8, 9) 'Set Envelope on channel3
'Lp Bp Hp
SID.setFilterType(true, false, false) 'Enable lowpass filter
'Ch1 Ch2 Ch3
SID.setFilterMask(true, false, false) 'Enable filter on the "bass channel" (channel1)
SID.setResonance(0) 'Set the resonance value to max
repeat b from 0 to 2
SID.noteOff(b)
b := cognew(SidMidi, @stack)
pfw.setChar(120, 80, 0, 0, $0, $FFFF)
pfw.str(string("Push to stop"))
tswait
cogstop(b)
Midi.Stop
Sid.Stop
*edit*
After a bit more playing around, I found disabling the filter made this go away. Now the note "glitches" on release. Not sure if this is just the patch or what. My midi interface is giving me slight clicks on notes so I'm going to revise grounding to try to fix this. Not sure if this is part of the problem but I read something about keeping audio pins low numbers? Could someone elaborate on this? I'm currently using P24 and 27 for output. Also I just realized I never set the cutoff for the filter. Could this be it? What would a LPF with a cutoff set to 0 and resonance set to 15 do? Self oscillate and give the current problem? I'll have to play with this a bit later.
I updated the midi handler a bit, still no CC implementation. I've been having a blast jamming with sidcog, I'll record a demo in a bit. I'm still having problems with the LPF. I have not tested the rest of the filers. I tried setting different cuttoffs and resonances and it still seems to be self-oscillating. Can someone tell me why? What to look for? I'm totally confused and although it's cool without the filters, I really want to get things working.
@average joe
"do I need a pin for EACH INSTANCE?" Yes, unless you mix the samples from each instance and output them using an extra cog.
After a bit more playing around, I found disabling the filter made this go away. Now the note "glitches" on release. Not sure if this is just the patch or what. My midi interface is giving me slight clicks on notes so I'm going to revise grounding to try to fix this. I'm not following you at all, what exactly are the symptoms...
Not sure if this is part of the problem but I read something about keeping audio pins low numbers? Could someone elaborate on this? I'm currently using P24 and 27 for output.
Even more important is to use a low cog number. Launching SIDcog in cog 7 while all other cores are running sounds very noisy.
Also I just realized I never set the cutoff for the filter. Could this be it? What would a LPF with a cutoff set to 0 and resonance set to 15 do? Self oscillate and give the current problem? I'll have to play with this a bit later. Just like the real SID, SIDcog can't self oscillate. Setting the cutoff freq to 0 and using a LPF will make everything routed through the filter "inaudible" *; Even if resonance is set to 15!
* Well, just like any LPF it doesn't completely damp all frequencies above the cutoff. But most frequencies components will be "inaudible" two octaves above cutoff. I've been having a blast jamming with sidcog, I'll record a demo in a bit. Pleas do that!
I'm still having problems with the LPF. I have not tested the rest of the filers. I tried setting different cuttoffs and resonances and it still seems to be self-oscillating. Are getting a pure sinus tone? At what frequency? As stated above, SIDcog can't self-oscillate so it must be something else. Can you give me a minimalistic code example where you have got this problem.
Can someone tell me why? What to look for? I'm totally confused and although it's cool without the filters, I really want to get things working. Without debugging this myself it's very hard to see the reason for your problems.
@Rayman All my PSG emulators are in the OBEX, so most retro nerds will be able to get their need for square waves satisfied.
Bute I havn't done any emulators for the Pokey or the 2A03 yet. (Nintendo and Atari nerds... please forgive me)
/Johannes
I'm recording examples now.
*edit*
The first example is with code above, then with code below.
PUB SidMidi | sco, channel, note, velocity, event, NotesPlayed[3]
Midi.Start(26,MidiInMode)
SID.start(rightPin, leftPin) 'Start the emulated SID chip in one cog
SID.resetRegisters 'Reset all SID registers
SID.setVolume(15) 'Set volume to max
'wait.pause1s(1)
SID.setWaveform(0, SID#SQUARE) 'Set waveform type on channel1 to square wave
SID.setPulseWidth(0, 1928) 'Set the pulse width on channel1 to 47:53
SID.setADSR(0, 2, 9, 5, 4) 'Set Envelope on channel1
SID.setWaveform(1, SID#NOISE) 'Set waveform type on channel2 to noise (drum sound)
SID.setADSR(1, 0, 8, 4, 7) 'Set Envelope on channel2
SID.setWaveform(2, SID#SAW) 'Set waveform type on channel3 to saw wave
SID.setADSR(2, 7, 4, 8, 9) 'Set Envelope on channel3
'Lp Bp Hp
SID.setFilterType(true, false, false) 'Enable lowpass filter
'Ch1 Ch2 Ch3
SID.setFilterMask(true, false, false) 'Enable filter on the "bass channel" (channel1)
SID.setResonance(7) 'Set the resonance value to max
SID.setCutoff(548)
'deadend
repeat sco from 0 to 2
SID.noteOff(sco)
REPEAT
event := Midi.evt
note := event
channel := note
'Velocity := note
event := (event & $FF00_0000) >> 24
channel := (channel & $00FF_0000) >> 16
note := (note & $0000_FF00) >> 8
' Velocity &= $0000_00FF
if event == 1
if notesPlayed[channel] < 2
SID.noteOff(channel)
notesPlayed[channel]--
elseif event == 0 ' Note on if note > 0
SID.noteOn(channel, note2freq(note))
notesPlayed[channel]++
The first example is followed by a pause, then the second example. Please don't mind my crappy playing. The click heard at the beginning is sidcog starting. This is present with or without filter.Not a biggie, getting the filter working is #1 priority right now!
I re-read your post again, and have a few more questions.
Re- sample mixing, I see that others have used sterio spatializer, is this the best way to mix samples, and how do I "pipe" them in? I'll dig a bit more on this myself, I was hoping for some tips from the masters though.
Re- self oscillation, I didn't think the sid was capable of this. I though I'd check though.
Thanks for your time and help. You have some very amazing releases! Keep up the good work!
SIDcog - SID/MOS8580 emulator v1.2 (C) 2011 Johannes Ahlebrand
From the header. I'm not sure if it's related to my software. I will strip everything down to bare minimum and try again. Hopefully I can figure out what's causing that ringing on note off. You did hear what I was referring to as far as filter ring. I'm also curious if you heard the glitch on NoteOff without the filter?
I really like the melody in "Scary Monsters and Nice Sprites"... a little bit of drums and some smooth pads and it will be a hit.
About the self-oscillation heard in the clip you have provided. It sounds like a square wave so it can't be from the filter itself.
But as you say it is only heard when the filter is activated... strange.
I don't have the time to investigate this right now. I'm sorry!
That is perfectly fine. I tried isolating the object from all other code, including midi and control. Played with cog#. Did not try different pins yet since my hardware is hard wired. I'll see what I can figure out later as I have a 2 - part work around for now. #`1, keep filter values below limit. #2, turn filter OFF if note off and filter > limit. No code on this yet but should keep the gremlin at bay for now.
I totally understand you're inability to work on this right now. It's not a big deal at all since I have the work around. I was just hoping I was doing something wrong, or it was a known bug or whatnot. Thanks for ALL of you're work, help, time and wonderful objects.
BTW in case you were unaware, scary monsters is a huge hit in the USA. *at least among all the Electronic Dance Music people I know* Real song here http://youtu.be/cvvboQlGqb0 I only reference this because you've got great sound emulation running, and I was wondering how you would think the best way to do the bleeps and bloops. I can describe the method elsewhere so as not to hi-jack your thread BUT. This style is VERY popular now among people I know. My favorite song is this http://youtu.be/Z3_gyFD2Ndk the video fits the song. Song starts @ 1:00... I will post tomorrow more on this.
Okey, I see.. didn't know that "scary monster" is a real song.
Here are some tunes I recorded from a QuickStart board running a "filter tweaked" SIDcog object.
The filter cutoff matches a real 8580 much better than before.(this version will be uploaded to OBEX in the near future)
"Sid register writes" are streamed from "SIDcog serial player" running on my PC to an instance of "SIDcogSlave.spin" running on the Propeller.
OOOOO I can't WAIT! It does sound WAY closer from the demos. Major development has come to a screeching halt for the next few days. How much work would it take to get access to the filter section? Sid's had the audio in but if I remember right there was just a summing in. You should update this page http://en.wikipedia.org/wiki/MOS_Technology_SID to reflect your work.
*edit*
My buddy asked JUST about Paula emulation. Not something I'm interested in, but he's a retro-gaming enthusiast. He also mentioned an arcade cab running on the prop. We have a 2 player cab with usb - keyboard mapped controls. I told him it was possible, but I don't have the time. He just laughed...
SIDcog version 1.3 is out. Download it from the OBEX!
Changes in version 1.3
- Fixed a bug when noise + any other waveform was selected at the same time
- Calibrated the cutoff frequency to better match a real 8580
- Cycle optimized code to "make room" for the point below
- Increased resonance accuracy (replaced "4 step logaritmic lookup table" with "16 step bit linear multiplication")
- Increased ADSR accuracy a little bit more (the ADSR bug is still not implemented) /Johannes
Grabbed the chunk of code as well as the "float" object which it calls on.. The code tends to lock up on that command now.
Just had a duh moment thanks to Marko. I may have forgotten that "float" requires a start call. DUH!
(I'm so used to the concept of floating point being automatic. Where's prop2?)
Is there a way to "grep" the attack, decay, sustain, filter, etc, etc. settings from a DMP file so that you could "lift" an interesting sounding instrument from an existing DMP file? This would make an interesting addition to my SIDSynth project.
That will only work for very early SID tunes. Most pre 1985 SIDs used fixed register values and only triggered note on and note off; The result was very static and didn't sound very "natural" or "lively".
Here's an example from 1984
Then in 1985 the man the myth the legend, Rob Hubbard, began updating register values 50 times per second (between note on and note offs) and effects such as pulse width modulation and vibrato could be achieved.
Listen to the fat bass in the beginning of the tune. The pulse width is updated 50 times per second and is "animated" from 0% to 100% and then from 100% back to 0%. (WOW what a difference in livelyness)
Then listen to the triangle lead; The frequency is also updated 50 times a second, it sweeps up and down many times per second to achieve vibrato.
Later SID tunes uses even more "tricks", such as changing between different waveforms on the fly, like.. triangle... wait some ms...then square... wait some more ms... then noise... etc.
Here's an example of drums sounds using that technique.
(Btw, another technique is heard in this tunes, called arpeggio. By changing between three notes many times per second, a choord could be played with a single channel)
Then SID musicians began sweeping the filter cutoff like "real" synthesizers and the result was even more interesting.
Have a listen to the bass, the filter is set to max resonance and the cutoff sweeps up and down. Just WOW, the SID was so far ahead of anything found in a computer back then.
It took almost a decade before musicians began using the SID chip as Bob Yannes intended. That's the reason why old SID tunes almost sounds as "bad" as they would on an Atari 800 or Amstrad CPC.
So to take a snapshot of the register settings from a single "frame" will not yield a correct result... SID music is ALL about updating register values many times per second.
New SID tunes uses "all the tricks in the book" and the results is soooo insanely amazing that even Bob Yannes would be surprised that it comes out of his chip from 1981.
Comments
hi megaionstorm
try the link to the "SID dumper" app linkws in the very first post of this thread:
http://forums.parallax.com/showthread.php?118285-SIDcog-The-sound-of-the-Commodore-64-!-(Now-in-the-OBEX)&p=863861&viewfull=1#post863861
I FINALLY have had a chance to play with this a bit, and still have some questions. I have not finished fine tuning my hardware, so sd card is still not working. I can't wait to get that going.
But first, and most important, does anyone have experience with the Midi in object in OBEX. I opened it up, but couldn't find DOC on how the midi stream is output. I see to call event check, but not sure what to do after. It sounds like you other guys have this figured out so any help, hints?
Also something others have figured out, so I wanted to ask. Running multiple instances of sidcog should be easy. Declare multiple instances of sidcog in OBJ, then access each one just like normal. What I'm wondering is, do I need a pin for EACH INSTANCE?
Antoine has a great start on what I'd like to get running, but still trying to understand his code. I'm also trying to figure out what I need to change from "SidSynth_02_110718"
Thank you again Johannes,
*EDIT*
I figured out the midi in object... Had to read the htm. *Once again the noob in me strikes!*
*edit*
After a bit more playing around, I found disabling the filter made this go away. Now the note "glitches" on release. Not sure if this is just the patch or what. My midi interface is giving me slight clicks on notes so I'm going to revise grounding to try to fix this. Not sure if this is part of the problem but I read something about keeping audio pins low numbers? Could someone elaborate on this? I'm currently using P24 and 27 for output. Also I just realized I never set the cutoff for the filter. Could this be it? What would a LPF with a cutoff set to 0 and resonance set to 15 do? Self oscillate and give the current problem? I'll have to play with this a bit later.
"do I need a pin for EACH INSTANCE?"
Yes, unless you mix the samples from each instance and output them using an extra cog.
After a bit more playing around, I found disabling the filter made this go away. Now the note "glitches" on release. Not sure if this is just the patch or what. My midi interface is giving me slight clicks on notes so I'm going to revise grounding to try to fix this.
I'm not following you at all, what exactly are the symptoms...
Not sure if this is part of the problem but I read something about keeping audio pins low numbers?
Could someone elaborate on this? I'm currently using P24 and 27 for output.
Even more important is to use a low cog number. Launching SIDcog in cog 7 while all other cores are running sounds very noisy.
Also I just realized I never set the cutoff for the filter. Could this be it? What would a LPF with a cutoff set to 0 and resonance set to 15 do? Self oscillate and give the current problem? I'll have to play with this a bit later.
Just like the real SID, SIDcog can't self oscillate. Setting the cutoff freq to 0 and using a LPF will make everything routed through the filter "inaudible" *; Even if resonance is set to 15!
* Well, just like any LPF it doesn't completely damp all frequencies above the cutoff. But most frequencies components will be "inaudible" two octaves above cutoff.
I've been having a blast jamming with sidcog, I'll record a demo in a bit.
Pleas do that!
I'm still having problems with the LPF. I have not tested the rest of the filers. I tried setting different cuttoffs and resonances and it still seems to be self-oscillating.
Are getting a pure sinus tone? At what frequency?
As stated above, SIDcog can't self-oscillate so it must be something else. Can you give me a minimalistic code example where you have got this problem.
Can someone tell me why? What to look for? I'm totally confused and although it's cool without the filters, I really want to get things working.
Without debugging this myself it's very hard to see the reason for your problems.
@Rayman
All my PSG emulators are in the OBEX, so most retro nerds will be able to get their need for square waves satisfied.
Bute I havn't done any emulators for the Pokey or the 2A03 yet. (Nintendo and Atari nerds... please forgive me)
/Johannes
*edit*
The first example is with code above, then with code below. The first example is followed by a pause, then the second example. Please don't mind my crappy playing. The click heard at the beginning is sidcog starting. This is present with or without filter.Not a biggie, getting the filter working is #1 priority right now!
I re-read your post again, and have a few more questions.
Re- sample mixing, I see that others have used sterio spatializer, is this the best way to mix samples, and how do I "pipe" them in? I'll dig a bit more on this myself, I was hoping for some tips from the masters though.
Re- self oscillation, I didn't think the sid was capable of this. I though I'd check though.
Thanks for your time and help. You have some very amazing releases! Keep up the good work!
From the header. I'm not sure if it's related to my software. I will strip everything down to bare minimum and try again. Hopefully I can figure out what's causing that ringing on note off. You did hear what I was referring to as far as filter ring. I'm also curious if you heard the glitch on NoteOff without the filter?
http://soundcloud.com/joe-heinz/skrillex-scary-monsters-and-1
About the self-oscillation heard in the clip you have provided. It sounds like a square wave so it can't be from the filter itself.
But as you say it is only heard when the filter is activated... strange.
I don't have the time to investigate this right now. I'm sorry!
/Johannes
I totally understand you're inability to work on this right now. It's not a big deal at all since I have the work around. I was just hoping I was doing something wrong, or it was a known bug or whatnot. Thanks for ALL of you're work, help, time and wonderful objects.
BTW in case you were unaware, scary monsters is a huge hit in the USA. *at least among all the Electronic Dance Music people I know* Real song here http://youtu.be/cvvboQlGqb0 I only reference this because you've got great sound emulation running, and I was wondering how you would think the best way to do the bleeps and bloops. I can describe the method elsewhere so as not to hi-jack your thread BUT. This style is VERY popular now among people I know. My favorite song is this http://youtu.be/Z3_gyFD2Ndk the video fits the song. Song starts @ 1:00... I will post tomorrow more on this.
Here are some tunes I recorded from a QuickStart board running a "filter tweaked" SIDcog object.
The filter cutoff matches a real 8580 much better than before.(this version will be uploaded to OBEX in the near future)
"Sid register writes" are streamed from "SIDcog serial player" running on my PC to an instance of "SIDcogSlave.spin" running on the Propeller.
http://soundcloud.com/ahle2/sets/sid-emulation-running-on-a
/Johannes
*edit*
My buddy asked JUST about Paula emulation. Not something I'm interested in, but he's a retro-gaming enthusiast. He also mentioned an arcade cab running on the prop. We have a 2 player cab with usb - keyboard mapped controls. I told him it was possible, but I don't have the time. He just laughed...
Download it from the OBEX!
Changes in version 1.3
- Fixed a bug when noise + any other waveform was selected at the same time
- Calibrated the cutoff frequency to better match a real 8580
- Cycle optimized code to "make room" for the point below
- Increased resonance accuracy (replaced "4 step logaritmic lookup table" with "16 step bit linear multiplication")
- Increased ADSR accuracy a little bit more (the ADSR bug is still not implemented)
/Johannes
Is there any chance you can help me some with some code like this that works with the new version of SIDcog?
Thanks!
OBC
Just had a duh moment thanks to Marko. I may have forgotten that "float" requires a start call. DUH!
(I'm so used to the concept of floating point being automatic. Where's prop2?)
OBC
SidCog playing 'Enola gay' at youtube :http://www.youtube.com/watch?v=O5Szv-8oej8&list=UUWYbKz2Sm27cdXqD5b6HEUA&feature=plcp
OBC
It's a nice one
Is there a way to "grep" the attack, decay, sustain, filter, etc, etc. settings from a DMP file so that you could "lift" an interesting sounding instrument from an existing DMP file? This would make an interesting addition to my SIDSynth project.
OBC
Here's an example from 1984
Then in 1985 the man the myth the legend, Rob Hubbard, began updating register values 50 times per second (between note on and note offs) and effects such as pulse width modulation and vibrato could be achieved.
Listen to the fat bass in the beginning of the tune. The pulse width is updated 50 times per second and is "animated" from 0% to 100% and then from 100% back to 0%. (WOW what a difference in livelyness)
Then listen to the triangle lead; The frequency is also updated 50 times a second, it sweeps up and down many times per second to achieve vibrato.
Later SID tunes uses even more "tricks", such as changing between different waveforms on the fly, like.. triangle... wait some ms...then square... wait some more ms... then noise... etc.
Here's an example of drums sounds using that technique.
(Btw, another technique is heard in this tunes, called arpeggio. By changing between three notes many times per second, a choord could be played with a single channel)
Then SID musicians began sweeping the filter cutoff like "real" synthesizers and the result was even more interesting.
Have a listen to the bass, the filter is set to max resonance and the cutoff sweeps up and down. Just WOW, the SID was so far ahead of anything found in a computer back then.
It took almost a decade before musicians began using the SID chip as Bob Yannes intended. That's the reason why old SID tunes almost sounds as "bad" as they would on an Atari 800 or Amstrad CPC.
So to take a snapshot of the register settings from a single "frame" will not yield a correct result... SID music is ALL about updating register values many times per second.
OriginalSIDcogDemoTunes_zip