It is currently Mon Sep 01, 2014 6:48 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NES VGM player
PostPosted: Thu May 26, 2011 12:29 pm 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
This is my latest little project after doing the Gameboy VGM player.. an NES version: http://www.youtube.com/watch?v=Tcqk3zLj_qU

As mentioned in the video description I'm using VRC6, so this requires a PowerPak and a modded NES or a Famicom to work. Which is why channel 3 is missing in the video, because my NES isn't modded (yet). All 4 channels work fine in nintendulator and mednafen though.

I still need to work a bit on the timing, and make the screen look less dull, etc.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2011 1:18 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 12327
Location: NE Indiana, USA (NTSC)
And perhaps you could add a compatibility mode for unmodded NES consoles that runs channel 3 over triangle.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 12:15 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
With no volume control? That would most likely sound like ****.
And before you start saying that I could do some tricks to alter the volume of the triangle wave; keep in mind that I have to keep an average processing rate of 38 cycles/sample (or 41 for NTSC). :P

One option I considered was to use the DMC channel to simulate a 3rd square wave channel. But to get all the frequency/volume combinations I would need thousands of samples, and I'm not sure if I could switch samples during playback without any noticeable distortion(?).

VRC6 was just the most elegant solution IMO. Most people who develop for or make music for the NES probably has a PowerPak, meaning that they can run ROMs using VRC6. And the modification needed to get expansion audio on an NES is simple enough that I expect that even I can do it despite my crappy soldering skills.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 4:57 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 1840
Location: Tampere, Finland
Very cool.

_________________
Download STREEMERZ for NES from www.fauxgame.com!


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 8:01 am 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 330
Are you going to use the VRC6 saw channel for the SN76489 Noise+3rd Pulse waveform?

Btw, If you're going to do the modification of your NES, do not use a 47K resistor. Try to use a 100K potentiometer instead. I made the mistake of using a 47K resistor and it's not enough; so the expansion audio is too loud.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 9:00 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
Quote:
Are you going to use the VRC6 saw channel for the SN76489 Noise+3rd Pulse waveform?

No, I'm using the first square wave channel of the VRC6. That's already supported by my player - you just can't hear it on my NES since I don't get expansion audio on it.
I guess I could use the other square wave channel for the SN76489 "periodic noise" since the VRC6 supports a 1/16 duty cycle.

Quote:
Btw, If you're going to do the modification of your NES, do not use a 47K resistor. Try to use a 100K potentiometer instead. I made the mistake of using a 47K resistor and it's not enough; so the expansion audio is too loud.

I was thinking of using a 56k resistor. Or is that not enough?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 9:03 am 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 330
I can see how volume manipulation would be easier on the VRC6 pulse, but not sure if it would sound simliar.

Regarding the modification, using a potentiometer would allow you to adjust your values better instead of soldering something in there that isn't perfect. You can also keep the potentiometer underneath your NES in the expansion bay hole so it's flush.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 9:20 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
Quote:
I can see how volume manipulation would be easier on the VRC6 pulse, but not sure if it would sound simliar.


It should sound the same. The periodic "noise" on the SN76489 is just a square wave with a 1/16 duty cycle (or 1/15 on the colecovision).


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 2:19 pm 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
Here are two demo ROMs, one for PAL and one for NTSC, containing different songs.

nesvgm_pal.nes
nesvgm_ntsc.nes


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 6:27 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 330
Here are two basic hacks I've done:

PAL
NTSC

The PAL ROM has a song by GreaseMonkey done with his IT2VGM driver.
The NTSC ROM has a song by kulor using the MOD2PSG2 engine.

I've included their unaltered VGMs as well.

It appears that they cut out early. GreaseMonkey's noise pulses are also not in tune. There appears to be noise issues for both of the songs as well. Among other issues.

Hope this helps with the bug testing.

I would include a version of my songs, but some of my VGMs are over 200K.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2011 9:52 pm 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
Quote:
It appears that they cut out early.

That's because my player doesn't look at any addresses to determine when to switch to the next bank. I relies on my ROM builder tool to insert VGM command $4B (no parameters) at the end of each 16kB. Command $4B doesn't mean anything in the VGM 1.50 spec, but to my player it means "switch in the next 16kB bank".

Thanks for the songs. They might be of some help.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 28, 2011 1:32 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
I managed to fix most of the noise problems: kulor_ntsc.nes
It's not possible to get it to sound 100% right, since the 2A03 only has 16 different frequency settings for white noise, while on the SN76489 you can get 1024 by sacrificing the 3rd tone channel.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 28, 2011 6:48 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 12327
Location: NE Indiana, USA (NTSC)
mic_ wrote:
It's not possible to get it to sound 100% right, since the 2A03 only has 16 different frequency settings for white noise, while on the SN76489 you can get 1024 by sacrificing the 3rd tone channel.

Can you alternate between adjacent frequency settings if the period is close to halfway between two existing settings?


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 28, 2011 7:59 am 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 330
mic_ wrote:
I managed to fix most of the noise problems: kulor_ntsc.nes
It's not possible to get it to sound 100% right, since the 2A03 only has 16 different frequency settings for white noise, while on the SN76489 you can get 1024 by sacrificing the 3rd tone channel.


Sounding a lot better, except that it seems your non-pitch-referenced periodic noises come out as 2A03 periodic noise instead of octaves of A or 440Hz. A lot of musicians use it as a cheap A too.

As for pitch-driven white noise, I think the only effective option for that is changing the chip to Sunsoft 5B's AY. Too bad it's not properly emulated anywhere yet; especially noise.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 29, 2011 8:14 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 837
I got some help with installing a 100kohm potentiometer, so now I've been able to do proper testing on HW.

It's getting closer to being ready for a proper release. The timing is pretty decent now, and I've added NTSC/PAL detection and automatic adjustment of playback speed (though since I only have PAL HW all my NTSC testing has been with Nintendulator).

There's one weird issue left that only happens on HW. Some songs "lock up" at certain positions in the song, and then recover after a short time. My first theory was that it was related to the bank switching, but I can't see why that would be the case, or why only the switch between two specific banks would be a problem. This doesn't happen in Nintendulator or FCEUX, so it's kinda hard to debug.

Youtube video for the current version.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 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