NSF PCM technique (via Deflemask)

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: NSF PCM technique (via Deflemask)

Post by Bregalad »

I apologise to sound arrogant and to have driven you to tears, and yes I would never get in the way of a music compositor for dumb reasons.

However, what I was saying is that using more than one expansion chip makes few sense. Don't get me wrong, I am facinated by expansion chips too, and as I said above, I made several songs for them in PPMCK just for the sake of trying expansion chips, without any intent to use this in a game or demo ! I perfectly see where the fascination for expantion chips come. In fact the Famicom is probably the only video game console to ever had something such as expansion sound chip (if you don't count SNES's Super GameBoy).

The point is, the fact the .nsf format allows multiple expansion chips at the same time was, technically, purely accidental. Some guy decided some day that the .nsf format was like this, that every existent expansion chip would get a bit, but this guy could have decided instead that 0 = no expansion, 1 = MMC5, 2 = FDS, 3 = Sunsoft 5B, etc... and this way nobody could have ever thought of using more than one emulated expansion chip at the same time.

I can understand why people would compose in the .nsf format instead of a more sophisticated trackers using "artificial" square/triangle/saw wave samples, but I don't get people that compose specifically for the .nsf format something that could not be made in a famicom cartridge.

Also using the NSF format allows to use more than one expansion chip at a time, but it does not allow to use another expansion chip that wasn't ever put in a Famicom cartridge, which would be very possible. Imagine a SPC-700 in a NES cart :)

