Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /storage/content/49/145849/famitracker.com/public_html/forum/classes/dbHandler.php on line 29 FamiTracker
Login:
Menu:
Post: Author:
FamiTracker > General > Source and development > PCM? Owner: Dafydd New post
Page 1 of 1 Sort:  
PCM? Posted: 2008-10-21 11:31  (Last Edited: 2008-10-21 20:18) Reply | Quote
Dafydd

Avatar

Member for: 5304 days
Location: Uppsala, Sweden
Status: Offline

#1993
Hey. I just read on wikipedia about the DPCM channel. Which of these two articles best describes how the DPCM channel works?

[url=http://en.wikipedia.org/wiki/Pulse-width_modulation]PWM
[url=http://en.wikipedia.org/wiki/Pulse-code_modulation]PCM

Can't say I understand much of it, but the second link has pretty cool image (http://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/Pcm.svg/250px-Pcm.svg.png). It looks just like the wave channel on the gameboy. In boyscout, a gameboy tracker, you can program this channel to play waveforms that you "draw" in a 32x16 window, resulting in lots of different sounds. Is there any chance we could see something like the gameboy wave channel in famitracker? Or a program where you can "draw" dpcm samples rather than converting existing samples?

Forgive my stupidness if I don't know what I'm talking about.

Posted: 2008-10-21 19:51  (Last Edited: 2008-10-21 19:51) Reply | Quote
Kizul

Avatar

Member for: 5780 days
Status: Offline

#1994
I believe the PCM article would the closest — after all, the NES doesn't call it a D[i]PCM[/i] channel for nothing.

[url=http://nesdevwiki.org/index.php/APU_DMC]This should also help a bit — it describes the more technical bits of the channel.

Posted: 2008-10-21 20:11  (Last Edited: 2008-10-21 20:20) Reply | Quote
Dafydd

Avatar

Member for: 5304 days
Location: Uppsala, Sweden
Status: Offline

#1995
Duuuh. Yeah. Of course it's PCM. *repeatedly bangs head on desk*

Ahem. So. I don't really get it, still, but I'll try to read up on this some more.

EDIT: Ok, now I understand what DPCM is. So the NES DPCM channel basically plays a "sample" that contains of a table of... er, stuff, that when played rapidly results in sound? And this table contains values ranging from 0-15 (4bit)?

Can .dmc samples be visualized somehow? Like wavefiles in a wave editor?

Posted: 2008-10-22 05:31  (Last Edited: 2008-10-22 11:23) Reply | Quote
furrykef

Avatar

Member for: 5189 days
Status: Offline

#1996
Actually, DPCM is more like PWM than it is like PCM. Both DPCM and PWM are modulated PCM waveforms, though they're not modulated in quite the same way. Don't let the acronyms fool you into thinking that DPCM is more like PCM just 'cause it has PCM in the name.

DPCM works like this. The NES uses 1-bit DPCM, meaning every bit contains a new sample. To decode the waveform, the NES uses what's called a "delta counter", and it starts at 0. (I think it may not be represented as a 0 in the hardware, but we're not concerned with that yet; we're only concerned with the idea of the algorithm.) Now, a bit can only be 0 or 1, of course, so a value of 0 decreases the counter and a value of 1 increases it. The value of the counter is what gets output to the hardware as the waveform. For example, consider this stream of bits: 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000 11111111 00000000

See what it does? It goes up for 8 samples, then down for 8 samples, then it repeats the process over and over... the sound wave goes up and down, up and down... it's a triangle wave!

The audio output will be something like this, going bit by bit:

12345678 76543210 12345678 76543210, etc.

You'll notice that only being able to go up and down means you can't get a flat line. If you need a flat line, the best you can do is approximate it by just alternating between going up and down, like 10101010. It also means you can't just jump from the top of the waveform to the bottom; instead you have to make a diagonal line one step at a time. This is why you can't get a square wave with pure DPCM. These two limitations are what give the NES's DPCM channel its distinctive sound (including why it sounds like crap ).

There was a page somewhere that explains all this and has a couple of neat graphs that show you what's going on and what happens to more complex waveforms, but I don't know where it is. ([b]EDIT:[/b] oh, [url=http://www.owlnet.rice.edu/~elec301/Projects99/adda/dmod.html]here it is. Compare the green line to the red line: the green line goes up when the red line is at the top, and it goes down when it's at the bottom. The red line is the DPCM signal and the green line is the delta counter.)

- Kef


Posted: 2008-10-22 11:24 Reply | Quote
Dave
Moderator

Avatar

Member for: 5682 days
Location: UK
Status: Offline

#1997
Might as well mention that if you want a NES channel where you can draw custom waveshapes, there's the FDS channel (and N106, but that's not as fun )

_______________________
[url=http://www.iridescentaudio.co.uk]iridescent audio
Posted: 2008-10-22 13:11  (Last Edited: 2008-10-22 13:12) Reply | Quote
Dafydd

Avatar

Member for: 5304 days
Location: Uppsala, Sweden
Status: Offline

#1998
Thanks, furrykef. Interesting that the dmc channel only allows for 1 step up and 1 step down, no flats and no other step lengths. I'd like to see the bit sequence for an actual dmc file (like the konami "hey!" used in e.g. tmnt3)... I wonder how I should go about doing that.

Posted: 2010-01-13 15:43  (Last Edited: 2010-01-13 15:44) Reply | Quote
Demick12

Avatar

Member for: 5075 days
Location: Buffalo, NY
Status: Offline

#4270
Very interesting find, furrykef. This will help me make my own DPCM instruments, as I am now becoming familiar with exactly how it works! ^_^

_______________________
You now process Dracula's Rib. Good luck processing it...
Posted: 2010-02-18 12:27  (Last Edited: 2010-02-18 12:31) Reply | Quote
Kizul

Avatar

Member for: 5780 days
Status: Offline

#4499
[quote=Dafydd]Thanks, furrykef. Interesting that the dmc channel only allows for 1 step up and 1 step down, no flats and no other step lengths. I'd like to see the bit sequence for an actual dmc file (like [u]the konami "hey!" used in e.g. tmnt3[/u])... I wonder how I should go about doing that.[/quote]
[url=http://img64.imageshack.us/img64/2950/tmnt3hey.png]Intriguing that you should make such a request… :D

(I tried to get it as stretched out as I could, which you'd think would be easier considering I've got two screens here… :/)

P.S.: Sorry for bumping a basically-dead thread, but — I felt I had to.

Posted: 2010-02-18 18:10 Reply | Quote
Dafydd

Avatar

Member for: 5304 days
Location: Uppsala, Sweden
Status: Offline

#4503
Heh, what? :D There's a few flats in there though. Awesome pic, how'd you make it?

Page 1 of 1 Sort: