I happened across this thread and felt a little extra info is necessary in case someone else comes across this while trying to use the SCD PCM.
First, the format of the PCM audio is 8-bit sign-magnitude. Bit 7 is the sign, where 1 stands for positive values, and 0 stands for negative values. So yes, there is +/- zero on the SCD PCM. 1 to 127 represent -1 to -127. 1+128 to 126+128 stand for positive 1 to 126. 127+128 is a special marker value - fetching 255 tells the PCM chip to load the loop pointer registers and fetch another sample. This is how looping in the SCD PCM chip works. Your sample plays forwards from start offset << 8 until it runs across a 255 byte. It then plays from the loop registers until it again finds a 255 byte. This does mean than +127 is NOT a legal sample for the audio. Any PCM audio loader must clamp positive samples to +126.
The natural sample rate is 32552 Hz. This is the master clock (12.5 MHz) divided by 384. To sound their best, sample should be resampled to this rate. However, you might want to resample to lower rates to use less memory... you've only got 64KB after all. The PCM chip uses a fixed point increment to determine where the next sample is fetched from. This is a 5.11 fixed point number, where 2048 is 1.0, 1024 is 0.5, etc. This means the sample increment can go up to 31.something. Because of this, samples MUST be followed by 32 loop markers (255) in order for the loop marker to be picked up no matter the increment. This is another thing your audio loader must keep in mind - once the sample is clamped and loaded into PCM ram, follow it with 32 loop markers.
So while you can play samples at a rate higher than 32kHz, it does so by skipping samples, which introduces aliasing into the output. If you intended to play samples/notes at increments higher than 1.0, you should filter the sample accordingly. Setting the increment of a pcm channel to 1.0 (2048) plays the sample at 32552 Hz. Suppose you sampled the audio at 16276 Hz to use half the memory? In that case, play the sample with an increment of 0.5 (1024) to play back at 16276 Hz. Remember, the channel ALWAYS plays at 32552 Hz, but the increment chooses where the next sample comes from. An increment of 0.5 means it takes two sample periods to advance one sample, which means the sample plays at half the natural channel rate, or 32552/2 Hz = 16276 Hz.
This is the key to playing music with the PCM chip - setting the proper increment to reflect the frequency you wish to play the sample at. You might check out my SCD MOD player example to see how you do that in a practical setting. I wrote a library to help in using the PCM chip that is used by the mod player. I note the exact frequencies of the PCM chip here because the difference DOES make a difference in playing music. The difference between 16kHz and 16276 Hz is almost two percent, which doesn't seem like much, but this IS audible if you're familiar with the score playing at the right rates. For sound effects, you might neglect the difference - an explosion played two percent faster is probably going to slip past most people.
SCD MOD player + libpcm + CDBOOT loader:
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com
Just libpcm:
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com