bbbradsmith / nsfplay

Nintendo NES sound file NSF music player
https://bbbradsmith.github.io/nsfplay/
277 stars 42 forks source link

Request: EPSM Support #66

Open Perkka2 opened 1 year ago

Perkka2 commented 1 year ago

It would be nice to see EPSM support added, It's currently supported in FamiStudio and the Mesen fork Mesen-X

https://www.nesdev.org/wiki/Expansion_Port_Sound_Module

bbbradsmith commented 1 year ago

Can you provide test NSF files? How is the hardware obtained, I don't see any information in that page about who makes this device or what games it appears in. There are notes about a bunch of things that don't seem well defined. (It has a drumkit sample set? There is 5B somehow, but not described how?)

Perkka2 commented 1 year ago

Here are 2 nsf files from famistudio. http://epsm.idetorka.se/Sonic1.nsf http://epsm.idetorka.se/Epic_Song.nsf

The hardware should be able to be obtained from Muramasa entertainment. There are currently no games that utilizes it, there are some proof of concept roms. There is: "EPSM Tool" - FM Patch editor by Yoey ROM Exports in FamiStudio Donkey Kong Country 4 for NES Hack that uses it by nin-kuukuu VGM Players by both nin-kuuku and zeta, they have different addressing approaches

the sound chip does essentially have s5b functionality, but a cart using a driver for s5b would need proper addressing and adjustments for different pitch tables.

Its possible to easily wire up a cart to address it in the same way as s5b (using $C000/$E000 to address it) this will only require 5 pcb traces and work as long there are no mapper conflicts. The usual way to wire it up would be so it can be addressed by $401C-$401F

bbbradsmith commented 1 year ago

Is there Famistudio source files for these 2 NSFs? What are they expected to sound like? I don't see a 5B flag for them, are they supposed to use 5B sound, or only the 288?

There seems to be a sold out board here in Muramasa's catalogue: https://www.muramasaentertainment.com/product/expansion-port-sound-module-epsm/

I only see a 288 on this board. Does it have 5B support, or is this an incomplete version?

Is there a more thorough specification somewhere? The NESDev wiki article you linked mentions drum samples but gives no details. It mentions 5B but gives no details. It mentions 288 and gives a communication protocol, but there is no information about clock speed or anything else. There's no information about amplification or mixing levels or whether there is any filter.

In order to add something like this to NSFPlay, I need to have something to run (i.e. NSFs to test) and a way to verify how they are supposed to sound. Preferably that would mean hardware recordings, but even more preferably I'd want to acquire the actual hardware to test against. (A significant game or cartridge release would help as well.)

So, those two NSFs are a start, but I need to know what they must sound like as well. Ideally there could be test ROMs to verify things like mixing levels or other simple behaviours. For example, I've been keeping a library of test ROMs here that I've used to check against various Famicom sound hardware behaviour: https://github.com/bbbradsmith/nes-audio-tests

.

Anyway, do not hurry on meeting those prerequisites, because I do not have much time to spend on NSFPlay these days, and I do not have any estimate of when it will be a priority enough for me to work on features like this. If you want to work on it yourself, I am happy to review pull requests, or give advice on how to proceed, if you need it.

Perkka2 commented 1 year ago

Here is the source of the NSFs soundengine. https://github.com/BleuBleu/FamiStudio/tree/master/SoundEngine

It is supported to open in Mesen-X https://github.com/NovaSquirrel/Mesen-X

No there are no 5b flag in the NSFs, only an EPSM flag. the EPSM's YMF288 basically has a YM2149 built-in.

The YMF288 Has: 3 square channels identical to YM2149/S5B 6 4OP FM channels, identical to the ones in sega genesis or nec PC-98 6 Rhythm channels with built in ADPCM samples

Muramasa has yet to start building them, I have built about 15 or so, but i have no time to mass produce like Muramasa does.

here are some volume testing: http://epsm.idetorka.se/mixing-levels.png http://epsm.idetorka.se/volumetest.nsf

The missing things in those volumetests are the Rythm channels. The vgm tests were done using an old version of VGMPlay and looks way better now with later versions.

bbbradsmith commented 1 year ago

How were the NSFs produced? I was asking if there's a Famistudio file that they were made from, though yes the source code for FamiStudio itself may help too.

Are the built-in ADPCM samples a standard part of the 288 chip? How much data is contained there? Is it a copyright hazard?

Perkka2 commented 1 year ago

The Sonic source fms file is bundled with famistudio. Its simple to make a track and export them to either rom (mmc3) or nsf directly in the gui. the adpcm samples can be found atleast on the bambootracker github repo. https://github.com/BambooTracker/BambooTracker/blob/master/BambooTracker/chip/mame/fmopn_2608rom.h i can upload the volumetest fms later if you want that too.

bbbradsmith commented 1 year ago

Okay thanks, that gives lots of good info.

Unfortunately, MAME chip implementations cannot be incorporated into NSFPlay, as it is not GPL licensed. Are you aware of a 288 implementation that is more permissively licensed?

Some chip emulation implementations, like those from Mitsutaka Okazaki were not under MAME's GPL license, but were separately given a permissive license by their author.

Perkka2 commented 1 year ago

When i added support for famistudio i used emu2149 for the square channels. Nuked-opn2 for the fm channels (its GPL or LGPL depending on what commit you chose) And bambootracker uses that + the mame data patches and some own code to make drums working. but since the data supposedly is from the chip itself i dont know what the mame licensing might care about it

b0x-Cub3d commented 1 year ago

Have you checked out the ymfm emulation library? It has support for the YMF288 and it's under the BSD license. https://github.com/aaronsgiles/ymfm