Jump to content


Photo

Creating a C64 emulator in GameMaker - Part 7


  • Please log in to reply
9 replies to this topic

#1 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 5277 posts
  • Version:GM:Studio

Posted 13 February 2015 - 08:14 PM

https://www.yoyogame...m/tech_blog/101

 

 

 


So in this chapter, I thought I'd tackle the tricky subject of SID chip emulation, both how I generate the sounds, and how I get them to play back in GameMaker.  Before getting into any of the nitty gritty, let's have a quick look at the SID chip itself. Back in the day, it was the sound chip, the sound it generated was unparalleled in computers, and the musicians  that created music on them - Gods among developers, superstars in their day.  So what can this masterpiece of engineering do?

 

It's a 3 channel engine chip of playing Sawtooth, Triangle and Pulse waveforms along with a white noise effect, all controlled through hardware based ADSR (Attack, Decay, Sustain and Release) volume...........

 


  • 3

#2 Han

Han

    Enemy of the State

  • Banned Users
  • 341 posts
  • Version:Unknown

Posted 14 February 2015 - 11:13 AM

Glad to see other old men here.  :lol:

Please release a full video tutorial sir.

 

Edit: And be so generous to make youtube explanation on  how I connect my C64 cassette player and Floppy drive to PC.  I have to go to my parents house and hopefully the cartons of my c64 stuff are still there.



#3 Smarty

Smarty

    GMC Member

  • GMC Elder
  • 7522 posts
  • Version:GM:Studio

Posted 15 February 2015 - 12:28 AM

Hmmm... I was hoping a little bit that you'd actually go into the nitty-gritty of synthesizing the sound yourself, in GameMaker, rather than queueing samples. It would have been really cool to see how on the fly synthesizing, ring modulation, band filters etc would have worked out in GML, as well as hear them - they made the SID stand out among its peers.

 

Many years ago I pulled in an external library to process the sound of the Pokey chip (Atari home computers and some arcade cabinets fame) in Game Maker and I had the exact same problem of finding the careful balance between the number of buffers and avoiding lag or stutter when buffering the audio in my library. I eventually made a demo and an extension out of it, none of it using pre-generated samples:

 

http://sandbox.yoyog...46-gmpokey-demo


  • 0

#4 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 5277 posts
  • Version:GM:Studio

Posted 15 February 2015 - 11:02 AM

I do generate the pulse wave, and the others are exactly the same - I just don't. If you look at the section on pulse wavs, you can see I generate a wave based on register usage, setting 0 or 255 into the dynamic sample.

 

I found using a sample I recorded of the SID gave a better sound.

 

I also don't have RING and high/low/band modulation/filters yet.  You'd be surprised how good it is even without them. You do notice on some tunes, but certainly not all them. 


  • 0

#5 Smarty

Smarty

    GMC Member

  • GMC Elder
  • 7522 posts
  • Version:GM:Studio

Posted 15 February 2015 - 10:42 PM

I do generate the pulse wave, and the others are exactly the same - I just don't. If you look at the section on pulse wavs, you can see I generate a wave based on register usage, setting 0 or 255 into the dynamic sample.
 
I found using a sample I recorded of the SID gave a better sound.

I am unsure how you recorded your samples off the SID, but I think part of the reason that it may sound nicer is that SID sound used to be played back using TV speakers using only 4 bits, while playback these days goes straight into quality speakers at 16 bits - which is very shrill for a square/sine/sawtooth wave based chip.

Either way, I was interested because procedural generation of sound is still the real meat of emulation, so this was the part I was hoping you'd cover.

I also don't have RING and high/low/band modulation/filters yet.  You'd be surprised how good it is even without them. You do notice on some tunes, but certainly not all them.

Well, you know that those of us who grew up with the real deal will be very anal about getting it just right. :) Also, a number of games used some digitized speech or sound playback to mix in with the music, I don't expect the current approach can handle that - and I wonder if GameMaker Studio can handle the timing involved with that, at all.

Would you be able to post a demo (even if only video) of the emulator playing a number of songs, or parts of them? Anything by Rob Hubbard would do as a nice benchmark. :)
  • 0

#6 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 5277 posts
  • Version:GM:Studio

Posted 15 February 2015 - 11:33 PM

Actually... the emulator could handle samples, as the sample is built up over an emulation frame - it would work fine.

 

I recorded it from a Plus/4 Sid card - which had a headphone out - years ago. However, like I said, I do dynamically generate the pulse wave. Triangle and SawTooth wave could be generated easily enough if thats what you wanted - just like I do with the pulse wave. However unlike the pulse wave, triangle/sawtooth waves don't change, its the same wave,so it seemed pointless to generate them rather than resample.

 

The ZX Spectrum sound emulation is the same, it sets values of 255/0 as emulation over the frame progresses.


  • 0

#7 Smarty

Smarty

    GMC Member

  • GMC Elder
  • 7522 posts
  • Version:GM:Studio

Posted 16 February 2015 - 10:32 PM

Actually... the emulator could handle samples, as the sample is built up over an emulation frame - it would work fine.
 
I recorded it from a Plus/4 Sid card - which had a headphone out - years ago. However, like I said, I do dynamically generate the pulse wave. Triangle and SawTooth wave could be generated easily enough if thats what you wanted - just like I do with the pulse wave. However unlike the pulse wave, triangle/sawtooth waves don't change, its the same wave,so it seemed pointless to generate them rather than resample.

Fair enough. So, any chance you could demo a few songs on video? International Karate, Thing on a Spring, Skate or Die, Monty on the Run, Sanxion, Zoids, Krakout, Ghostbusters, or anything else considered canonical?
  • 0

#8 Han

Han

    Enemy of the State

  • Banned Users
  • 341 posts
  • Version:Unknown

Posted 17 February 2015 - 12:06 AM

The Last Ninja.



#9 csanyk

csanyk

    GMC Member

  • GMC Member
  • 624 posts
  • Version:GM:Studio

Posted 18 February 2015 - 10:00 PM

Part 7?  How did I miss parts 1-6?  This is a pretty cool project, and an amazing demo for what GM:S can do. Is the C64 emulator on the GM Marketplace yours, too?


  • 0

#10 Mike.Dailly

Mike.Dailly

    Evil YoYo Games Employee

  • Administrators
  • 5277 posts
  • Version:GM:Studio

Posted 18 February 2015 - 10:13 PM

Yes.... its what the tech blogs have been describing.


  • 0