Replace music .spc with .mp3 music (load mp3 files)

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

snesfanbongo
New Member
Posts: 5
Joined: Fri Jan 15, 2010 11:54 am
Location: germany

Replace music .spc with .mp3 music (load mp3 files)

Post by snesfanbongo »

Would it be possible to use own mp3 music to replace a games music which is spc files? For example to have a game Game.snes which consists of:
gamecomponent1.xy
.
.
.
gamecomponentX.xy
music1.spc
music2.spc
.
.
musicX.spc
soundeffect1.spc
.
.
.
soundeffectX.spc

It would be great to have a folder with music in mp3.
Then zsnes checks if there is an replacement for spc file and
plays the mp3 track instead.

For example in Actraiser, to use the Orchestrated Versions instead
of the original .spc. The game and soundeffects itself should be the
same as before... Something like load high resolution textures in other
emulators (N64), sound-wise.....

Would be absolutely great....
Possible?
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

Not possible without game/revision specific hacks and I doubt many people want to work on that.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
snesfanbongo
New Member
Posts: 5
Joined: Fri Jan 15, 2010 11:54 am
Location: germany

Post by snesfanbongo »

Isn't the information enough which .spc file is for what level and then just throw the mp3 files with the same name in a mp3 folder? Without touching/hacking the actual game file. The only additional information should be which .spc files are inside the .smc game file and for what level they are. ZSNES audio engine plays the file with the same name, if there is none uses the .spc file. Ok, someone has to find out the names of the .spc files and for what level they are inside the game.
kode54
Zealot
Posts: 1140
Joined: Wed Jul 28, 2004 3:31 am
Contact:

Post by kode54 »

You may want to take a look into bsnes with its 21fx component, which has already facilitated replacing in-game music with CD quality audio. Yes, this still requires game-specific hacks.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

snesfanbongo wrote:Isn't the information enough which .spc file is for what level
ZSNES has no idea about levels, it just plays the data.

For the 21fx extension see this link: http://board.byuu.org/viewforum.php?f=16
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

creaothceann wrote:ZSNES has no idea about levels
Nothing has any idea about levels.

Except maybe UOSNES.


snesfanbongo wrote:which .spc files are inside the .smc
Doesn't Work Like That (TM)
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
badinsults
"Your thread will be crushed."
Posts: 1236
Joined: Wed Jul 28, 2004 1:49 am
Location: Not in Winnipeg
Contact:

Post by badinsults »

I'll tell you, I think it would be pretty awesome to use the 21fx to put the actual music into Rock N Roll Racing.
<pagefault> i'd break up with my wife if she said FF8 was awesome
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

I'm sure these additions will make Pit Fighter an even better game. :wink:
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
SquareHead
Veteran
Posts: 970
Joined: Fri Jan 21, 2005 11:15 am
Location: Montana, United States

Post by SquareHead »

badinsults wrote:I'll tell you, I think it would be pretty awesome to use the 21fx to put the actual music into Rock N Roll Racing.
Damn that brings back memories, a few friends and I would have marathons with that game. I had those distinct 4 songs stuck in my head forever. That and the announcer.
Deathlike2 wrote:I'm sure these additions will make Pit Fighter an even better game. :wink:
I should have seen that coming. :lol:
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

SquareHead wrote:
Deathlike2 wrote:I'm sure these additions will make Pit Fighter an even better game. :wink:
I should have seen that coming. :lol:
I don't even know why I borrowed the game from a friend in the first place.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

badinsults wrote:I'll tell you, I think it would be pretty awesome to use the 21fx to put the actual music into Rock N Roll Racing.
Deathlike2 wrote:I'm sure these additions will make Pit Fighter an even better game. :wink:
- Lost Vikings II: voices from the PC game
- Mortal Kombat: Unreal Tournament announcer
- Secret of Mana: music that isn't affected by sound effects
- replacing the game's with the film's music: Aladdin, Blues Brothers, Jungle Book, Jurassic Park, Star Wars
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Johan_H
Starzinger Addict
Posts: 998
Joined: Tue Aug 17, 2004 1:14 pm
Location: Sweden
Contact:

