NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode


SubjectComic Baker NSF  
Posted byAnonymous
Posted on9/1/04 03:05 AM
From IP64.12.116.77  



Uhhhh, it says on nesdev that that NSF uses many "undocumented" features of the 2A03s sound hardware. How technical exactly is this? If they were undocumented are they still? Why won't it work on emulators? Is it because of timing or something....it did seem like a complicated song though.

And what about Skate or Die 2 the title theme? That was crazy! It all has some guy saying skate or die, but at each time he said it differently like. Was that all the same sample? And also the electric guitar with the dpcm channel was a playing at a whole mess of different notes and stuff. Now that was all done through $4011 manually....RAWly. And I heard it synchronized the rate of playback to $4011. Was that the change of notes and frequencies and why it suounded much different even though it was the same sample? Or was it different samples?

thx :)




SubjectRe: Comic Baker NSF new  
Posted byMemblers
Posted on9/1/04 04:32 AM
From IP68.58.99.218  



The description of the Comic Bakery recording was written years ago, it's all documented now and most NSF players should play it fine. It sounds like that because writing the register to update the high byte of the frequency resets the pulse's duty cycle. You'll hear it happen occasionally in several games.

For Skate or Die 2, yeah, it's the same samples. To play samples at different frequencies at a fixed sample-rate, all you need to do is change the amount of time to wait before playing the next byte of the sample. By using fixed point timers this can be pretty accurate.




SubjectRe: Comic Baker NSF new  
Posted byAnonymous
Posted on9/1/04 10:47 PM
From IP205.188.116.75  



OK, thx :-)

Umm, do I have to do everything manually then (RAW with $4011)? Or is there a register I can use to change the playback rate when doing the dma playback? How would I use fixed point timers? thx




SubjectRe: Comic Baker NSF new  
Posted byMemblers
Posted on9/2/04 02:55 AM
From IP68.58.99.218  



It depends on what you're doing. If you're using the DMA, you get only 16 playback rates to use. Games that play different notes using the DMA method (like Sunsoft) have to use 4 or 5 samples to cover a complete octave (with those 16 playback rates).

Fixed point stuff is basically like using extra byte(s) to represent fractions. An 8-bit timer you can only decrease by 1 at the least, an 8-bit timer that also has an 8-bit fraction can be decreased by 1/256 at the least. It's like doing 16-bit math, but using only the higher 8 bits as the result.




SubjectRe: Comic Baker NSF new  
Posted byblargg
Posted on9/2/04 03:25 AM
From IP199.170.90.39  



The DMC channel has a 7-bit DAC which can be used directly by writing successive samples $4011 at the proper time interval.

The DMC can also play a 1-bit per sample delta-encoded sound sample automatically. Each successive bit specifies whether the current DAC value is incremented or decremented by 2. The resulting waveform is a stairstep, always going up or down (unless it's at the DAC's limit). The playback rate of a sound sample can be one of 16 predefined values which cover a few octaves.

Say you want to directly play a sample at 8kHz. Given a 1.79 MHz CPU clock rate, a sample must be output every 223.75 clocks. Since the interval between writes to $4011 can only be a whole number of clocks, it must vary between 223 and 224 clocks in the following pattern: 224, 224, 223, 224. The maximum error can always be kept within +/- 0.5 clocks.

A fixed point timer keeps track of the accumulating error and adds an extra cycle delay when the error warrants it. Fixed point refers to having a fixed division between the whole and fractional part of the number. Using the example above, one byte stores the whole part of the delay (223) and another the fractional part * 256 (0.75 * 256 = 192). The accumulated error is tracked to determine when an extra cycle delay needs to be added.

     lda  #223-overhead  ; account for loop overhead
sta whole

lda #192 ; 0.75
sta fract

lda #128 ; start error at 0.5
sta error

loop:

lda error
clc ; accumulate error
adc fract ; carry set if error wraps around
bcs extra ; conditionally delay one extra cycle
extra:
sta error

; delay by 'whole' cycles
; ...

; write next sample to $4011
; ...

; loop while samples remain
bne loop





SubjectRe: Comic Baker NSF new  
Posted byAnonymous
Posted on9/5/04 04:30 AM
From IP205.188.116.75  



oh, ok I get it :-) thx




SubjectRe: Comic Baker NSF new  
Posted byAnonymous
Posted on9/5/04 04:31 AM
From IP205.188.116.75  



woah, that helps me out a lot thx! :-)




Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo