New PCM demo

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
AWal
Posts: 132
Joined: Wed Oct 06, 2004 8:00 am
Location: Northern New York
Contact:

Post by AWal » Tue Mar 17, 2009 8:48 pm

Never though I'd be rickrolled in a NES demo...seesh...runs very clean, I likes.

Celius
Posts: 2157
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius » Tue Mar 17, 2009 8:55 pm

Yeah, I had crap results when I experimented with PCM. But until I listened to this, I didn't think they were crappy! I guess I was wrong, because my stuff absolutely pales in comparison to this...

So my question is how did you handle PPU updates and scrolling while also streaming PCM data? Somehow even though I swear the cycle counts were all even, whenever I did a bank switch to get to the next data, there was an inevitable click. Did you just hard code updates in between samples, or did you allow for code to be interrupted somehow?

frantik
Posts: 318
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik » Tue Mar 17, 2009 11:47 pm

if you get a click it means you wrote the wrong value to $4011.. timing problems sound like pitch changes or weird warbling. As long as most of the audio is played back at a constant rate, occasionally you can take a little extra time to do other tasks. the graphics stuff is done during vblank as normal, but really i'm only doing a few things each vblank... I just tried to get the most visual effect out of very few writes to the PPU.

The trickiest part was actually reading the controller.. I do this between each write to $4011. There's some branching that has to be done, but you have to make sure each branch takes the same amount of time. at first I was getting pitch changes when you would hold down the A button but I tuned it (by ear.. it's a lot easier than counting clocks) with blocks of nops.

oh, and i also used the ntsc/pal detection routine on the nesdev wiki and did some timing adjustment based on that as well. it sounds right if you boot in either ntsc or pal mode :D

User avatar
Anders_A
Posts: 88
Joined: Mon Nov 27, 2006 11:56 pm
Location: Sollentuna, Sweden

Post by Anders_A » Wed Mar 18, 2009 5:36 am

Haha. Awesome!

Bonus points för PAL support.

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Post by Petruza » Wed Mar 18, 2009 5:53 am

Hey it's great!
I didn't know the NES could play music with this quality, why didn't the games back in the days have this kind of music instead of the classic midi-like?
I know an obvious limitation would be the memory it would take, but appart from that?

User avatar
Dwedit
Posts: 4246
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Wed Mar 18, 2009 6:18 am

Because memory was DAMN EXPENSIVE. Ram was DAMM EXPENSIVE. Rom was DAMN EXPENSIVE. CPUs were DAMN EXPENSIVE.
It's why a modern nes clone costs 30 bucks including a huge multicart of hundreds of pirated games, while the original NES was 200 bucks and games were 50, and that's in pre-inflation dollars.

That and the tune is about 16 seconds and eats up 256KB of ROM.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Petruza
Posts: 311
Joined: Mon Dec 22, 2008 10:45 pm
Location: Argentina

Post by Petruza » Wed Mar 18, 2009 7:05 am

guessed so

mic_
Posts: 917
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ » Wed Mar 18, 2009 7:49 am

..that and you can't do much of anything else while doing PCM playback, so it's really only applicable on a title screen (like in Skate Or Die 2).

I don't really think NES music sounds like a SW MIDI synth though.. There's a lot of music on the SNES that does (not that it can't still be really good, like in Megaman X).

frantik
Posts: 318
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik » Wed Mar 18, 2009 6:36 pm

mic_ wrote:..that and you can't do much of anything else while doing PCM playback, so it's really only applicable on a title screen
/me takes this as a challenge... now i have to try and come up with the ultimate mini game :P

User avatar
AWal
Posts: 132
Joined: Wed Oct 06, 2004 8:00 am
Location: Northern New York
Contact:

Post by AWal » Wed Mar 18, 2009 6:39 pm

Wow, didn't even check PAL; Impressive. Kudos for that.

I seem to remember the 7-bit RAW audio in Gauntlet II not being half-bad with stuff going on onscreen...although it was probably done at a much lower bitrate.

IIRC on the 2600 Pitfall II had an expansion to multiplex 3 square waves(?) and the chip would give the game code the proper value to write to the TIA. With the limited resources on a 2600 if you wanted BGM you really had to work your code around it (and Gyruss for the 2600 does that very well).

User avatar
oRBIT2002
Posts: 585
Joined: Sun Mar 19, 2006 3:06 am
Location: Gothenburg/Sweden

Post by oRBIT2002 » Thu Mar 19, 2009 3:06 am

This is the best DPCM I've ever heard in a NES production. Great work dude!

User avatar
Dwedit
Posts: 4246
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Thu Mar 19, 2009 3:37 am

It's not DPCM, it's PCM.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

frantik
Posts: 318
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik » Thu Mar 19, 2009 4:48 pm

indeed it is PCM.. no delta here buddy

someone on another forum confirmed it works with a powerpak so thats cool :)

User avatar
Zepper
Formerly Fx3
Posts: 3191
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Thu Mar 19, 2009 5:32 pm

What's the name of that music? :|

frantik
Posts: 318
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik » Thu Mar 19, 2009 5:45 pm

Rick Astley - Never Gonna Give You Up

http://en.wikipedia.org/wiki/Rickroll

Post Reply