Oh and should just point out that I, too, am younger than the NES, and I too didn't grow up with one, I grew up with the Playstation 1 :)
Heck, I like it so much I spent hundreds of dollars to get myself a NTSC NES, a PAL NES, two Famicoms, a Power Pak, a TNS-HFC3 and one copy of every expansion chip to ensure I get as authentic a sound as possible when I play my tunes back.
Sounds cool - would you mind how do you replay NSFs with the FDS RAM adapter ? I'd be interested, because rewriting FDS discs just happen to be almost impossible alas :( Simulting the FDS disc drive and attaching the RAM datpter to such a simulator doesn't sound much more feasible either :(
That's a perfectly usable technique in games/demos, even if it's only in title screens, cut scenes etc.
True, but you'd have to consider that CPU time and ROM size are limited, which really reduce the usefulness of 7-bit PCM unfortunately.
$Tangenting: the ability to set callbacks to a rate other than 50 or 60 Hz is also not exactly all that faithful, but I don't think we gave Neil Baldwin any crap for PR8
It's possible to update faster than 50 or 60 Hz, it would just require a mapper with cycle counter IRQ, such as the FDS-RAM adapter or FME-7.
The problem is the limited CPU, something that updates at 500Hz (like Super Mario World's sound engine) would definitely be a no-no.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NSF PCM technique (via Deflemask)

Post by tepples »

jrlepage wrote:I'm just bored with people getting on their high horses
So am I. Perhaps the problem is a difference in what one perceives as counting as the "entertainment" in Nintendo Entertainment System.
lidnariq wrote:the ability to set callbacks to a rate other than 50 or 60 Hz is also not exactly all that faithful
Changing the APU parameters mid-frame with a timer IRQ is no less faithful than changing the scrolling mid-frame with the same IRQ.
thefox wrote:it's easier for me to compare things that way ("oh wow, wouldn't have expected 2A03 to sound this good" vs "I have no idea if this is an achievement on 2A03+whatever expansion chip(s)").
Or, how I express it when NovaYoshi plays some NSFs on his audio-modded NES: "What chip does this use?"
Bregalad wrote:In fact the Famicom is probably the only video game console to ever had something such as expansion sound chip
Or the Sega CD. Or the TurboGrafx-CD. Or the Nintendo Play Station (which was canceled here but apparently did see release in the Potterverse). I think the Game Boy Color had something called "Pocket Music" that would work only on a Game Boy Color because the Game Boy Advance lacked the analog audio path. The GBA needed its own version that worked with the GBA's PCM channels.
Bregalad wrote:I don't get people that compose specifically for the .nsf format something that could not be made in a famicom cartridge.
The NSF format specifies that the NSF mapper, not the expansion sound mappers, controls the PRG ROM's upper address lines. With that in place, multiple mappers can be on the board, watching the CPU bus for writes to their particular synths. Some mappers have overlapping address spaces, but those can be worked around. For example, don't put code at mapper port addresses if you're also using FDS, and make sure the Sunsoft 5B's port address is at $0E or $0F while writing to the N163. In such a case, I see no reason why multiple synth chips can't be soldered to one board and mixed by the cartridge before sending the signal to the Famicom.
Bregalad wrote:would you mind how do you replay NSFs with the FDS RAM adapter ?
Desolder the FDS mapper chip and put it on a custom board.
Bregalad wrote:you'd have to consider that CPU time and ROM size are limited, which really reduce the usefulness of 7-bit PCM unfortunately.
True, CPU time is limited, but in #nesdev, kevtris reminded me that 4 MB flash chips are cheap. I've implemented a 4-bit ADPCM codec that plays back at 8000 Hz, and at that rate, one could fill 3/4 of the ROM with 13 minutes of audio and still have space left for a game.
Bregalad wrote:The problem is the limited CPU, something that updates at 500Hz (like Super Mario World's sound engine) would definitely be a no-no.
Are you talking about the original SNES version by Nintendo or Hummer Team's port to the Famicom?

But let's look at it: Imagine DMC set at the slowest rate ($0). This would tick once every 428 cycles (4182 Hz) and fetch a byte every 3424 cycles (522 Hz). Now imagine using the DMC to play a 1-byte $00 sample with an IRQ at completion. A music engine that doesn't use DMC for audio would end up not making an update most of the time the IRQ handler calls it, so still only a few percent.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NSF PCM technique (via Deflemask)

Post by tokumaru »

tepples wrote:
Bregalad wrote:In fact the Famicom is probably the only video game console to ever had something such as expansion sound chip
Or the Sega CD. Or the TurboGrafx-CD. Or the Nintendo Play Station (which was canceled here but apparently did see release in the Potterverse). I think the Game Boy Color had something called "Pocket Music" that would work only on a Game Boy Color because the Game Boy Advance lacked the analog audio path.
Even the Atari 2600 had expansion sound in Pitfall II, which is impressive considering that the extremely limited cartridge connector barely has enough lines to access a ROM chip (+5V, 2 GNDs, 8 data lines and 13 address lines for a total of 24 lines), and the cart can't even tell if the CPU is trying to read or write (carts with extra RAM usually used a memory range for reading and another for writing, so that address lines could be used to tell reads and writes apart). Anyway, apparently the sound chip in Pitfall II directly controls the internal sound registers to produce richer audio than would be possible through software.
jrlepage
Posts: 24
Joined: Wed Apr 04, 2012 2:15 am

Re: NSF PCM technique (via Deflemask)

Post by jrlepage »

Bregalad wrote:
Heck, I like it so much I spent hundreds of dollars to get myself a NTSC NES, a PAL NES, two Famicoms, a Power Pak, a TNS-HFC3 and one copy of every expansion chip to ensure I get as authentic a sound as possible when I play my tunes back.
Sounds cool - would you mind how do you replay NSFs with the FDS RAM adapter ? I'd be interested, because rewriting FDS discs just happen to be almost impossible alas :( Simulting the FDS disc drive and attaching the RAM datpter to such a simulator doesn't sound much more feasible either :(
Actually, I'm afraid what I said isn't entirely true: I haven't got a Disk System unit (yet). I think Terra Network Systems (the company behind the TNS-HFC3) actually had plans for an adapter that would let you connect the FDS RAM cart to the HFC3 in order to let you play FDS NSFs. I don't know whether they actually went through with that project or if it's still under development though.

I haven't got a 5B cart either, but jarhmander (aka ~J-@D!~) ordered a bunch of YMZ284 chips, and we have already planned to meet up in order to create a custom circuit that would let me use one of these on my HFC3.

Bregalad wrote:Also using the NSF format allows to use more than one expansion chip at a time, but it does not allow to use another expansion chip that wasn't ever put in a Famicom cartridge, which would be very possible. Imagine a SPC-700 in a NES cart :)
Hooking up an OPL3 or similarly powerful chip to a Famicom and writing music for it is a fantasy of mine actually. Not that I'd ever have the know-how to actually go ahead and do it, but it'd be interesting. 2A03+SPC700 would definitely be interesting as well, so would 2A03+SID (I know quite a few people who agree on this one as well, haha).

I think that'd be pushing it though. Might as well make an NSF and a SID separately and mix them in post-production, I think...
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Re: NSF PCM technique (via Deflemask)

Post by zzo38 »

jrlepage wrote:
Bregalad wrote:Also using the NSF format allows to use more than one expansion chip at a time, but it does not allow to use another expansion chip that wasn't ever put in a Famicom cartridge, which would be very possible. Imagine a SPC-700 in a NES cart :)
Hooking up an OPL3 or similarly powerful chip to a Famicom and writing music for it is a fantasy of mine actually. Not that I'd ever have the know-how to actually go ahead and do it, but it'd be interesting. 2A03+SPC700 would definitely be interesting as well, so would 2A03+SID (I know quite a few people who agree on this one as well, haha).

I think that'd be pushing it though. Might as well make an NSF and a SID separately and mix them in post-production, I think...
Currently, DotFami does not allow audio expansions that were never put in a Famicom cartridge either, with the exception of an extra 2A03 audio (no CPU) unit. If you are interested in it, we could add such commands to DotFami for OPL3, SPC700, SID, or whatever you are interested in.

If you are connecting these audio chips you would have to figure out how the addressing will be connected!

If you want to mix the NSF/SID in post-production, then another possibility would be to use some kind of preprocessor to convert one .MML file into two separate ones for .NSF and .SID output, or to make a program which compiles a single .MML file into different notes for .NSF and .SID. If you are converting MIDI or tracker formats, we could have a program to take only some channels and omit the others, some channel for .NSF and some channel for .SID.
[url=gopher://zzo38computer.org/].[/url]
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: NSF PCM technique (via Deflemask)

Post by Bregalad »

If I remember well, OPL-3 was this chip used in old PCs as a (terrible) MIDI synth. I used to make a lot of music with it (without knowing it) back when I was a kid, but now I hate it's sound - brings back bad memories of having such a lame lowcost soundcard on my PC. Now thank to BASSMIDI and soundfonts I can have high quality sound fonts without even needing a dedicated sound card.

Back on topic - I think the VRC7 sounds quite similar to the OPL-3, but I think it's even worse as it lacks drums, has only 6 channels, and only a single customizable channel. Well again, I like PSG and PCM, but FM modulation is not my cup of tea, probably because of what I just said above.

I agree NSF + SID would be cool, in fact this probably would have happened if Nintendo didn't remove the possibility of sound expansion in their westen cartridges. While the SID was extremely popular in western countries, it was probably unknown in Japan.
Desolder the FDS mapper chip and put it on a custom board.
There is quite a few chips in the RAM adapter, they are somewhat undocumented. It would be easy to see which one is responsible for the extra audio channel by looking at the PCB layout, but it probably has some other functionalities too.
Or the Sega CD. Or the TurboGrafx-CD. Or the Nintendo Play Station (which was canceled here but apparently did see release in the Potterverse). I think the Game Boy Color had something called "Pocket Music" that would work only on a Game Boy Color because the Game Boy Advance lacked the analog audio path. The GBA needed its own version that worked with the GBA's PCM channels.
I forgot about the XXX-CD consoles because they weren't released in Europe and they are almost like new consoles in themselves, like the FDS is almost a different console than the NES (at least GameFaqs separates them in different "consoles").
I never heard about the Pocker Music, and other than that I don't think any GB carts ever used the extra audio pin, which is so much a shame. But I can understand why companies would choose to place a good sound chip in consoles rather than assuming the extra costs of having an additional sound chip in many manufactured cartridges.
Are you talking about the original SNES version by Nintendo or Hummer Team's port to the Famicom?

But let's look at it: Imagine DMC set at the slowest rate ($0). This would tick once every 428 cycles (4182 Hz) and fetch a byte every 3424 cycles (522 Hz). Now imagine using the DMC to play a 1-byte $00 sample with an IRQ at completion. A music engine that doesn't use DMC for audio would end up not making an update most of the time the IRQ handler calls it, so still only a few percent.
I was talking about the SNES Super Mario World, whose music's engine updates at 500 Hz (as does most of Nintendo's SNES games). Of course it would be possible on the NES, but your music engine would have to be extremely fast since it will be called 10 times per PAL frame. Updating 2 or 3 times per frame sounds like a better compromise to me, if meant to be used in a game of course.
Hooking up an OPL3 or similarly powerful chip to a Famicom and writing music for it is a fantasy of mine actually. Not that I'd ever have the know-how to actually go ahead and do it, but it'd be interesting. 2A03+SPC700 would definitely be interesting as well, so would 2A03+SID (I know quite a few people who agree on this one as well, haha).

I think that'd be pushing it though. Might as well make an NSF and a SID separately and mix them in post-produ
I just throught : You'd be better composing music for the GBA which has hardware (real !) PSGs + arbitrary PCM.
Unfortunately the PCM is 8-bit, the Nintendo DS solves this where it has 16-bit arbitrary sound channel similar to SNES' and can still do native PSG on those channels.
This also avoids the problem to have to buy so many rare Japanese cartridges just for their expansion chip.
Post Reply