SNESMusic.org Forums

http://snesmusic.org/v2/
It is currently Mon Jul 16, 2018 2:48 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Mar 14, 2018 6:07 pm 
Offline

Joined: Wed Mar 14, 2018 5:31 pm
Posts: 3
hi!

some snes games feature soundtracks that have a very distinct effect. in tracker terms, I've seen it called "surround mode"

it sounds like this:
https://www.youtube.com/watch?v=xJF19947zcQ

or, if your mixing the song to a mono output, it sounds like this:
https://www.youtube.com/watch?v=g4mHPeMGTJM

it's really annoying!

I looked into it, and this is possible because every channel has a different volume level for left and right output...and that value is a signed number.
if the signs are flipped, the phase is completely inverted and you get that "surround" effect.

so...if I want to remove that effect, I just need to make sure that the volume registers are all positive.
which means I only need to change 1 bit in 16 places. EZ right?
except nope the SPC format doesn't work like that.

I've tried digging around for a tool that does this, but have had no luck.

is there an option in snesamp that I missed that will solve this for me?

Do I need to build a copy of snesamp for myself?


Last edited by anosci on Thu Mar 22, 2018 11:47 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 20, 2018 3:15 pm 
Offline
Moderator

Joined: Tue Oct 05, 2010 4:17 pm
Posts: 867
This is sound driver-dependent... but if you were to not hack every single SPC, then you would AND the volume values by 0x7F.

_________________
Just consider me your friendly SPC dumper. Also a bit of a perfectionist (though not too literally)... I make sure my dumps are at the first note. I might even hack away the SFX if needed.

Want a music modifier for a particular SNES game? All you need to do is ask via PM (or you can check out the Music Modifiers topic and post there) and I'll be on the job. ^_^

SPC Set Progress Log


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 22, 2018 11:59 pm 
Offline

Joined: Wed Mar 14, 2018 5:31 pm
Posts: 3
so....rebuild snesamp.

I actually had some success with this:

https://www.alpha-ii.com/Source/index.html

despite all of the weirdness, I'm able to get a compiled version of SNESAPU.DLL, which I can safely swap out with whatever instance of SNESAmp I want.

the issue is that all of the emulation code is written in x86 Assembly, which I can not make heads or tails of. I know what to change but I have no idea where.

any advice?


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 25, 2018 9:54 pm 
Offline

Joined: Wed Mar 14, 2018 5:31 pm
Posts: 3
ISSUE RESOLVED

Instead of dealing with a byte mask for the APU registers, I just applied an absolute value function to all of the voices as they were being mixed down. (in the floating point block of code)

here's the link to the source again: https://www.alpha-ii.com/Source/index.html

in DSP.Asm scroll down to line 5757 or so, then make these two changes:

Code:
Test    byte [EBX+mFlg],MFLG_MUTE
JNZ .VoiceOldCode
;Apply channel volumes ---------- NEW VER
FLd  ST
FLDZ
FAdd dword [EBX+mChnR]
FABS
FMulP ST1, ST
;second half
FXCh ST1
FLDZ
FAdd dword [EBX+mChnL]
FABS
FMulP ST1, ST
;end
Jmp .VoiceSignBlockEnd

.VoiceOldCode:
;Apply channel volumes ----------
FLd ST
FMul    dword [EBX+mChnR]
FXCh    ST1
FMul    dword [EBX+mChnL]
.VoiceSignBlockEnd:

and further down, just fix the entire master volume. if you want to set it back to "surround" there's an option in SNESAmp for that
Code:
;Multiply samples by main volume ------ NEW VER
FLd dword [ESI]
FLDZ
FAdd dword [volMainL]
FABS
FMulP   ST1,ST
FStP    dword [EDI]
;second half
FLd dword [4+ESI]
FLDZ
FAdd dword [volMainR]
FABS
FMulP   ST1,ST
FStP    dword [4+EDI]

(hopefully it's obvious where these go)

compile that and put the new DLL in the same directory as your SNESAmp plugin, and you're good to go.

Set the mixing to "Stereo" for normal/"accurate" mixing, and the nset it to "Stereo(HQ)" for when you want all the "surround" stuff disabled. (with the ability to re-enable them via channel muting)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group