It is currently Wed Jul 17, 2019 6:14 am

 All times are UTC - 7 hours

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: DMC bias?Posted: Sun Jan 27, 2019 11:18 am

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 58
I want to thank everybody for the help I've been given so far. It's really appreciated. I have a question about how the DMC channel works that I can't find anywhere online.

the DMC channel has a 7 bit output, so that's a range of 0 - 127. a 1 in the data stream means the next sample is one higher, and a 0 means it's one lower, correct? if no sample is playing, where is the 'neutral' position? if you look at a waveform in an editor like audacity, some of the samples are positive and some are negative, oscillating back and forth around 0. for DMC samples, is it correct to think of 64 as being the neutral '0' position and the waveform oscillating higher and lower than that? If that's the case, when the channel goes from silent to playing a sample, what position does it start from? if it starts from 0, then wouldn't that mean the sample would have to begin at it's lowest point rather than a neutral point? or does it start at some middle value (such as 64-ish) and then oscillate from there (as if it had something like DC bias applied to it)?

Top

 Post subject: Re: DMC bias?Posted: Sun Jan 27, 2019 11:29 am

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 58
OK, so I saw this on the Wiki:

Quote:
It is loaded with 0 on power-up, and can be updated by \$4011 writes and delta-encoded sample playback.

Is there a standard way to get from 0 to a nice neutral spot for the waveform to begin at? Should every sample begin with 8 bytes of \$FF to get the output to the center? Or am I completely misunderstanding what is going on?

Top

 Post subject: Re: DMC bias?Posted: Sun Jan 27, 2019 11:41 am

Joined: Fri May 08, 2015 7:17 pm
Posts: 2534
Location: DIGDUG
Sound waves, usually, go up and down.

If you start at 0, full bottom, and the signal goes down...the output just stays put at zero until it gets an up signal. Thus it self corrects to a medial position (perhaps with some clipping at the very start of the tone)

You could intentionally set a middle point, just before each DMC sample play, but you get a slightly popping sound.

(edited)

_________________
nesdoug.com -- blog/tutorial on programming for the NES

Top

 Post subject: Re: DMC bias?Posted: Sun Jan 27, 2019 11:53 am

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7527
gravelstudios wrote:
Is there a standard way to get from 0 to a nice neutral spot for the waveform to begin at? Should every sample begin with 8 bytes of \$FF to get the output to the center? Or am I completely misunderstanding what is going on?

If you want this, just write 64 to \$4011 at the start of your program. The sudden pop from 0 to 64 should be acceptable during reset/startup.

After that, it's just a matter of playing samples that are balanced so they'll stay in the middle. As dougeff said, there's a self-balancing aspect to it, since any sample that ends up pushing against the wall will end up pushing itself off back toward the centre.

As for the other idea, to pop to a starting position for every sample, Famitracker has that as an option too. Some people like the pops, esp. to add some kick to a bass drum sample. (I don't like it personally, and some emulators have an option to suppress this popping sound, too.)

There's another disadvantage of DPCM, because it shares a nonlinear DAC with the noise and triangle channels, the higher the DMC output value, the noise and triangle will get a bit attenuated. Nintendo actually used this to deliberately attenuate the triangle channel in Super Mario Bros. and Startropics, it seems. SMB seems to have a device will write incrementing values to \$4011 each frame to "smoothly" reach the setting for that stage's music (produces a quiet 60hz buzz), and Startropics uses it to help fade out the music during transitions.

Top

 Post subject: Re: DMC bias?Posted: Sun Jan 27, 2019 12:46 pm

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 58
thank you both! this is exactly what I needed to know.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 5 posts ]

 All times are UTC - 7 hours

Who is online

Users browsing this forum: No registered users and 3 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki