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 > FamiTracker Talk > DPCM triangle volume ramps and pitch trick Owner: rainwarrior New post
Page 1 of 1 Sort:  
DPCM triangle volume ramps and pitch trick Posted: 2012-08-02 00:44  (Last Edited: 2012-08-02 00:54) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#37636
I discovered this interesting trick when making my entry for DC5.

As you may know if you've tried to make DPCM ramps to adjust your triangle volume, playing such a ramp sample makes a small squeak noise. Depending on the situation this can be quite noticeable. With the high pitch settings the squeak is very fast and high, but you also hear an unpleasant pop from the fast jump in signal level. With the low pitch settings the squeak is much more apparent, but the popping sound can be diminished or almost eliminated.

The low DPCM samplerates ( pitches 0-8 ) form a C major scale. This provides an opportunity to pitch your ramp to a note in the scale, which you might disguise under another note playing the same pitch in a different channel.

I used this in this cover to pitch the squeak do to a ramp to a D, which is hidden under a D minor chord. Later I pitch the squeak to an E under an E minor chord. The result has no noticeable pop, and the squeak blends right in with everything else.

This made me happy, as I've been investigating the possible uses of the major scale in the DPCM samplerates for a while, and this was the first time I got anything worthwhile from it. (I also wrote a test of short looped DPCM samples with a non-A440 scale to investigate its use for pitched tones: [url=http://rainwarrior.ca/projects/nes/lately_tuned.nsf]lately_tuned.nsf. As you can hear, it wasn't terribly effective at this; the tuning is too poor.)


Attachments:
goose_trim.ftm (14 Kb)
Posted: 2012-08-02 01:32 Reply | Quote
tadpole

Avatar

Member for: 5712 days
Location: Renton, WA, USA
Status: Offline

#37639
This song sounds wonderful! And that's a nice trick indeed. How exactly are you making these DPCM samples? Is it possible to tune any Zxx value to any note?

Posted: 2012-08-02 03:30  (Last Edited: 2012-08-02 03:37) Reply | Quote
rainwarrior

Avatar

Member for: 4150 days
Location: Canada
Status: Offline

#37640
I make the DPCM samples in a hex editor ([url=http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm]XVI32 specificly, but it doesn't matter which one you use).

Yes, you can use a DPCM sample to reach any particular Zxx value. Every 1 bit in a sample adds +2 to the Zxx counter, and every 0 bit is -2. You just need to make some sequence of 0s and 1s that adds up to the value you want to reach. If you keep the patterns of 1s and 0s in groups of 2/4/8/16 bits, the squeak noise will be tuned to the DPCM samplerate (i.e. some lower octave of it).

So in this case, I wanted a sample that adds 96 to the counter (i.e. goes from Z00 to Z60). Since a single byte is 8 bits, I used this as the size of my pattern. The sample has to be 17 bytes long. I used two different bytes in my sample.

hex 57 = 01010111 = +4 to Zxx
hex 77 = 01110111 = +8 to Zxx

So each byte $57 adds 4 to the counter ( because it has 2 more 1 bits than 0 bits, 2 x +2 = +4 ), and each byte $77 adds 8 to the counter ( because it has 4 more 1 bits than 0 bits, 4 x +2 = +8 ). I needed two different bytes because I need them to add up to 96 after 17 bytes.

My 17 byte sample looks like: 57 57 57 57 57 57 57 57 57 57 77 77 77 77 77 77 77

It is equivalent to:
57 - Z04
57 - Z08
57 - Z0C
57 - Z10
57 - Z14
57 - Z18
57 - Z1C
57 - Z20
57 - Z24
57 - Z28
77 - Z30
77 - Z38
77 - Z40
77 - Z48
77 - Z50
77 - Z58
77 - Z60

My ramp down sample is all 00s. The Zxx counter can't go below zero; DPCM sample playback will just clamp if it gets told to go below 0 and remain at 0.

There are other ways to do this; for instance, you can just use a stream of all 1s followed by a stream of 101010... once the counter value is reached; I prefer the 8-bit patterns because the squeak produced ends up 3 octaves lower and doesn't stick out as much, I think (also slows down the ramp to reduce the appearance of a pop).

Also note the DPCM unit reads bytes from LSB to MSB, which is backwards how we write numbers, so when I say hex 57 = 01010111, the DPCM unit will play back 11101010 (i.e. +2 +2 +2 -2 +2 -2 +2 -2). Even though the way it reads bits is backwards to how we think of it, it does read the bytes from "left to right" like we do.

Page 1 of 1 Sort: