Go Down

Topic: Emulation on arduino? (Read 940 times) previous topic - next topic

xolroc

Is it feasible to use an Arduino Uno to emulate a Ricoh 2A03?  I'm wanting to make something that can play NSFs, so all I really need is the sound capabilities...

The Clever Monkey


Is it feasible to use an Arduino Uno to emulate a Ricoh 2A03?  I'm wanting to make something that can play NSFs, so all I really need is the sound capabilities...


Well, any general purpose computing device can emulate another, given sweat equity, but you probably want to look at the MAME/MESS project if you are interesting in emulation at any serious level.
I yield() for co-routines.

xolroc

The problem is the sound; I've been having difficulty finding a way to do more than one note at a time...  Perhaps I could use multiple pins, with a DAC, rather than just a sound library?  But the problem comes when I need a triangle wave, noise waveforms and DPCM.

cr0sh


The problem is the sound; I've been having difficulty finding a way to do more than one note at a time...  Perhaps I could use multiple pins, with a DAC, rather than just a sound library?  But the problem comes when I need a triangle wave, noise waveforms and DPCM.


http://www.instructables.com/id/Arduino-Chiptunes/
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

xolroc

Alright, that ought to work.  Still unsure how I'd make it work with an NSF though, especially if it uses something like the N163 chip... but I suppose I should keep to one project at a time.

cr0sh


Alright, that ought to work.  Still unsure how I'd make it work with an NSF though, especially if it uses something like the N163 chip... but I suppose I should keep to one project at a time.


Likely, that Arduino chiptunes project is well beyond your current level of understanding (heck, I only marginally understand it myself); I was more posting it to show that it -is- possible to get an Arduino to play polyphonic sound ala "chiptune" style (which is real similar to what the Nintendo does).

Unfortunately, as you can tell by the code (note - this is completely being done in code!) - it isn't easy. It takes the use of interrupt routines and timers to allow you to pull data from PROGMEM (which is a *packed* representation of a tracker chiptune) quickly, build up a buffer, then push all of that out thru a convolution routine that basically uses the values to pull data from various other waveform representation tables (or from a noise generator), accumulates all of that as a "sample" which is then pushed out a PCM channel (I think). This happens really quickly and is obviously really complex.

You -aren't- going to be able to emulate the CPU (ie - the Ricoh 2A03) that is in the Nintendo - that is way more than you can do with an Arduino; but playing chiptune music is in the realm of possibility (now, squeezing an extra channel in might take some work - but is probably possible). Then, all you have to do is figure out how to convert an NSF to the chiptune format (that, or replace the chiptune format in that code above with the NSF format, and all the decoding it needs).

Your only other option would be to try to find some kind of sound chip or something to interface with (do some googling on "Arduino Chiptune" and similar; people have interfaced to the audio chip used in the Sega Master system, for instance); at one time, there was quite a few audio chips out there - nowadays, there are a few companies that make "audio chips" (which are basically a microcontroller - usually a PIC - programmed to act like a sound chip); for instance, for voice synthesis, there's the "SpeakJet" chip; I think there was one out there also called the "SoundGin".

In the end, though, you'll likely end up with a multi-chip solution no matter what; due to the processing needs of something like that chiptune project, you can't really put a bunch of other code in place and have the sound portion be a "function call"; you need something that is fairly dedicated (of course, you would still need to hack in some kind of serial interface - for this kind of thing, SPI would be my first choice).

I guess what I am saying it - this is anything -but- a trivial project.
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

xolroc

Yeah, I figured it'd be beyond my capabilities.  I'll stick to beeps for now!

Go Up