• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by gama - 2011-03-08
Last edited by Buschel - 2011-07-04

FS#11999 - New NSF (Nintendo Sound Format) codec based on Game_Music_Emu ;)

Hi, this is a new nsf codec based on blargg’s great
Game_Music_Emu library (

I decidec to write it because the old one didn’t have vrc7 support and i think
the emulation and sound quality is better in Game_Music_Emu.

Created from revision: 29484
Tested on: Sansa Fuze V2


  1. Support for all nes extra sound chips (mmc5, fme7, fds, vrc6, vrc7, n106)
  2. Support for nsf and nsfe files.
  3. 44 khz stereo sound.
  4. Support for extended m3u playlists and internal

nsfe playlists.

  1. Very good sound quality thanks to the use of blargg’s library.

Note1: This codec has Joshua’s patch merged to make it compile fine in all targets.

         I have only a Sansa Fuze V2 so please let me know if something doesn't work in 
         other player.

Note2: If you find some bug or have any comment or suggestion please let me know.

Closed by  Buschel
2011-07-04 05:54
Reason for closing:  Duplicate
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Replaced by FS#12176.

maaan you’re my hero for last weeks ;_;

At least one tune (attached; that’s robokabuto’s entry to famicompo mini 5) plays wrong: at 1:45 should be VRC6 solo and at ~1:50 should be VRC7 in background (though it appears later but sounds totaly wrong) hmm is that’s GME’s problem?

whoops that was not VRC6 bu FME7. You also can check how it should sound in nsf play ( )

VRC7 emulation really pushes out D2’s CPU... I wonder will it handle ym2612? oh and looks like custom tone update in VRC don’t works et all
Really sorry for flooding in such serious place >_<

gama commented on 2011-03-08 21:59

Yes i have confirmed those bugs, and it seems it sounds fine in the original
be a nes cpu problem, since i’m still using the one from gme5.2. Will give it a try and let you know.

VRC7 emulation really pushes out D2’s CPU... I wonder will it handle ym2612?

Yeah even on the PSP i had to overclock a little when playing vgm’s with the
But anyway once the codec is finished there will be more chances that
some optimizations, like happened with the spc codec ;).

the psp’s core cpu is based on mips architecture, much different from
far as i know, the onda vx7x7 series also base on mips and have a clock around 350mhz, as you can see the comparison in docs, it doesn’t have advantage over d2’s 200mhz arm926e

gama commented on 2011-03-09 03:43
At least one tune (attached; that’s robokabuto’s entry to famicompo mini 5) plays wrong ...

I think i have fixed the fme7 bug, but not sure about the vrc custom tone update though, could you explain how it should work?. Great song by the way, it uses four chips :0.

And sorry for making the psp’s cpu comparison, i don’t really know much about cpu arquitectures ;P.

well i don’t know much about VRC7 chip but you found most information here

gama commented on 2011-03-09 14:46

Made some quick fixes/changes to the codec.


- Fixed amp table not being defined in fme7 apu. - Merged latest nes cpu from blargg’s gme.

Maxim could you try this updated codec? And could you tell me of a song that
tone in vrc7 to compare it with nsf_play?.

gama commented on 2011-03-09 14:50

NOTE: There are two files missing in the patch v0.2, please put them in the libnsf folder ;)

Tried it now. FME7 seems to work fine but again same problem with VRC7 chip looks like it plays sinus wave instead of reprogrammed tone, so i wonder if it really updates it (becouse there was only one game on NES that used FM synth so blargg could basicly use custom tone from it without allowing
Can you record how this tune(entry015.nsf) sounds on GME 0.6 on PC?

Here’s another nice tune to check VRC7, check on 0:50 I don’t hear vrc7 here at all (compared to nsfplay).

oh and there is another nsf player i guess you can look how VRC7 emulation interpreted (includes winamp plugin stanalone player and browser
that all documentation in japanese and programmer doesn’t seems to know
that’s not good idea to port this one becouse it has pretty bad N106
there’s nsfplug(nsfplay) sources if you didn’t noticed them:

Both files posted work fine in foo_gep, which uses Game_Music_Emu 0.6-pre in its native form. Maybe the plug-in developer made an error in his C++ to C conversion?

gama commented on 2011-03-09 23:09

Yep, you are right Chris, i made a mistake in the tl and sin tables, i’m using precalculated tables because rockbox doesn’t have a math library, but i was using incorrect values. Maxim, could you try with these files, i also increased the vrc7
gain a little just for testing, but i think some apus might need more volume.

P.S Really great song by the way.

Hoooooray it works ;) though again i have feeling that VRC7 is a bit quet again, where in sources i could tweak device voulmes?

Checked again. VRC7 voulme is fune but only custom instrument sounds quet

In which case, the YM2413 emulator it uses must be broken, because it treats all instruments equally. Compare with foo_gep or in_mgme, two plug-ins which also use GME 0.6-pre.

err please forget last comment it sounds just fine, thanks gama :-)

gama commented on 2011-06-09 23:49

This is the updated codec that works with the new playback engine.


- Removed all metadata handling from the codec
- Made some changes to the nsf metadata parser to work correctly with the new codec.
- Replaced the MAME 2413 emu with one by Mitsutaka Okazaki, who grants permission

to redistribute his emu.

- …

gama commented on 2011-06-10 13:42

Please update the file apps/metadata/nsf.c with this one:

- Fixed some memset bug

   nsf.c (8 KiB)


Available keyboard shortcuts


Task Details

Task Editing