(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 01:20 PM
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
WolverineDK

Micro-Goomba


 





Since: 01-14-06
From: Denmark : Baby !

Last post: 6488 days
Last view: 6290 days
Posted on 01-14-06 03:10 AM Link | Quote
Why not make an SPC tracker ? just like nerdtracker is an NSF tracker ? ? ?

Since if you made an SPC tracker, then you could make your own music to the rom.

But perhaps I am writing bullshit. But the idea, is an old idea I have been having in a long while.
d4s

Shyguy








Since: 12-01-05

Last post: 6410 days
Last view: 6307 days
Posted on 01-14-06 06:14 AM Link | Quote
some of this has been answered already, but im gonna comment on some stuff, anyway.

Originally posted by Rom Manic
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.


the spc700 is just a processor, like the snes' main processor, thus its executing a program. what that program does doesnt necessarily have to result in musical notes or even audio, for that matter. the snes sound system consists of spc700 and dsp. the dsp is the chip that actually generates the sound.

in order to play sounds or music on the snes, the cpu first uploads one or more data blocks to the tiny audio ram (64kb) by communicating with the spc700 through the i/o ports.
one of this data blocks contains a program the spc700 starts executing, another one may contain samples and so on.
in order to play music or any sound in general, the spc700 has to tell the dsp when to trigger certain samples at a certain pitch.
how the spc actually does that is entirely up to the programmer.

however, the dsp only accepts samples in brr-format (brr stands for bit rate reduction).
its a lossy compression with a 32/9 compression rate.
it certainly doesnt accept data in mp3 format.
btw, the snes sound chips sport a 1989 copyright and have you seen any post-1991 console that has built-in hardware-support for mp3, anyway?
i doubt it.

Originally posted by Ailura

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.


i made it and that was a tech demo, you werent meant to be able to start the game at all, geez...
btw, i didnt destroy the smw soundsystem, i completely replaced it.
the whole point of that demo was to test how hard it would be to port my music player to another game, nothing more and nothing less.

for the record, im using the very same music player in my bof2 intro, so if you're curious how it works, have a look at that smw demo.

Originally posted by Gideon Zhi
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.


you are right, its no mp3 decoder.
it works like this:
the song is about 6mbits in size, in brr format, and present in the rom file.
the spc sets up a 6kb buffer in the audio ram that, to the dsp, looks like a single looping sample.

basically, this buffer gets constantly rewritten by seperating the song into small chunks that are then uploaded to the spc through the i/o ports every frame, while the dsp is playing the sample.
of course, the timing has to be perfect and you cant afford to loose sync.
and i can tell you that, although im just passing the data through to the spc without actually modifying it (well, apart from setting some flags in the brr data here and there), performance takes a noticeable hit, mostly due to the bottleneck of the i/o ports.
sample rate is around 11khz, but the added echo effects and the low-pass filter make it sound quite nice.

it might just be possible to decode mp3s on the snes using a combination of spc, 65816 and maybe sa1.
however, you have to keep in mind that after decoding from mp3 to pcm, you also have to re-encode the output to brr, otherwise the dsp wont be able to play it back.
imho the snes is one of the worst platforms you could try to write a software mp3 decoder for.

a month ago, i also wrote a pro tracker (*.mod) player for the spc.
turned out quite nice, apart from the fact that choosing the mod format was not so wise in the first place, cause that means 4channels only, amongst various other shortcomings. plus, a few volume change commands still cause a clicking noise, but i'll work that out eventually.
you cant possibly imagine how hard it is to play back samples on the spc without clicking if you havent tried it yourself.
this is one of the major downfalls of the brr format, imho.
also, sample loop conversion is a bitch to get right if you're converting songs.
and the two major emulators (snes9x, zsnes) still dont get the key on, key off regs right, if i might add.
was a major pain to get this player sound right on both the emulators and a real snes.

well, in case anyone is interested, here are two songs in spc file format that use my player:
http://bof2.supernes.de/d4s_spc_mod_player_stuff.zip


i think the song from super battletoads (arcade) turned out quite nice.
cant say that of the ff7 victory tune, though, its absolutely crappy.

its official, i suck at creating music.
i hope youre at least able to recognize that song.
someone more talented would probably make it sound 10 times better than that.

the battletoads song was tracked by someone else, it was a 200kb 8channel fast tracker module before, i just shrunk it down to 4channels and 50kb.


(edited by d4s on 01-14-06 05:22 AM)
(edited by d4s on 01-14-06 05:44 AM)
Stifu









Since: 11-18-05
From: Your mom's bed

Last post: 6289 days
Last view: 6287 days
Posted on 01-14-06 06:56 AM Link | Quote
Those 2 SPC files aren't so bad, d4s.
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-14-06 07:27 AM Link | Quote
Originally posted by MathOnNapkins
My rule of thumb is that 1Megabyte ~= 1 Minute of Playback.

At 128kbps, maybe. But on SNES you can get away with much lower.
Rom Manic









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

Last post: 6287 days
Last view: 6287 days
Posted on 01-16-06 10:11 AM Link | Quote
http://en.wikipedia.org/wiki/MDCT

Thats the compression method for MP3. The SPC-700 might not recognize it, but it's simple mathematics. I'm sure with a properly constructed driver, you could play and MP3 on the SNES.

Unfortunately, the forumla is a little complicated for me to figure out on my own. I would need some math experts to help out on that
d4s

Shyguy








Since: 12-01-05

Last post: 6410 days
Last view: 6307 days
Posted on 01-16-06 12:19 PM Link | Quote
Originally posted by Rom Manic
http://en.wikipedia.org/wiki/MDCT

Thats the compression method for MP3. The SPC-700 might not recognize it, but it's simple mathematics. I'm sure with a properly constructed driver, you could play and MP3 on the SNES.

Unfortunately, the forumla is a little complicated for me to figure out on my own. I would need some math experts to help out on that


hate to say it, but i dont think you've understood how mp3 works at all.
that's a common problem, people without experience in the field of romhacking or programming in general tend to oversimplify things.

"just throw some simple formula and a mp3-file at the spc, piece of cake!"

its not that easy, dude.
im not saying that to diss you, its just the way it is.

i'm no expert on mp3s either, but at least i took a couple of minutes to look up how decoding an mp3 actually works.

the important steps involved in restoring pcm audio from a mp3 bitstream are as follows:

-Huffman decoding
-inverse quantization
-inverse discrete cosine transform (the mdct you referred to is only used in the encoding process, not for decoding mp3 files)
-filter-bank reconstruction from 32 sub-bands (these 32 sub-bands together form the whole audible tonal bandwidth, 60hz-20khz or so)


heres a rough outline of how i understand it, probably not very accurate:

after examining the frame header, the huffman-compressed data needs to be decompressed. this gives you 32 still quantified frequency sub-band lines.

next, you inverse-quantify the sub-band lines to their original size, then create "samples" from these lines using the imdct formula. keep in mind we are still working with 32 different sub-bands that all need to be processed one after another.

finally, these 32 sub-band samples are mixed together into one pcm audio stream using the filter-bank reconstruction.

now, to be able to actually play bank that pcm audio stream on the snes, you have to convert it to the brr format, which requires quantization aswell.

not so easy anymore, is it.


i think decompressing mp3s on the spc700 alone is absolutely out of question, due to the very limited working ram and processing speed, plus lacking features to do fast sine transformations.

what might be possible is having several megabits of external ram on a cart, decompressing the mp3 to that ram in brr format using the cpu, then streaming that brr data to the spc in order to actually play the song. that way, you eliminate the problem of the slow processing speed... if you dont mind waiting several minutes for a song to decompress, that is.

another way of playing back mp3s on the snes would be to have an mp3-decoder on a chip in the cart ( http://www.st.com/stonline/press/magazine/challeng/2ndedi99/chal02.htm ), then feeding its output into the external sound inputs of the snes (only the satellaview and the super game boy do this afair).
of course, youd have to find a way of constantly feeding data into the chip.
all of this is highly theoretical, of course and imho not really feasible.

after all, all youre gaining from preferring streamed mp3s over streamed brrs is saved romspace. although mp3 compresses around 24:1 at a realistic bitrate of 32kbit/s (opposed to around 4:1 for brr), i'd favor a 64mbit rom with 48mbit audio data over a 24mbit rom with additional mp3 decoder chip or endless loading times anytime.

bottom line:
although the idea of playing back mp3s on the snes is nice, its not a particulary feasible one.



Originally posted by Stifu
Those 2 SPC files aren't so bad, d4s.


thanks. =)
maybe i'll improve them one day.
got a whole bunch of other converted mod files playing on the spc here, but i havent yet decided what project i'll actually use the player for.


(edited by d4s on 01-16-06 11:22 AM)
Rom Manic









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

Last post: 6287 days
Last view: 6287 days
Posted on 01-16-06 01:44 PM Link | Quote
So lets try it then. Why bother disproving me, when we could be working together to make this work?

It's a fundamental keystone for making the world of Homebrew work. And not just that, but ROM hacking entirely.
creaothceann

Red Goomba








Since: 11-22-05

Last post: 6483 days
Last view: 6483 days
Posted on 01-16-06 04:37 PM Link | Quote
Originally posted by Rom Manic
So lets try it then.

LOLZ

My old 486-120 was not powerful enough to decode MP3s at 100% realtime. I'm sure you could benefit romhacking more by making modules (MOD, IT, XM etc.) playable on the SNES, rather than wasting your time on MP3s. There would be not enough space & processor time left...
d4s

Shyguy








Since: 12-01-05

Last post: 6410 days
Last view: 6307 days
Posted on 01-16-06 04:53 PM Link | Quote
Originally posted by Rom Manic
So lets try it then. Why bother disproving me, when we could be working together to make this work?

It's a fundamental keystone for making the world of Homebrew work. And not just that, but ROM hacking entirely.


well, i wasnt trying to disprove you just for the sake of it, it bugged me for quite some time how mp3s actually work, so this was a good time to check it out.

as i said, i wont be coding an mp3 player for the snes at all because of the aforementioned reasons.

the brr-streamer i talked about (basically plays back audio files comparable to windows *.wav files with no size constraints) is done. i think i coded that one back in 2004.
you can have a look at it once i release the breath of fire 2 translation patch, its featured in the intro. http://bof2.blogspot.com
sorry, no preview demos/patches.

if you are eager to test it out, i could upload the smw demo with the two guys singing i made some time ago, you want it?

however, it didnt yield any noteworthy impact and i really wasnt expecting anything else.
that would probably change if people were actually able to put their own music files in the game, but its not as easy as it sounds, unfortunately.

besides, when i code cool stuff, i usually use it in my releases first, then consider releasing it for everybody to use.

i posted examples of the modplayer i coded a month ago earlier in this thread, but as i said, i dont even have a real project to use it on.
it just wanted to have a stand-alone alternative to the brr-streamer that doesnt take away any performance from the cpu (runs completely on the spc).
besides, there are so many mod-tunes that im in love with, especially chiptunes. =)
just had to be able to play them back on my favorite console, the snes.



(edited by d4s on 01-16-06 03:58 PM)
(edited by d4s on 01-16-06 04:02 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.018 seconds; used 406.23 kB (max 508.02 kB)