Post by Johan_H »

-Gundam Wing: Endless Duel, opening music from the cartoon.

Actually no, the SNES version is way better.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Doing this is certainly possible without hacking the game.

If you had a file setup which linked certain audio files with certain SPCs, we can check to see when those SPCs are loaded into memory, and output something else.

I don't think it'll be pretty though.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
byuu

Post by byuu »

This honestly seems almost as hard to me as the famed "hires graphics replacment" and "hardware accelerated PPU" discussion threads.

Remember the guy who made the rumble support for SNES games on Zsnexbox? Instead of hacking the games (the right way), he added address watches and write counters. Caused all sorts of fun side effects. Let the intro loop and the pad starts rumbling, skip the intro and the rumbling doesn't work for a few seconds. Rumbling happens on unrelated events between level transitions. And that was the easy part, not much more complex than a Game Genie code.

Matching exact memory may not even be possible, the existing playback of other files may change APURAM, especially in the echo buffer region. It wouldn't work between versions with core changes, it definitely wouldn't work between emulators.

Any attempt to narrow down all of the variables would result in needing per-game code. In which case, it is honestly really easy to add to existing games via hacking. Any ROM hacker could do it. The below code took about an hour to make, and replaces all audio tracks in the entire game with external music instead.

Code: Select all

org $36822b; jml test; nop

org $408000

test:
  cmp #$02; beq .play
  cmp #$04; beq .stop

.ignore:
  php
  phb
  phd
  sep #$20
  jml $368230

.play:
  tya; sta $0021f1
  lda #$01; sta $0021f0
  -; lda $0021f0; bvs -
  lda #$01; sta $0021f1
  lda #$03; sta $0021f0
  rtl

.stop:
  lda #$02; sta $0021f1
  lda #$03; sta $0021f0
  rtl
Sound amazing, too. This game has an orchestral CD for it that is ten times better than the SNES version.

But nobody's going to bother doing it unless the mainstream emulators support it. Then again, thanks to new leadership, we managed to get UPS support into Snes9X, so you never know. Need Super Game Boy support first so I can piggyback on the audio mixing code.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Nach wrote:we can check to see when those SPCs are loaded into memory
No, we can't. How hard is it to understand that dammit.

Reread how it's done. And then look at Lost Vikings and EWJ2 and MARIO PAINT.

No.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Rashidi
Trooper
Posts: 515
Joined: Fri Aug 18, 2006 2:45 pm

Post by Rashidi »

Nach wrote:we can check to see when those SPCs are loaded into memory
suppose that can be done,
how about spc(s) that 'can not dump-ed properly' ( such as FEDA' ) ?
snesfanbongo
New Member
Posts: 5
Joined: Fri Jan 15, 2010 11:54 am
Location: germany

Post by snesfanbongo »

byuu wrote:In which case, it is honestly really easy to add to existing games via hacking. Any ROM hacker could do it. The below code took about an hour to make, and replaces all audio tracks in the entire game with external music instead.

CODE

Sound amazing, too. This game has an orchestral CD for it that is ten times better than the SNES version.
So with changes in the rom via a rom hacker its possible to redirect calls to spc-files to user defined mp3-files? Where is the external music located? In the rom file by itself? Is it possible for the emu to play this different codec? (if its mp3 or wave?)
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Read the "21fx" threads here: http://board.byuu.org/viewforum.php?f=16
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
byuu

Post by byuu »

Once I have the API and specs finalized, I'll start putting up some UPS patches that can do this for the most popular games.

> So with changes in the rom via a rom hacker its possible to redirect calls to spc-files to user defined mp3-files?

Yes. Not only possible, but trivial for most games. Streaming audio games present a greater challenge, but make up less than 1% of SNES music.

> Where is the external music located?

On the hard drive as external files. Right now, they are stored as 2-channel 44KHz PCM files. One file per audio track, numbered numerically:

game.sfc
game.msu
game-01.wav
game-02.wav
...

An emulator could cheat and use 5.1-channel surround sound @ 32-bit 96KHz, but a real hardware design would require a separate audio output jack on the cartridge. Doesn't really matter, the game modifications are the same regardless; and let's not kid ourselves, slim to none chance actual hardware version will be made unless I save up and go to college to learn EE.

game.msu is for the video and whatever else you want. File size is dynamic, anything from 0 bytes to 4GB.

Exact naming conventions may change, working on that now.

> Is it possible for the emu to play this different codec? (if its mp3 or wave?)

I use PCM (WAV) files. MP3 support is easy enough, but adds an annoying patent-encumbered dependency. I'd prefer to distribute MP3s with a simple copy of LAME and a batch file to spit out waves.

It matters not to me if someone else adds direct MP3 support.

The emulator plays the music in real-time, mixed in to the SNES' internal music stream. So even if you run in slow motion or fast forward, the sound is still consistent and matches sound effects and action in-game.
snesfanbongo
New Member
Posts: 5
Joined: Fri Jan 15, 2010 11:54 am
Location: germany

Post by snesfanbongo »

Sounds really, really good. I'm looking forward to have this great feature. If this gets really implemented, i will be playing lots of classics again. Now i have to check my game soundtrack collection.....
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

snesfanbongo wrote:Sounds really, really good.
Yes, it does. :)
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

grinvader wrote:
Nach wrote:we can check to see when those SPCs are loaded into memory
No, we can't. How hard is it to understand that dammit.
How hard is it to understand that we can?

We have code which dumps SPCs, we'd need to have it running constantly in the background. When it finds the SPC it can dump matches a particular SPC on file, we can mute ZSNES normal SPC output, and play up whatever audio file in the background.

But like I said above, this won't be pretty. Getting sound effects aside from the music to play will be nothing short of a nightmare.

I imagine we can run two cores simultaneously in the background, one with just the SPC music from file, and the other the actual emulated game, and whenever there's a difference in the two, output from the main emulated game one. But this certainly won't work for every game. It will also cause a lot of issues with in between BGMs, not to mention slow the whole thing way down.
Rashidi wrote:
Nach wrote:we can check to see when those SPCs are loaded into memory
suppose that can be done,
how about spc(s) that 'can not dump-ed properly' ( such as FEDA' ) ?
As long as we have a unique dump of whatever it is being streamed, we can alter the BGM. What we have may or may not be unique across the game. However, since audio is streamed, it won't allow us to differentiate between background music and sound effects.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Nach wrote:We have code which dumps SPCs, we'd need to have it running constantly in the background. When it finds the SPC it can dump matches a particular SPC on file, we can mute ZSNES normal SPC output, and play up whatever audio file in the background.
have fun handling those that start playback before the whole data is uploaded and thus don't match any 'full' SPC file, those streamed where every second has different samples in most channels, and those that are built in ram by the game and there's nothing to compare them to.

Feel free to try, I'll watch from there with the popcorn.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

grinvader wrote:
Nach wrote:We have code which dumps SPCs, we'd need to have it running constantly in the background. When it finds the SPC it can dump matches a particular SPC on file, we can mute ZSNES normal SPC output, and play up whatever audio file in the background.
have fun handling those that start playback before the whole data is uploaded and thus don't match any 'full' SPC file
In those cases, it won't replace until the whole thing is uploaded.
grinvader wrote: those streamed where every second has different samples in most channels, and those that are built in ram by the game and there's nothing to compare them to.
I covered that already in my last post.
grinvader wrote: Feel free to try, I'll watch from there with the popcorn.
I have no intention of trying. I'm just saying it's theoretically possible, and would be interesting to see, not that I'm actually interested in the feature.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
snesfanbongo
New Member
Posts: 5
Joined: Fri Jan 15, 2010 11:54 am
Location: germany

Re: Replace music .spc with .mp3 music (load mp3 files)

Post by snesfanbongo »

Hello guys,

so it looks unrealistic, that this feature will ever be implemented? I think it would bring much more to the
game experience than any filter 2x, 3x,4x.... I was satisfied with the visual long time ago. I have
so many great orchestrated soundtracks waiting to be used in their origin games....
Please help....
Locked