SNES audio hardware info

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.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: SNES audio hardware info

Post by Drew Sebastino »

psycopathicteen wrote:That reminds me of something I heard about the DKC games. Dave Wise said in an interview, that he used a synthesizer that produced instruments by linking shorter waveforms together, and programmed the SPC700 to emulate it.
In that case, what's really stopping you from having a simple beep for a instrument and chain hundreds of those together at different pitches to create instruments?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: SNES audio hardware info

Post by tepples »

Espozo wrote:I thought that you said that the SPC 700 decompressed the audio. Is the "S-CPU" not the sound processor?
The "S-CPU" is the main CPU. I think the "S" exists to distinguish it from the NES CPU, as there also exist S-PPU1 and S-PPU2. S-SMP is the SPC700 CPU, which talks to S-DSP.
Would the music be possible in a game if there was no compression and you instead used an insanely large cart?
You wouldn't be able to change the tempo when time is about to run out, which is one thing that sequenced music has over streaming music.
You can't upload a WAV file? Huh.
You can upload .ogg though.
Gunforce 2 fast.rar
In my opinion, RAR is even worse, as its decompression requires use of software that you aren't allowed to understand.
You know, if sound on the SNES is so flexible, then why do a lot of songs from games like Street Fighter 2 sound a lot different than the arcade version? I'm pretty sure sound on the CPS 1 is FM, but couldn't you have instruments that sound exactly like FM that you can use?
Perhaps they didn't have tools to make them sound "exactly like FM", or they wanted to make it better. Case in point: Super Mario All-Stars could have just used square waves, but instead it changed all the instruments and added additional music channels.
KungFuFurby
Posts: 264
Joined: Wed Jul 09, 2008 8:46 pm

Re: SNES audio hardware info

Post by KungFuFurby »

You can do some FM with pitch modulation (assuming we speak of sine waves). However, it takes two channels to use, and it has a limited range on how the pitch is affected (up to I believe an octave). Plus, only ADSR and gain values affect the strength of the modulation, not the actual volume.
93143
Posts: 1371
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES audio hardware info

Post by 93143 »

tepples wrote:
Espozo wrote:I thought that you said that the SPC 700 decompressed the audio. Is the "S-CPU" not the sound processor?
The "S-CPU" is the main CPU. [...] S-SMP is the SPC700 CPU, which talks to S-DSP.
...okay, Espozo, my previous explanations should make a lot more sense to you now. To reiterate - sending data to the audio module requires the S-CPU (the 65816 clone known as a Ricoh 5A22) to send data via the previously-discussed I/O ports to the S-SMP (the souped-up 6502 knockoff known as a Sony SPC700). The S-SMP shares a single 64 kB RAM pool with the S-DSP, which generates the actual audio and is controlled by the S-SMP.
Espozo wrote:Would the music be possible in a game if there was no compression and you instead used an insanely large cart? I'm probably not going to try something like this, I'm just curious.
Without compression, the chipless Star Ocean map could hold about a minute and a half of 32 kHz 16-bit stereo PCM, with no space left over for game data. And the transfer loop would probably still take up a large fraction of the available CPU time. So no, it's probably still unfeasible, unless you used a bankswitching chip and maybe a coprocessor.

If you want to try scaling down the bitrate, well, Tales of Phantasia exists (to be clear, only the vocals are streamed). At that point it's a question of balancing quality with ROM and CPU time.
You know, if sound on the SNES is so flexible, then why do a lot of songs from games like Street Fighter 2 sound a lot different than the arcade version? I'm pretty sure sound on the CPS 1 is FM, but couldn't you have instruments that sound exactly like FM that you can use?
Theoretically, yes - as long as you can fit what you want to do in the memory you have available. That Gunforce 2 audio file is 2 MB, or nearly 600 kB in BRR format, so it would have to be cut down judiciously (or streamed on demand) to work on the SNES.

There's also the curious and oft-neglected "pitch modulation" feature, whereby the audio output of a channel (before main channel volume) can be used to modulate the pitch of the next channel. You may recognize the word "pitch" as a commonly-understood synonym for "frequency" - that's right, the S-DSP is an FM synthesizer.

Kinda. FM synth and SNES pitchmod are conceptually identical, but they're a fair bit different in practice, and using the latter musically is rare, probably because it's not set up to make such use easy. You can use arbitrary waveforms, but there are no routing options, modulation is limited to +/- one octave, and each operator burns a channel. And there's no autosync, so you have to align the waveforms yourself. You can do cool things with it if you know what you're doing, but you're probably better off with straight samples for the vast majority of cases.

...ah. KungFuFurby scooped me on this... just so we're clear, he's the expert; I'm just a well-read n00b...
Espozo wrote:In that case, what's really stopping you from having a simple beep for a instrument and chain hundreds of those together at different pitches to create instruments?
That sounds like granular synthesis. I think Rock 'n' Roll Racing used something like that.

If you mean additive synthesis, though... Eight channels, remember?
tepples wrote:Perhaps they didn't have tools to make them sound "exactly like FM", or they wanted to make it better.
Or Capcom sucked at SNES audio...
KungFuFurby
Posts: 264
Joined: Wed Jul 09, 2008 8:46 pm

Re: SNES audio hardware info

Post by KungFuFurby »

PCM streams suffer from transitional disadvantages when it comes to looping as well. All those special effects have to carry over into the next loop. I also don't completely trust PCM for interactive music for the same reason: I can just simply program a flag check in music data. PCM is more of a polling-style transition, and even then, it has to be sample exact (and you need more PCM files to account for special effects fading away during these transitions).

I think of Packy and Marlon when I think of pitch modulation... even if the results are not quite right. Playground 2 and House 4 come to mind, and Unknown Song 9 and 13 also contains pitch modulation that sticks out.
93143
Posts: 1371
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES audio hardware info

Post by 93143 »

Blockade from Jurassic Park 2 uses pitchmod.
psycopathicteen
Posts: 3001
Joined: Wed May 19, 2010 6:12 pm

Re: SNES audio hardware info

Post by psycopathicteen »

Something I observed a while back with fooling around with soft synths is that the best sounding instruments have some kind of detuning in them, but if you try to sample a detuned instrument, you won't find any loop points.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: SNES audio hardware info

Post by Drew Sebastino »

You know though, about all the instruments, if you see some of the noises in the track I've shown you, It seems like a lot of them are instruments that are very long to lower the tone. Can you change the tone of a sample while it's playing and possibly loop it so that you don't have a long portion of space you are wasting? This way, you could have the guitar noise be very short and you could loop it and simultaneously lower it to have the effect of drawing it out like they have it. You know, another thing I forgot to ask is how you set it up to where you are using both speakers. Can you make it to where you can a channel can either use the left, right, or both speakers? Can you also have it to where it works for both, but is a different volume on one? It seems like ram (definitely not wram, though) is the SNES's main problem, and this is no exception on the audio side of things either.
So no, it's probably still unfeasible, unless you used a bankswitching chip and maybe a coprocessor.
Why a coprocessor? Is it still the HDMA? I'd love to see someone actually try and do something like this, even if the cart would reach gargantuan size. (I think a bank switching chip is a bit more "fair" than just completely bypassing the audio hardware.)
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Re: SNES audio hardware info

Post by bazz »

Espozo wrote:Can you change the tone of a sample while it's playing and possibly loop it so that you don't have a long portion of space you are wasting? This way, you could have the guitar noise be very short and you could loop it and simultaneously lower it to have the effect of drawing it out like they have it. You know, another thing I forgot to ask is how you set it up to where you are using both speakers. Can you make it to where you can a channel can either use the left, right, or both speakers? Can you also have it to where it works for both, but is a different volume on one?
Espozo the answer to all these questions is YES and that's what Tracking is, and this is how the SPC is generally programmed.
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: SNES audio hardware info

Post by Drew Sebastino »

Wow, that's actually pretty awesome! So if I really wanted to (even though I'm not going to) I could probably nearly recreate all the instruments that play in the song while using a fraction of the space. The only thing is, It seems a bit more difficult to do this sort of thing when it comes to sound effects. Could you would use HDMA to constantly stream the sound effects, allowing more room for the actual song? I plan on using 6 channels for the actual song and 2 for sound effects, so could you have it to where an HDMA port works with one sound effect and the second for the other?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: SNES audio hardware info

Post by tepples »

