NSF PCM technique (via Deflemask)
Moderator: Moderators
- rainwarrior
- Posts: 8719
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
NSF PCM technique (via Deflemask)
From the new NSF export available in Deflemask, it looks like Delek found a very interesting technique for doing PCM in NSF. I hope he doesn't mind me sharing. It's not open source, but it's pretty easy to deduce from a debugger:
During INIT:
1. SEI
2. Write $00 to $4017
Non returning PLAY:
1. SEI
2. PCM playback loop with a poll of $4015 after every loop.
3. If $4015 bit 6 is set, do your regular music update, then return to loop.
I was surprised to find that many NSF players, including the PowerPak, support this. There are a number of players, however, which do not really support this feature of the frame counter (NSFPlay included, though I've been meaning to rewrite its frame counter).
Anyhow, this is pretty interesting. It seems a lot more viable than the non-returning INIT hack supported by foo_gep. Obviously it's got a few support problems (use of SEI is bit of a red flag to me), but I thought it was pretty cool that it works with a lot of NSF player implementations. Also, from what I remember reading, $4015 will fail to clear bit 6 if you read on the same cycle it's set? Maybe you'll get a double frame now and then.
During INIT:
1. SEI
2. Write $00 to $4017
Non returning PLAY:
1. SEI
2. PCM playback loop with a poll of $4015 after every loop.
3. If $4015 bit 6 is set, do your regular music update, then return to loop.
I was surprised to find that many NSF players, including the PowerPak, support this. There are a number of players, however, which do not really support this feature of the frame counter (NSFPlay included, though I've been meaning to rewrite its frame counter).
Anyhow, this is pretty interesting. It seems a lot more viable than the non-returning INIT hack supported by foo_gep. Obviously it's got a few support problems (use of SEI is bit of a red flag to me), but I thought it was pretty cool that it works with a lot of NSF player implementations. Also, from what I remember reading, $4015 will fail to clear bit 6 if you read on the same cycle it's set? Maybe you'll get a double frame now and then.
Re: NSF PCM technique (via Deflemask)
This is surprisingly simple, but would be completely pointless in an actual game unless you freeze all action.
Re: NSF PCM technique (via Deflemask)
Most people making NSFs don't care about actual games...
Re: NSF PCM technique (via Deflemask)
I understand their viewpoint, but to me it's a little weird. Why limit yourself to a NSF if you're not going to use them in games or tech demoes or any sort ?
They could just use a tracker which does lack the NES' limitation and use chiptune-like instruments to get the same result, but with correctly pitched high triangle note, no channel limit, all the PCM they want (and they could use GOOD sounding drums instead of horribly noisy DPCM), etc...
Again I myself did several nsf without the intention of using them in any game nor demoes, mostly cover of othre video game music, and the main purpose was to play with the chip extensions (FDS, VRC6, ...) to see what they are able to do. VRC6 is my favourite, it sounds amazing. Way better than VRC7 and even N106 for some reason.
It's like one day I remembed I found a nsf (cover music from a more modern video game), which used something like 4 of the 6 sound extensions possible AT THE SAME TIME. The guy who made this definitely didn't care about actual game/demoes, and doesn't even care about limiting himself to something possible on hardware, because it's not possible to have more than one mapper at a time. I'm already seeing teepple's answer : "You could build a new mapper with more than one sound chip". yes you could, but that's not how it was supposed to work.
They could just use a tracker which does lack the NES' limitation and use chiptune-like instruments to get the same result, but with correctly pitched high triangle note, no channel limit, all the PCM they want (and they could use GOOD sounding drums instead of horribly noisy DPCM), etc...
Again I myself did several nsf without the intention of using them in any game nor demoes, mostly cover of othre video game music, and the main purpose was to play with the chip extensions (FDS, VRC6, ...) to see what they are able to do. VRC6 is my favourite, it sounds amazing. Way better than VRC7 and even N106 for some reason.
It's like one day I remembed I found a nsf (cover music from a more modern video game), which used something like 4 of the 6 sound extensions possible AT THE SAME TIME. The guy who made this definitely didn't care about actual game/demoes, and doesn't even care about limiting himself to something possible on hardware, because it's not possible to have more than one mapper at a time. I'm already seeing teepple's answer : "You could build a new mapper with more than one sound chip". yes you could, but that's not how it was supposed to work.
Re: NSF PCM technique (via Deflemask)
The MMC3 multicarts already have two mappers at once: one for the game to use and one to select a game. In the case of mappers with Famicom expansion sound, you're correct that only one mapper can control the PRG ROM address lines, but multiple mappers can listen for writes. In fact, several Jaleco games have sampled sound as a separate chip from the mapper. Along the same lines, I remember reading about a project where someone rigged up an MP3 player that plays through the Famicom audio path, at which point chip games can use essentially CD music.Bregalad wrote:it's not possible to have more than one mapper at a time.
Re: NSF PCM technique (via Deflemask)
As far as I know, the SuperNSF engine is the undisputed king of using PCM in an NSF file. It's a multichannel PCM mixer/mod player.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
- rainwarrior
- Posts: 8719
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: NSF PCM technique (via Deflemask)
Here's a clip of multi-expansion being done live on hardware:
Part 1
Part 2
The DJ in the video is actually Robokabuto himself. What's more, he used a YMZ-294 instead of a Sunsoft 5B. :p
But that's besides the point here. As tokumaru pointed out, basically I treat the NES/Famicom as I would any other synthesizer, really. I don't really care about using my NSFs in games or tech demos; all I'm interested in is making music that pushes a system to its very limit. In my opinion, PCM falls under that description, regardless of whether it's feasible in a game context or not. I think this 'hack' Delek found would be pretty neat, if not for the fact that it's incompatible with most NSF players (including NSFPlay). I haven't tested it on my TNS-HFC3 yet, but I'd wager that it doesn't work, despite reports that it does the Power Pak.
Part 1
Part 2
The DJ in the video is actually Robokabuto himself. What's more, he used a YMZ-294 instead of a Sunsoft 5B. :p
But that's besides the point here. As tokumaru pointed out, basically I treat the NES/Famicom as I would any other synthesizer, really. I don't really care about using my NSFs in games or tech demos; all I'm interested in is making music that pushes a system to its very limit. In my opinion, PCM falls under that description, regardless of whether it's feasible in a game context or not. I think this 'hack' Delek found would be pretty neat, if not for the fact that it's incompatible with most NSF players (including NSFPlay). I haven't tested it on my TNS-HFC3 yet, but I'd wager that it doesn't work, despite reports that it does the Power Pak.
- rainwarrior
- Posts: 8719
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: NSF PCM technique (via Deflemask)
If the TNS-HFC3 player is based on NMI, then it should be okay, actually.
Re: NSF PCM technique (via Deflemask)
Interesting, but... you know the famicom has an audio_in pin, therefore it does not have any limit. You could just make any music, and make it play on a famicom somehow. Not the most interesting challenge, huh ?But that's besides the point here. As tokumaru pointed out, basically I treat the NES/Famicom as I would any other synthesizer, really. I don't really care about using my NSFs in games or tech demos; all I'm interested in is making music that pushes a system to its very limit.
When it comes to the NES, it's only limit is that PCM is restricted to 7-bit DAC via $4011. I guess you could just make any music, make a mapper that computes it in a 7-bit value, and have some program doing a lda $wathever sta $4011 loop forever. This is not quite limitating either.
Re: NSF PCM technique (via Deflemask)
Somehow I suspect you're being a prick on purpose. I suppose I'll go back to lurking if this is how this community reacts to free speech.
Re: NSF PCM technique (via Deflemask)
Don't worry... Bregalad sometimes has a hard time seeing things from a perspective other than his own (if people do things differently from him it takes him some time to understand that, well, people are different and have different opinions and tastes), but he's not a bad person and would not be a jerk just to piss people off.jrlepage wrote:Somehow I suspect you're being a prick on purpose.
I get him though... for us, who like to make games for the NES, it may sound weird that for other people it's just a musical instrument. But this is a fact, so we just have to deal with it. I assure you that this community has nothing against free speech! =)
Re: NSF PCM technique (via Deflemask)
I'm just bored with people getting on their high horses, telling me that I do what I love to do for the wrong reasons. I'm not talking about Bregalad specifically here; this isn't a personal attack in any way, just an observation that I've made over the 5-6 years that I've been doing this. For example, there isn't a FamiCompo event where a select few complain about tunes that use expansion chips (sometimes more than one OMGOMGOMG*gasp*) because it's "not meant to be that way", "that's not what the NES sounded like" and whatnot, and I'm supposed to adhere to those people's view of what my pasttime and passion should be about (or else they'll downvote my tune that I put the same care, passion and effort in as they did their own!). So yes, I get a little pissed off when I respect other people's hobbies and opinions, but I don't get the same treatment in return.
Bregalad is 100% entitled to his view that NES or NSF coding should be made with actual programs in mind. I see where he's coming from. But I'll tell you this: the NES system is older than I am; I didn't grow up in that generation of video gaming system. For this reason, the NES holds very little nostalgic significance for me, and I don't get that feeling of "impurity" when I or someone else makes something (a demo, a piece of music or anything along those lines) for it that doesn't reflect the machine's past - that isn't "what the machine was designed to do" - au contraire, I find it brilliant thay they're effectively thinking outside the box, and doing things that weren't intended by design.
That's also why I don't find it "weird" to treat the 2A03 (and the Famicom's expansion sound hardware) in much the same way that I would any synthesizer. But in spite of that, I like the idea of sticking to the console's basic limitations, and dislike working in a non-genuine environment like a generic XM/IT tracker with faux-8bit samples. I like the authentic sound of the 2A03 (and the expansion audio). 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. Big deal, you'll say - but that's just to show how passionate I am about Famicom music. And I'm supposed to be doing this for the wrong reasons? What I'm doing is weird, somehow?
Look at it this way: NESDev is a community that essentially consists of people who program on a console that's older than I am. Yet I'm the weird one because I use the same machine in different ways by making music for it for the sake of the music itself?
Lastly, the thing that got to me is the attitude conveyed by this sentence:
Besides - if we're going to go down that slippery slope - could one not say that programming for the NES isn't an interesting challenge due to the fact it has an expansion port that you could wire a modern CPU and GPU to and run a modern program? That doesn't really hold water, does it.
What I'm trying to say is, I admire and respect every one of you who makes wonderful things with the console; all I ask is a bit of that same respect in return.
Bregalad, si tu parles français, je t'invite à exprimer ton opinion en la langue de Molière si cela peut te permettre de mieux transmettre tes idées sans la barrière de langues.
Anyway try Deflemask it's cool~~
Bregalad is 100% entitled to his view that NES or NSF coding should be made with actual programs in mind. I see where he's coming from. But I'll tell you this: the NES system is older than I am; I didn't grow up in that generation of video gaming system. For this reason, the NES holds very little nostalgic significance for me, and I don't get that feeling of "impurity" when I or someone else makes something (a demo, a piece of music or anything along those lines) for it that doesn't reflect the machine's past - that isn't "what the machine was designed to do" - au contraire, I find it brilliant thay they're effectively thinking outside the box, and doing things that weren't intended by design.
That's also why I don't find it "weird" to treat the 2A03 (and the Famicom's expansion sound hardware) in much the same way that I would any synthesizer. But in spite of that, I like the idea of sticking to the console's basic limitations, and dislike working in a non-genuine environment like a generic XM/IT tracker with faux-8bit samples. I like the authentic sound of the 2A03 (and the expansion audio). 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. Big deal, you'll say - but that's just to show how passionate I am about Famicom music. And I'm supposed to be doing this for the wrong reasons? What I'm doing is weird, somehow?
Look at it this way: NESDev is a community that essentially consists of people who program on a console that's older than I am. Yet I'm the weird one because I use the same machine in different ways by making music for it for the sake of the music itself?
Lastly, the thing that got to me is the attitude conveyed by this sentence:
This strikes me as both arrogant and pedantic, and that's what grinded my gears in the first place.Not the most interesting challenge, huh ?
Besides - if we're going to go down that slippery slope - could one not say that programming for the NES isn't an interesting challenge due to the fact it has an expansion port that you could wire a modern CPU and GPU to and run a modern program? That doesn't really hold water, does it.
What I'm trying to say is, I admire and respect every one of you who makes wonderful things with the console; all I ask is a bit of that same respect in return.
Bregalad, si tu parles français, je t'invite à exprimer ton opinion en la langue de Molière si cela peut te permettre de mieux transmettre tes idées sans la barrière de langues.
Anyway try Deflemask it's cool~~
Re: NSF PCM technique (via Deflemask)
I think the fundamental question comes down to what are we really writing a synthesizer for? Is the NES? The Famicom? Or the NSF format? It seems that using multi-expansion audio or 7-bit sample playback are targeting the NSF format, and not targeting either of the first two. And that's ok. But the people who are still thinking of these things as music for NES games are upset by it because it's not music for NES games. Which ties directly into the followup question of "if you're not keeping faithful to the constraints of what could have fit in a Famicom game, why aren't you using a more capable synth?" (To put it another way: Are you allowed to use the 2MHz 6502 as another instrument, or is this really about the sound generating hardware? Logged formats like .GYM can't have this question.)
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.
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.
Re: NSF PCM technique (via Deflemask)
Bregalad has freedom of speech too, you know.jrlepage wrote:Somehow I suspect you're being a prick on purpose. I suppose I'll go back to lurking if this is how this community reacts to free speech.
Personally I prefer listening to plain old 2A03 tunes, because that's what I'm most familiar with, and 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)"). But like you said, this is just a hobby for people, so everybody can, and SHOULD do whatever they get enjoyment out of.
How is using 7-bit sample playback not targeting NES/Famicom? That's a perfectly usable technique in games/demos, even if it's only in title screens, cut scenes etc.lidnariq wrote:I think the fundamental question comes down to what are we really writing a synthesizer for? Is the NES? The Famicom? Or the NSF format? It seems that using multi-expansion audio or 7-bit sample playback are targeting the NSF format, and not targeting either of the first two.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi