It is currently Fri Oct 20, 2017 4:33 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 38 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Fri Mar 02, 2012 7:32 pm 
Offline

Joined: Sun Sep 30, 2007 9:54 pm
Posts: 76
Location: Corneria
rainwarrior wrote:
compliant NSFs need to return from the play routine before the next update, and in a game implementation you would never write your PCM routine around this limitation.
And that's one reason NSF2 was proposed.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 04, 2012 3:52 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
Regarding Sunsoft 5B, its audio expansion the same as the AY.

http://www.speccy.org/hardware/datasheet/ay38910.pdf

Two things that current players do not support is the Noise Generator and Envelope Generator support of the channels. Each channel can change from pulse to noise and back. The Envelope Generator was commonly used to create basic waveforms and was used as an additional channel called the "buzzer".

Here's an example: http://www.youtube.com/watch?v=38d4rjORKgc The bassline is the "buzzer" or Envelope Generator.

Generally the Noise and Envelope were not emulated because no commercial games used the functions. With FamiTracker's active development and many musicians using it, it would be necessary to have a player. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 04, 2012 4:03 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
B00daW have you tested these things with NSFPlay? So far as I have seen it supports both envelopes and the noise channel. If you have an example NSF that doesn't work send it to me.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 04, 2012 10:32 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
Regarding this post ( http://nesdev.com/bbs/viewtopic.php?t=8483 ) it seems like there is some debate to how the envelope register should be emulated. Someone needs to actually record from a Sunsoft 5B devcart. According to BootGod's site, it seems that Gimmick! and Gremlins 2 Famicom carts are the only ones with actual Sunsoft 5B's. Strangely, enough it doesn't seem like Gremlins 2 actually used the expansion audio...

Tonight I decided I was bored and would hack up a MMC5 PCM PoC from currently available SuperNSF NSFs.

http://average.truechiptilldeath.com/nesdev/mmc5hax.zip

I have no idea how this is going to sound. It uses saturation tables for 4 channels using 7-bit samples instead of 8-bit samples. It should at least play audio out of the $5011 register though...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 04, 2012 11:39 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
I've got an MMC5 PCM test of my own, but I will test this. VirtuaNSF and some emulators play $5011 writes. But I have yet to find any that will play $8000-BFFF reads in read mode. NSFPlug will do this when I get around to it.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2012 5:11 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
After doing some investigating on the 5B it looks like VirtuaNSF's envelope speed is wrong. The envelope frequency should be exactly 1/16 of the equivalent tone frequency. NSFPlug seems to be correct. VirtuaNES looks mostly correct, except it masks out the high 4 bits of the envelope pitch, so it probably doesn't support very low envelope frequencies. A lot of other emulators don't even bother with noise or envelopes.

There was a lot of confusion when looking this up, I think primarily because the 5B appears to be a YM2149F running with the clock divider on, cutting the clock rate in half. So, the 5B's frequencies are unfortunately about 1/2 of what you'd get from a ZX (1/3 vs an ST)-- big loss in pitch accuracy! There may also be some confusion whether the "frequency" mentioned in the datasheets means how often the square value flips (I doubt this), or how often it completes the cycle.

I wrote a wiki page for the 5B, since we didn't have one:
http://wiki.nesdev.com/w/index.php/Sunsoft_5B_audio

Edit: also just discovered that NSFPlug's FDS modulation is half strength for some reason. Another thing to fix for the next version...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2012 5:05 pm 
Offline
User avatar

Joined: Thu Jan 03, 2008 1:48 pm
Posts: 540
rainwarrior wrote:
2. Can you possibly get me Strobe's source code and FTMs for those NSFs you think should work but don't? It's will take a lot more time to try to debug it if I have to do it by reverse engineering.


Strobe was gracious enough to share his source for educational and development purposes.

I will message you the link on IRC. This source was also used for Ziberia.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 16, 2012 10:42 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
Thanks! That will be helpful.

I've gotten NSFPlug down to a small number of known issues; this was one of them. I expect I'll be releasing version 2.1 by the end of March.

BTW in that xiamus haxus MMC5 NSF you (or whomever hacked it) forgot to set the MMC5 bit in the NSF header. Easy to fix though, and it plays just fine in my WIP version of NSFPlug now.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 17, 2012 12:05 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
Ah, I've discovered the problem. The NSFs are not compliant with the spec.

The bankswitching bytes in the NSF header (70-77) are all 0. This means (according to the spec) that bankswitching is disabled.

Just put 00 01 02 03 04 05 06 07 in there and it will work as intended.

http://kevtris.org/nes/nsfspec.txt


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 01, 2012 3:41 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
As I create test NSFs I will archive them at: http://rainwarrior.ca/projects/nsfplay/

The current version contains a test for 5B and MMC5 PCM:
http://rainwarrior.ca/projects/nsfplay/bs_nsf_tests_10.zip


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 06, 2012 11:02 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
Beginning to fill my own requests, I acquired a Lagrange Point cart and recorded its entire sound test on my audio-modded NES:

http://rainwarrior.thenoos.net/projects/nes/lp_ref.zip


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 01, 2012 1:55 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5726
Location: Canada
I've now got a Famicom running, and I have carts of all the expansions available to me now (no FDS at the moment, but that will change).

I'll be posting reference recordings, and more information later, but for now I have some info on the 5B to share:

Gimmick's 5B chip does indeed support the noise and envelope features of the YM2149F, and the envelope speed is as I expected. The envelope runs at exactly 1/16 the speed of the equivalent tone frequency (or an octave down in triangle mode). I'll share some code/ROMs/recordings later.

So, this means: Nestopia is a pretty accurate reference for the 5B sound. NSFPlay/NSFPlug is also pretty good. Most other emulators don't implement the noise/envelope features, and a few (e.g. VirtuaNSF) play envelopes incorrectly at double speed.


Edit: I've posted a soundtrack recording and the test code to my OP.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 13, 2012 11:33 pm 
Offline

Joined: Wed Apr 04, 2012 2:15 am
Posts: 24
Here's some more recordings:

Namco 163:
-King of Kings (8 channels)
-Final Lap (4 channels)
-Megami Tensei II (4 channels)

VRC6:
-Akumajou Densetsu

All of these were recorded from an AV-modded Famicom (recorded from pin 46).

I hope these will be useful to someone. I realise there isn't much need for a full recording of Akumajou Densetsu, but I was bored. :) Also, the first two tracks were recorded from a different cart; I switched after those because the first one was giving me trouble. I didn't bother rerecording the first two, but found out after the fact that my two carts have different volume balance between VRC6 and 2A03... It's not very noticeable anyway.

It's worth noting that the only NSF rip of King of Kings is missing the melody in the in-game track (the frequencies are updated but the volume stays at 0 throughout the entire track).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2012 8:35 pm 
Offline

Joined: Wed Apr 14, 2010 12:25 pm
Posts: 34
Yep, that high pitch in King of Kings is definitely there. Bleh.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2012 11:53 pm 
Offline

Joined: Wed Apr 04, 2012 2:15 am
Posts: 24
Yeah.. But it's not as bad as NEZPlug++ or FamiTracker make it sound. At least, I didn't want to murder anything after a minute of listening to King of Kings on the real Famicom, unlike those two emulators...


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

All times are UTC - 7 hours


Who is online

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