I'm pretty sure the fighting games used streamed BRR for calling characters' moves, as did games like NBA Jam for the announcer. Pushing bytes to the APU I/O ports with HDMA might work with only one HDMA channel (I haven't tried it yet), but it would need special attention by the SPC700 to make sure that it never misses a byte of sample when, say, processing music. (There's no IRQ; everything's polled.)
93143
Posts: 1371
Joined: Fri Jul 04, 2014 9:31 pm

Re: SNES audio hardware info

Post by 93143 »

Espozo wrote:Can you change the tone of a sample while it's playing and possibly loop it so that you don't have a long portion of space you are wasting? This way, you could have the guitar noise be very short and you could loop it and simultaneously lower it to have the effect of drawing it out like they have it.
If you mean lowering the pitch, yes. If you mean reducing the volume, yes. If you mean keeping the pitch the same while the timbre dulls (like the guitar sample in Gunforce 2), no. That's a job for either a long sample or an adventure in pitch modulation (you can sharpen the beginning of a sound with pitchmod, then fade out the modulating waveform, but doing this so as to match an existing sample might be quite difficult). One might have to make a hard decision about how much high-frequency information the sound in question actually needs, so as to pick an optimum sample rate... I suppose you could use a dynamic sample rate, but that would require you to continually change the playback rate so as to maintain the pitch...

The guitar in the audio file you posted contains multiple recorded loops - ie: it's wasting space as it is. The same is even more true for the long orchestral/choral sample two doors down. And some of the percussion sounds are longer than they need to be; they could be looped or faded out, with appropriate care, and perhaps some could work with a lower sample rate. The brass thingy could probably be looped too, with the volume scoop handled in software. But this is already pushing the limits, and there are the FM instruments to consider. Doing them with pitchmod would eat too many channels; it's probably better to just use samples for most or all of them. It might be necessary to sacrifice some aspect of the guitar sample to fit everything in with room for the non-sample data...

The sound effects are right out. That's where all the Neo Geo brute force went. They'd need either major rework or on-demand streaming, maybe both.
Can you make it to where you can a channel can either use the left, right, or both speakers? Can you also have it to where it works for both, but is a different volume on one?
Easily. Each of the eight channels has separate volume controls for left and right, as does the echo. The volume can even go negative, which gives you phase inversion; this is how games like Vortex do their Dolby Surround.
Why a coprocessor? Is it still the HDMA?
No, HDMA doesn't take much CPU. But you can't transfer uncompressed 32 kHz stereo with HDMA because it needs way too much bandwidth. So the CPU has to spend a lot of time giving the SPC700 a few bytes of data, waiting for an acknowledgement, giving it a few more bytes, etc. This is not fast. ~2 kB per frame is nothing for bulk DMA, but this is not bulk DMA.
(I think a bank switching chip is a bit more "fair" than just completely bypassing the audio hardware.)
Why? The BS Satellaview and Super Game Boy did it. I'd have thought the fact that the MSU1 itself didn't exist back then would be a bigger issue...
tepples wrote:I'm pretty sure the fighting games used streamed BRR for calling characters' moves, as did games like NBA Jam for the announcer.
Really? So it's not as rare as I thought...
Last edited by 93143 on Sun Feb 15, 2015 8:27 pm, edited 1 time in total.
User avatar
bazz
Posts: 476
Joined: Fri Sep 02, 2011 8:34 pm
Contact:

Re: SNES audio hardware info

Post by bazz »

Espozo wrote:Wow, that's actually pretty awesome! So if I really wanted to (even though I'm not going to) I could probably nearly recreate all the instruments that play in the song while using a fraction of the space. The only thing is, It seems a bit more difficult to do this sort of thing when it comes to sound effects. Could you would use HDMA to constantly stream the sound effects, allowing more room for the actual song? I plan on using 6 channels for the actual song and 2 for sound effects, so could you have it to where an HDMA port works with one sound effect and the second for the other?
I wouldn't stream the sound effects, I would just load them into the SPC, and send a command to the SPC telling it to play that sound effect.
tomaitheous
Posts: 592
Joined: Thu Aug 28, 2008 1:17 am
Contact:

Re: SNES audio hardware info

Post by tomaitheous »

Is there a way to read the playback pointer of a given channel into the sample? I'm just trying to think of a way to do a real wave-table synth setup with a series of small waveforms (kinda like the PPG synth), without breaking the output stream of the channel and change the timbre on an internal level instead of a note-by-note basis. Can the DSP generate interrupt for when a channel sample block encounters a 'loop' point?
__________________________
http://pcedev.wordpress.com
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: SNES audio hardware info

Post by Drew Sebastino »

bazz wrote:
Espozo wrote:Wow, that's actually pretty awesome! So if I really wanted to (even though I'm not going to) I could probably nearly recreate all the instruments that play in the song while using a fraction of the space. The only thing is, It seems a bit more difficult to do this sort of thing when it comes to sound effects. Could you would use HDMA to constantly stream the sound effects, allowing more room for the actual song? I plan on using 6 channels for the actual song and 2 for sound effects, so could you have it to where an HDMA port works with one sound effect and the second for the other?
I wouldn't stream the sound effects, I would just load them into the SPC, and send a command to the SPC telling it to play that sound effect.
Well, I mean this wouldn't be the ideal thing to do, but if you have just about no space left for sound effects in ram, then you might have to.
Post Reply