Questions regarding SNES sound system

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
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

Right, a pair of 16-bit samples is sent to the DAC at an approximate rate of 32000 per second, so there's no way to vary the waveform by more than that. The main impact is limiting frequencies to 16 kHz. Is there a noticeable difference if your music is resampled to 32 kHz?

There is a way to feed a 16-bit stereo sample stream to the DAC, without having to go through the BRR compression, in case you want to try generating some of it in real-time (without losing the ability to also play the 8 voices). You could generate the audio on the main processor (65816) and stream it to the SPC, though this would mean your music wouldn't play on SPC music players (SNSF players would support it).

What are your main goals? A music engine for use in SNES games, or something standalone? And overall, are you wanting to try a different sound system than the Mega Drive? The SNES is quite different.
User avatar
TmEE
Posts: 789
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Post by TmEE »

its just that I am curious and want to know few more things about SNES sound system. SNES lacks nice action games and for a while I had an idea of making an attempt to make one (like I'm doing for MD though it has plenty of action games). SNES seems to have little CPU horse power (and that's the reason I wouldn't use it in sound generation process), and as much as I've heard, its a pretty pain system to program for... I haven't done much research on SNES...

Thing my MD driver mostly relies on can't be done on SNES - the SPC can't look into ROM, and 64KB or RAM which is shared between code, samples and music data is gonna set me quite some restrictions... Z80 in MD has free access to all ROM area (though it will give me around 5% performance hit on 68K when samples are played (and they're played intensively in my songs).

For the 32KHz, it wouldn't sound very clear like FM would, especially since there's some low pass filtering done which makes things sound even less clear not to mention compression which would again have some negative effect on clearness. Now I wonder if there's some analog filter in SNES... it might be a nice idea to get rid of it... most (except the really early)MDs need some modding to hear all the 52KHz goodness(though there's plenty of games with rather crap sound engines and poor sound) that comes form YM2612. Too bad that there's no synth in SNES...
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

TmEE wrote:SNES seems to have little CPU horse power (and that's the reason I wouldn't use it in sound generation process)
Certainly not compared to the 68K, with its sixteen 32-bit registers and built-in multiply and divide support. What sorts of real-time synthesis do you do on the Mega Drive? More than drums I take it. Seems that you'd most likely be playing looped samples at different rates, which the DSP would best do on the SNES.
the SPC can't look into ROM
The SNES CPU could act as a ROM server, fulfilling requests made by the SPC-700 via the 4 I/O ports. Most communication between the two has lots of acknowledgement, but it's possible to avoid that by carefully timing both parties. For example, the SNES CPU could constantly be reading the first three output ports as a 24-bit address and placing that byte of ROM into the first input port, so the SPC-700 could just place the address, wait a bit, then retrieve the byte from ROM. Not very practical, but possible.
Now I wonder if there's some analog filter in SNES... it might be a nice idea to get rid of it...
There is some slight low-pass filtering after the DAC (perhaps the reconstruction filter). People have modded their SNES units to output SPDIF (whatever that digital audio standard is), which obviously eliminates this low-pass. I would have figured 16 kHz would be plenty for clarity, though.
Too bad that there's no synth in SNES...
You can frequency-modulate a voice based on the output of the previous one. So you could have four independent frequency-modulated voices and four modulator voices. There's a 7-bit register named PMON which tells which voices are modulated.
User avatar
TmEE
Posts: 789
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Post by TmEE »

Certainly not compared to the 68K, with its sixteen 32-bit registers and built-in multiply and divide support. [/quote]

But why there's so much slowdown in many games then ? Or its just the low clock ?
What sorts of real-time synthesis do you do on the Mega Drive? More than drums I take it. Seems that you'd most likely be playing looped samples at different rates, which the DSP would best do on the SNES.
I just play 2 channels of PCM for drums (and speech synthesis), the rest is FM and PSG.... and realtime synthesis would have been something I would have used on SNES to compensate for the lack of sound RAM...

The SNES CPU could act as a ROM server, fulfilling requests made by the SPC-700 via the 4 I/O ports. Most communication between the two has lots of acknowledgement, but it's possible to avoid that by carefully timing both parties. For example, the SNES CPU could constantly be reading the first three output ports as a 24-bit address and placing that byte of ROM into the first input port, so the SPC-700 could just place the address, wait a bit, then retrieve the byte from ROM. Not very practical, but possible.

The point is that main CPU is not involved in the process... if you'd use this method in a game, I doubt there would be enough time to process game stuff.... my MD engine is all Z80, so 68K does the game with no other tasks.
I would have figured 16 kHz would be plenty for clarity, though.
20...24 would be plenty for clarity
You can frequency-modulate a voice based on the output of the previous one. So you could have four independent frequency-modulated voices and four modulator voices. There's a 7-bit register named PMON which tells which voices are modulated.
And how complex sounds could be made ? I guess FM synthesis would sound better....
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

blargg wrote:Certainly not compared to the 68K, with its sixteen 32-bit registers and built-in multiply and divide support.

But why there's so much slowdown in many games then ? Or its just the low clock?
Sorry, I was saying that the 65816 certainly wouldn't be as powerful, as the 68K has all those registers listed above, while the 65816 has only three registers and can't even do arithmetic directly between them. Clock-wise, I think the 65816 might do more work per cycle/byte than the 68K does.
The point is that main CPU is not involved in the process... if you'd use this method in a game, I doubt there would be enough time to process game stuff.... my MD engine is all Z80, so 68K does the game with no other tasks.
OK, so your goal is to make a music engine usable in a game, as opposed to something standalone. Rules out complex arrangements like this.
blargg wrote:You can frequency-modulate a voice based on the output of the previous one. So you could have four independent frequency-modulated voices and four modulator voices. There's a 7-bit register named PMON which tells which voices are modulated.
And how complex sounds could be made ? I guess FM synthesis would sound better....
Well, at the very least you should be able to do FM modulation with two sine waves. You could change the volume of the modulator to change the depth. I'm not very familiar with FM synthesis so I don't know what all it can do. I guess the general (complete?) lack of SNES games with FM synthesis means this isn't that viable.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

TmEE wrote:
Certainly not compared to the 68K, with its sixteen 32-bit registers and built-in multiply and divide support.
But why there's so much slowdown in many games then ? Or its just the low clock ?
Because some games are inefficiently coded. This can happen on any platform. On the NES, SMB3 slows down, but Recca does not.
User avatar
TmEE
Posts: 789
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Post by TmEE »

blargg wrote:Sorry, I was saying that the 65816 certainly wouldn't be as powerful, as the 68K has all those registers listed above, while the 65816 has only three registers and can't even do arithmetic directly between them. Clock-wise, I think the 65816 might do more work per cycle/byte than the 68K does.
I misunderstood a little... I read that 65816 has 16regs.... oops... everything beats a 68K on work/cycles relation, but nothing beats its flexibility, so far, I've not messed with such good CPU on ASM level.
I hope these regs of 65816 are 32bits, or just 16bits (or 16bit in a way like Z80 can do)?
OK, so your goal is to make a music engine usable in a game, as opposed to something standalone. Rules out complex arrangements like this.
Pretty much... but it seems, SNES goes to the end of the list for now.
Well, at the very least you should be able to do FM modulation with two sine waves. You could change the volume of the modulator to change the depth. I'm not very familiar with FM synthesis so I don't know what all it can do. I guess the general (complete?) lack of SNES games with FM synthesis means this isn't that viable.
2 operators allows for poor sounds like for example Adlib can do... 4ops is much more fun and with some effort you can get really nice sounding instruments. Most instruments I've made sound almost like my Yamaha's MIDI. Best part is that each instrument is less than 32bytes.

http://www.soundshock.se/phpBB2/viewtopic.php?t=158
One HW recording of a tiny song I made...
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Well, anyone seems to deny how much better the SNES sound is compared to the Megadrive (at least emulated, I have no real Megadrive).
Hironically, the Megadrive can make things that are hard to reproduce on the SNES processor, both are in fact different. The Megadrive SPU is rather good for techno, and can output awesome synth-bass sound, but aside of that most instruments sound horrible. The SNES CPU would be pretty hard to reproduce techno, but WAY better at reproducting more classic music tunes.
32KHz isn't a lot, but if you keep the sampling rate of all your samples high (something most commercial games don't for memory-saving purposes, but some like Chrono Trigger or Dragon Quest 3/6 actually does), it can output very good sound.
The SNES is also bad at reproducting NES/Gameboy sound due to interpolation. It is good however to make music actually intended to be played with real instruments, where both the NES and the Megadrive music falls flat.

I guess if I were to ever code something for the Megadrive I'd just use FM synthetis for synth basses and sound effects, and leave melody for PSG channels. That way you could have Mega Man Battle Network-like music, heh.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Bregalad wrote:Hironically, the Megadrive can make things that are hard to reproduce on the SNES processor, both are in fact different. The Megadrive SPU is rather good for techno, and can output awesome synth-bass sound, but aside of that most instruments sound horrible. The SNES CPU would be pretty hard to reproduce techno
Listen to the SNES try to do techno: "Rave Dancetune" from Cool Spot (SNES)

Case in point: When Namco decided to port Pac-Attack to the GBA as part of Pac-Man Collection, it used a stream of the Genesis version's music rather than the Super NES version's music.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Stop doing bad publicity for the SNES sound, which is able of more than this, I'm pretty sure, even when it comes to do techno. Most early SNES games use the hardware pretty badly, because good samples at high sampling rate takes a lot of space, and most games have only one set of samples they write once in memory and never touches again, greatly limiting the number of available samples (and quality too) as opposed to games that change samples for each song as they need them.

You could rather listen the soundtrack in Chrono Trigger, and then you'll see that it puts the Megadrive to shame.
strangenesfreak
Posts: 155
Joined: Thu May 03, 2007 3:07 pm
Contact:

Post by strangenesfreak »

I agree with Bregalad - IMO, "Rave Dancetune" used very poor samples, and I believe the SNES version could've sampled waveforms more or less richer than the Genesis's FM synthesized waveforms. Although the Genesis version's "Rave Dancetune" is superior to the SNES version and is one of the better Genesis songs.
User avatar
TmEE
Posts: 789
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Post by TmEE »

You can get nice sound from SNES, but you can also get the same from MD, in FM its just little more pain to get "real" sounding instruments... on SNES you can just use recording of a real instrument... Also, you may want to hear the demo of a MD game "Pier Solar and the Great Architects" once its out, then you can hear that MD can do much more than techno. BTW, the game uses my sound engine.

http://www.hot.ee/tmeeco3/CA-TITLE.OGG - some kind of metal
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

I hope these regs of 65816 are 32bits, or just 16bits (or 16bit in a way like Z80 can do)?
They're 16 bits (or even 8 bits, depending on some mode bits). Unlike the Z80, true 16 bits.
2 operators allows for poor sounds like for example Adlib can do... 4ops is much more fun and with some effort you can get really nice sounding instruments.
I guess pitch modulation can be layered on the DSP, actually, where for example voice 0's amplitude becomes a pitch modulation for voice 1, and voice 1's amplitude in turn becomes a pitch modulation for voice 2. Not sure how useful it would be. I'll have to try it sometime.

Here is some SPC music from Donkey Kong Country 2 & 3 which do some techno timbre-changing effects: Techno_SPC.zip
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

I guess pitch modulation can be layered on the DSP, actually, where for example voice 0's amplitude becomes a pitch modulation for voice 1, and voice 1's amplitude in turn becomes a pitch modulation for voice 2. Not sure how useful it would be. I'll have to try it sometime.
You are right, in Secret of Mana when you call Flammy with the Drum item (you have to be pretty far in the game to do that), the sound effect plays on all 8 voices, where all of them are daisy-chained to pitch-modulate the next one.

And yeah, Donkey Kong Country games make quite notable use of SPC hardware.
User avatar
TmEE
Posts: 789
Joined: Wed Feb 13, 2008 9:10 am
Location: Estonia, Rapla city (50 and 60Hz compatible :P)
Contact:

Post by TmEE »

I just listened the SoM soundtrack, the instruments are pretty nice, but music itself is boring, but that's just my opinion. Those 2 DCK songs aren't anything impressive, and it seems most of its instruments are recorded off from a FM synth.

Nice listening material :
http://project2612.org/details.php?id=55
http://project2612.org/details.php?id=443
http://project2612.org/details.php?id=61
http://project2612.org/details.php?id=44
http://project2612.org/details.php?id=16
http://project2612.org/details.php?id=172
Post Reply