It is currently Fri Jan 18, 2019 7:47 pm

 All times are UTC - 7 hours

### Forum rules

• For making cartridges of your Super NES games, see Reproduction.

 Page 2 of 2 [ 19 posts ] Go to page Previous  1, 2
 Print view Previous topic | Next topic
Author Message
 Post subject: Re: Misc SNES sound questionsPosted: Thu Mar 08, 2018 1:39 pm

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21003
Location: NE Indiana, USA (NTSC)
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.

Top

 Post subject: Re: Misc SNES sound questionsPosted: Wed Mar 14, 2018 7:19 am

Joined: Tue Oct 24, 2017 11:07 pm
Posts: 18
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.

Top

 Post subject: Re: Misc SNES sound questionsPosted: Wed Mar 14, 2018 11:34 am

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7649
Location: Chexbres, VD, Switzerland
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.

Top

 Post subject: Re: Misc SNES sound questionsPosted: Wed Mar 14, 2018 6:14 pm

Joined: Tue Oct 24, 2017 11:07 pm
Posts: 18
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.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 2 of 2 [ 19 posts ] Go to page Previous  1, 2

 All times are UTC - 7 hours

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ NES / Famicom    NESdev    NESemdev    NES Graphics    NES Music    Homebrew Projects       2018 NESdev Competition       2017 NESdev Competition       2016 NESdev Competition       2014 NESdev Competition       2011 NESdev Competition    Newbie Help Center    NES Hardware and Flash Equipment       Reproduction    NESdev International       FCdev       NESdev China       NESdev Middle East Other    General Stuff    Membler Industries    Other Retro Dev       SNESdev       GBDev    Test Forum Site Issues    phpBB Issues    Web Issues    nesdevWiki