(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-07-24 09:07 AM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - A revelation I've had... New poll | |
Pages: 1 2Add to favorites | Next newer thread | Next older thread
User Post
Rom Manic









Since: 12-18-05
From: Detroit, WHAT?!

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 10:43 AM Link | Quote
The SPC-700 on the SNES is what processes each sound coming through the SNES. Although it is onboard the motherboard, it is completely independent of the rest of the components. It has it's own instruction set, and it has the capacity to play 8 voice samples simultaneously.

It has been long believed by me that each byte passing through the SPC-700 represents a musical note to be played in a specific manner. This is an undeniable fact.

But it dawned on me recently that perhaps the term "Sample" can have many contexts.

Therefore, I theorize that it is possible to have an MP3 play on the SPC-700. If you could insert an MP3 file into a Rom, then save that file, you would therefore be able to locate it, and identify each byte of the music file you inserted. Then you could hack your Rom to send each byte sequentially to the SPC-700, and therefore play the MP3.

This probably won't work on an emulator, simply because of the fact that it probably doesn't emulate the SPC-700 properly. But if I'm right, you could put the file onto a blank cart and try it on a real SNES.


(edited by Rom Manic on 01-12-06 09:44 AM)
DahrkDaiz

Nipper Plant
U wan hax Mario?!








Since: 11-17-05

Last post: 6289 days
Last view: 6288 days
Posted on 01-12-06 11:09 AM Link | Quote
Theoretically you can play any sound format on any system, it's all about writing the proper decoder for the compression format, be it mp3, avi, wma, or what have you, but the quality will not be the same.
Ailure

Mr. Shine
I just want peace...








Since: 11-17-05
From: Sweden

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 11:12 AM Link | Quote
I don't think MP3 will run too well on a SNES, unless it's of a wierd quality or something. It's possible, but it would waste too much CPU on the poor SNES. Although, yes it's possible to replace music with "wavefiles" or whatever you call it. Someone did that awhile ago with SMW, although it kinda destroyed the SMW soundsystem so the only song in the whole hack was "Mario twins".

It worked excellent, as long you didn't start the game. But yeah... I forgot who made it.

Keep in mind, I have no idea how MP3 compression works. But if it uses wierd mathemetical formulas, such as divide (which the SNES lacks native support for) don't expect anything too great.
Rom Manic









Since: 12-18-05
From: Detroit, WHAT?!

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 11:20 AM Link | Quote
Well basically MP3 is compressed by a methematical algorithm, subtracting an integer of 1 from any set value, I think. You can read up on MDCT or MCDT, whichever it's called. That is the compression algorithm.

You can also bring back the sound quality to 1407 kbps by adding an integer of 1 to the values we subtracted from. But keep in mind that for a SNES game, you probably won't need very many samples going in there, and therefore you could probably use a compression quality of 65 kbps or something.

EDIT: By samples I mean the different sound loops in the music file.

This works especially well with a small loop, like a snare and bass kicker drum roll.

However, I'm sure a format like WAV or something small like that would be best. I'm not even sure if my method I theorized works. It just makes sense, since the SPC-700 was designed to play samples. It could be mandadtory they be compiled into SPC format, which makes it even more imperative someone get their hands on the Super NES Emulator SE program so we can figure out how to compile it that way...


(edited by Rom Manic on 01-12-06 10:22 AM)
DJ Bouche

Koopa


 





Since: 11-22-05
From: Bligh Park, NSW, Australia

Last post: 6450 days
Last view: 6450 days
Posted on 01-12-06 12:22 PM Link | Quote
I don't think neither 65c816 or SPC-700 is capable enough of decoding MP3 into BRR at the required speed, however it could be done by something else (ie, not a SNES) and possibly streamed into the SPC-700's i/o ports with an SPC-700 program coded to handle that.
creaothceann

Red Goomba








Since: 11-22-05

Last post: 6482 days
Last view: 6482 days
Posted on 01-12-06 12:51 PM Link | Quote

[...] As you can see, the SPC uses 16-bit waveforms. There is enough space in 32K to store 58,240 samples using this compression method about 4 seconds at 14.4 KHz (sorry, there's not quite enough space to do a real good CD quality sound track), ah, but then there's always the cartridge memory (24 MBits would hold 5.5 million samples - since the transfer gets a speed faster than playback you could double buffer and send stuff this way - this would give you about 6.5 minutes of digitized sound at CD quality in monaural recording. Stereo would halve these times).

http://www.alpha-ii.com/snesmusic/files/spc700_documentation.html

It's certainly possible, IMO - but then the SNES would become just a player. It doesn't have the power to do much with sound, hence the whole APU section with its co-processor.
Rom Manic









Since: 12-18-05
From: Detroit, WHAT?!

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 01:08 PM Link | Quote
14.4 khz isn't so bad. We have to remember that a CD quality soundtrack can take up at least 60 megs or more at 192 kbps and 44 khz. So trying to minimize the quality would mean you have to simplify the samples within a track.

I think it would be interesting to write a demo to try this. Assemblers can insert files and compile the code into 65816 format, no? just write some code to play the bytes pertaining to the file and voila...DRM would work good too eh?
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 01:15 PM Link | Quote
Okay, have fun trying . I don't really know where you go to find info about decompressing MP3 data.
Gideon Zhi

Keese








Since: 12-05-05
From: ...behind you! Boo!

Last post: 6290 days
Last view: 6287 days
Posted on 01-12-06 01:17 PM Link | Quote
It's been done. Couldn't tell you how, but you could always ask
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6287 days
Last view: 6287 days
Posted on 01-12-06 01:38 PM Link | Quote
I had a creeping feeling someone was going to mention that. But I couldn't remember if it was an MP3 decompressor specifically. Although he offers an mp3 on the site, I doesn't really give technical details on what goes on in the game image.
Gideon Zhi

Keese








Since: 12-05-05
From: ...behind you! Boo!

Last post: 6290 days
Last view: 6287 days
Posted on 01-12-06 02:28 PM Link | Quote
I don't think it's an actual MP3 decoder, I'm not sure that the 65c816 or SPC700 is fast enough for that. I think what he did was break the MP3 down into samples which he dynamically strung together, similar to what happened with Tales of Phantasia's opening song.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6288 days
Last view: 6288 days
Posted on 01-12-06 09:46 PM Link | Quote
I wonder if an expansion chip such as SA-1 could decompress MP3s at a reasonable speed? Really, the only things stopping you are being able to decompress the file fast enough, and having enough RAM for the decompressed sample that's being played.

Speaking of sound though, there's one thing I never quite got. Most consoles offer multiple sound channels, for example, the Game Boy can play 2 solid tones, a really small wave sample, and static all at once. But in the end, this all gets mashed together and comes out one speaker. A single speaker can't produce multiple frequencies at the same time, so this must mean the different sounds all get mixed into one. Does this not mean, then, that any sound can be reproduced using only one channel? To further support this, you can play all of these sounds at once and record them with a microphone... surely the mic can't split it back into 4 separate sounds. So if this is the case, why are multiple channels even necessary?
labmaster

Red Paragoomba


 





Since: 11-18-05
From: Away for exams, back mid-December.

Last post: 6363 days
Last view: 6293 days
Posted on 01-12-06 10:15 PM Link | Quote
Saves having to have software mix them (using up precious CPU time), I guess.
Disch

Red Cheep-cheep


 





Since: 12-10-05

Last post: 6567 days
Last view: 6567 days
Posted on 01-12-06 10:34 PM Link | Quote
Originally posted by HyperHacker
Does this not mean, then, that any sound can be reproduced using only one channel?


Yes. That is what complex waveforms are -- what .wav, .mp3, .ogg, etc files represent. They represent the final, single sound wave which gets output to your speaker. (though they may actually contain 2 waves if stereo -- or more if multichannel).

Originally posted by HyperHacker
A single speaker can't produce multiple frequencies at the same time, so this must mean the different sounds all get mixed into one.


Multiple waves? No. Multiple frequencies? Absolutlely.

Complex waveforms contain individual waves of various frequencies.

For instance... say you have a wave playing a 400Hz square wave: 0000444400004444...
or for a crude visual:



And lets say you also have a wave playing a ~220Hz wave: 0000000444444400...
crude visual:


They both look simple enough... now when you mix them together you're left with something like:
0000444400004444000044440000444400004444 <-- 400Hz
0000000444444400000004444444000000044444 <-- ~220Hz
-------------------
0000444844448844000048884444444400048888 <-- complex wave containing both 400Hz and 220Hz

Another crude visual:



Originally posted by HyperHacker
So if this is the case, why are multiple channels even necessary?


Well look at that image of a complex waveform I just gave as an example. or look at the number pattern I gave. Complex waveforms are exactly that... "complex". Simple computers would have a hell of a time trying to generate them on the fly.

Keep in mind that back in the day, computers did not have the processing power or memory they do now, and working with raw PCM would be very expensive cpu wise.

Now consider your alternatives on an old system like the NES. CPU time is thin... memory is low -- so working with raw PCM would just be completely out of the question. So what they did to allow games to use music is they made these sound channels -- each which would just repeat a simple waveform (square/tri/saw... whatever). That kind of thing is very easy to do in hardware (all you need to do for a square wave is make it alternate between X and 0 -- where X is the desired volume and ta-da -- a tone!).

So now to play a sound all the game has to do is tell the sound hardware what tone it wants to play -- much more preferable to a game having to spend all it's CPU time feeding the sound hardware hundreds of thousands of bytes to build a sound-wave.

But of course these channels can only repeat 1 pattern.... and 1 pattern = 1 tone. That wouldn't allow for very interesting music... or very good sound effects... so they give you a few channels -- all of which can operate independently. Each channel by itself plays a very simple waveform... but once they're mixed it's very complex



(edited by Disch on 01-12-06 09:35 PM)
(edited by Disch on 01-12-06 10:05 PM)
(edited by Disch on 01-12-06 10:43 PM)
Rom Manic









Since: 12-18-05
From: Detroit, WHAT?!

Last post: 6287 days
Last view: 6287 days
Posted on 01-13-06 10:15 AM Link | Quote
Is there no other chips on the motherboard that might hint at some MP3 decompression techniques? Maybe chips that haven't been thoroughly analyzed yet?

PS: I need a copier and a blank cart. If anyone has one, PM me.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6288 days
Last view: 6288 days
Posted on 01-13-06 10:25 AM Link | Quote
Thanks, that new pic explains it well.
Rom Manic









Since: 12-18-05
From: Detroit, WHAT?!

Last post: 6287 days
Last view: 6287 days
Posted on 01-13-06 11:24 AM Link | Quote
You know, the MP3 format was created in 1991, the same year as when the Super Nintendo was first shipped to the US and North America. Although the dates might be really close, Nintendo was probably on to this new compression technology by the time it was shipped to North America.

So perhaps Mp3 is out fo the question. But there must have been other formats prior to this...Unfortunately, I don't know where exactly to look. But if we could find out, I'm sure conversion between the two would be simple.

Of course, my original theory still remains possible. Probably not on PAL machines, but a later version like the NTSC one.
Xkeeper
Took the board down in a blaze of glory, only to reveal how truly moronical ||bass is.


 





Since: 11-17-05
From: Henderson, Nevada

Last post: 6287 days
Last view: 6287 days
Skype
Posted on 01-13-06 11:24 AM Link | Quote
Ice Man, give up; there is NOTHING you are going to find, for one reason:

The SNES was created (or, at least, avaiable) on November 21, 1990.

The MP3 format was invented and standardized in 1991.

Unless the creators of the SNES could see the future, you lose.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6287 days
Last view: 6287 days
Posted on 01-13-06 07:56 PM Link | Quote
That's not Ice Man, that's Spliff .

Unless anyone is willing to research mp3 or ogg and implement it to see if it could work, I don't see the point of us discussing this. My rule of thumb is that 1Megabyte ~= 1 Minute of Playback. The maximum cart size is 6Megabytes. Hence, you might get really high quality audio but what's the point? That also ignores the space you would need for the complex decompression code, and the code to be inserted into the SPC700, all of which would have to be stored in one or more banks of ROM.

If you care enough about doing streamed audio, talk to d4s or maybe disassemble Tales of Phantasia to see what's going on.
Guy Perfect









Since: 11-18-05

Last post: 6289 days
Last view: 6287 days
Posted on 01-13-06 10:00 PM Link | Quote
It only requires a PCM channel capable of playing buffers sequentially without breaks. Just like any other computer would do it. I don't know if the SPC-700 can do that or not, but I'd be willing to bet it could.

Of course, since there's no hardware support for PCM files, some kind of sotfware codec would be needed as an intermediary between the OGG/MP3 file and the SPC-700 chip.



Oh, and OGG Vorbis can do CD quality audio at about 775 KB/min, FYI.


(edited by BGNG on 01-13-06 09:01 PM)
Pages: 1 2Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - A revelation I've had... |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.053 seconds; used 454.15 kB (max 583.23 kB)