It is currently Sun Oct 22, 2017 9:22 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NES APU in Matlab
PostPosted: Mon Nov 07, 2016 10:13 am 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
Hi I'm fairly new to this forum and NES emulation but I'm looking to make a project for a DSP class I'm taking and thought this would be a good community to look for help. I've spent a couple days reading over different threads involving the DSP involved with the emulation and am looking to implement a fairly basic NES APU entirely in matlab demonstrating topics I've learned in class. I'm well versed in FIR/IIR filters, sampling, nyquist rates and aliasing from a conceptual standpoint but not as much a practical one. Are there any general resources I should take a look at before starting up this project? (Specifically related to implementing this in matlab). Has anyone done this in matlab that can offer some advice on what problems to tackle first? Thanks


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Mon Nov 07, 2016 10:41 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 710
Location: New York, NY
If you are primarily interested in just exercising your DSP knowledge, we could just provide a recording of raw APU output and you could filter, down-sample, decimate, etc. that data set.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Mon Nov 07, 2016 1:45 pm 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
That would be great. Sorry if this was a relatively simple thing I could have searched for.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Mon Nov 07, 2016 2:13 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 710
Location: New York, NY
What are your requirements?


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Tue Nov 08, 2016 7:36 am 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
The project requires the manipulation of any 1D signal. So raw APU output like song files for each channel would work or anything similar that I can mess around with.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Thu Nov 10, 2016 12:25 pm 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
Anything from 3-5 .wav or .mp3 files of Super Mario Bros. or similarly recognizable songs from an NES game. Raw output that I can manipulate (pre-filtered, unsampled, possibly seperate channels) would be great


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Thu Nov 10, 2016 4:23 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3944
Depending on who you ask, "Raw" might mean a sampling rate of 1,789,773Hz, rather than something sane that you would normally think of for audio.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Thu Nov 10, 2016 5:19 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19116
Location: NE Indiana, USA (NTSC)
Correct. On the NES, "raw" means either 315/176 = 1.790 MHz, the fastest rate in the APU, or 315/352 = 0.895 MHz, the "sufficient" rate that is perfect for everything but the triangle channel and $4011 writes and near perfect even for those.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Thu Nov 10, 2016 7:53 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
...huh. Just tried telling my NSF player to generate a WAV file at the NES CPU rate, and that is apparently a thing it will do out of the box. Sent Audacious into cardiac arrest when I tried to play it, but the data's there.

Still has all the high-/low-pass filtering on it, but I can hack that out easily enough, if you really want it...?


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Thu Nov 10, 2016 8:46 pm 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
Rahsennor wrote:

Still has all the high-/low-pass filtering on it, but I can hack that out easily enough, if you really want it...?


If it's not too much that'd work great. Even both so I can mess around with each. I'm just looking to exercise some knowledge to crudely show what the NES would do.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Fri Nov 11, 2016 3:05 am 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
Here's the first 30 seconds of the SMB1 main theme at 1789773 Hz, unfiltered. It's quiet and has a large DC offset because that's what I do to avoid clipping.

I can do more if you want, just let me know what to render.


Attachments:
File comment: WARNING: 107 MB uncompressed
smb-raw.zip [524.61 KiB]
Downloaded 73 times
Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Fri Nov 11, 2016 1:43 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
I though the APU would generate samples at odd CPU clocks only.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Fri Nov 11, 2016 2:03 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19116
Location: NE Indiana, USA (NTSC)
Pulse, noise, and DMC autoplayback do operate only every other CPU cycle. Triangle and sta $4011 can change on any cycle, but every other cycle should be enough for those in practice.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Mon Nov 14, 2016 5:53 pm 
Offline

Joined: Thu Nov 03, 2016 10:01 am
Posts: 11
So I've started working on systems to filter/downsample all of this data which is giving me a good amount of flexing my knowledge but is there anything the NES does internally before outputting the audio? Also any more data sets/raw song snippets would be great for testing what I already have. Thanks is advance.


Top
 Profile  
 
 Post subject: Re: NES APU in Matlab
PostPosted: Mon Nov 14, 2016 7:35 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 284
kyguy37536 wrote:
So I've started working on systems to filter/downsample all of this data which is giving me a good amount of flexing my knowledge but is there anything the NES does internally before outputting the audio?

There is some nonlinearity in the mixing. The two pulse channels interfere with each other, and the triangle, noise and DMC channels interefere with each other. These two sets are then mixed normally - this is where my emulator output is sampled in the file above.

It then applies a series of high-pass and low-pass filters. You can find all the details on the wiki.

kyguy37536 wrote:
Also any more data sets/raw song snippets would be great for testing what I already have. Thanks is advance.

Anything in particular you're looking for, or should I just grab tracks at random?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group