It is currently Sat Aug 17, 2019 7:34 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: DMC bias?
PostPosted: Sun Jan 27, 2019 11:18 am 
Offline
User avatar

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 60
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
 Profile  
 
 Post subject: Re: DMC bias?
PostPosted: Sun Jan 27, 2019 11:29 am 
Offline
User avatar

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 60
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
 Profile  
 
 Post subject: Re: DMC bias?
PostPosted: Sun Jan 27, 2019 11:41 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2548
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
 Profile  
 
 Post subject: Re: DMC bias?
PostPosted: Sun Jan 27, 2019 11:53 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7560
Location: Canada
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
 Profile  
 
 Post subject: Re: DMC bias?
PostPosted: Sun Jan 27, 2019 12:46 pm 
Offline
User avatar

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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 forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group