## Misc SNES sound questions

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
• For making cartridges of your Super NES games, see Reproduction.
tepples
Posts: 21751
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

### Re: Misc SNES sound questions

In other words, D flat major seventh.

To loop a chord, you first have to rewrite it as frequency ratios in just intonation in order to see how much of it to loop. A perfect fifth above a note whose frequency is x has a frequency 3x/2; a major third up is 5x/4. Thus you have unison, a major third up, a perfect fifth up, and a major third above a perfect fifth: fractions 1, 5/4, 3/2, and 15/8. The lowest common denominator of these fractions is 8, making the chord [8, 10, 12, 15]/8. Because the denominator is 8, you have to loop at a frequency 1/8 of the chord's root. In A440 tuning, D flat or C sharp is 277.183 Hz, making the loop frequency 277.183/8 = 34.6479 Hz.

The sample is at 32000 Hz, making one period 32000 / 34.6479 = 923.577 samples long. After opening it in Audacity, I found a decent loop of length 912 samples starting at sample 7986. This being less than 924 implies the sample is tuned slightly sharp of A440. So for now, let's try downsampling it such that the loop is 768 samples long. This means a sample rate of 32000 * 768 / 912 = 26947 Hz. After resampling the audio, I end up with a loop of length 768 samples starting at sample 6724. This could be a starting point for more experimentation.
Attachments
roland-26947.wav.zip

ndiddy
Posts: 26
Joined: Tue Oct 24, 2017 11:07 pm

### Re: Misc SNES sound questions

I've got good news and bad news.

The good news is that I've apparently found a bug in every emulator's SPC emulation, but the bad news is that my sound engine won't work on real hardware. I can tell that it's running because the SNES emits crackles that are at the same pitch as my samples, but not the samples themselves. Is there any SPC initialization you have to do besides:

1. Setting up stack pointer
2. Zeroing echo volumes for left/right
3. Zeroing key on/off
4. Zeroing the flag register
5. Zeroing echo feedback volume
6. Setting max master volume for left/right
7. Setting static gain for channel 0
8. Setting max channel 0 volume
9. Starting to write song data to DSP channel 0

Here's the full file if anyone cares

If it's a confounding factor, I'm doing my "on hardware" testing on a Bung Game Doctor SF6.

Posts: 7766
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

### Re: Misc SNES sound questions

Did you zero noise and pitch modulation registers?
Also after disabling echo you need to wait some time before the echo programm warps arround and stops writing to RAM.

ndiddy
Posts: 26
Joined: Tue Oct 24, 2017 11:07 pm

### Re: Misc SNES sound questions

Bregalad wrote:Did you zero noise and pitch modulation registers?
Also after disabling echo you need to wait some time before the echo programm warps arround and stops writing to RAM.
Thanks, disabling noise and echo writes fixed the issue.