1, 2, 3, 4, 5 ... 12  Next
MSU-1 audio mixing levels 
Author Message
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 MSU-1 audio mixing levels
I know I've seen this mentioned elsewhere, but I can't remember where now that I think of it. In higan, the audio mixing for the MSU-1 and SPC doesn't seem to produce the result I would expect. Specifically, I used higan for volume leveling the audio tracks for my MSU-1 aLttP soundtrack pack, and what I found was that when I got the background tracks to match up volume-wise, it resulted in SPC sound effects being much quieter in the MSU-1 version than in the original. I can have two higan windows open at the same time, one with the original game and one with the MSU-1 hack, and when I switch between them, the background music is the same volume, but the sfx like swinging the sword and such are a lot quieter in the MSU-1 version. I've also gotten reports that on the SD2SNES, my audio tracks are actually too quiet, which is basically the exact opposite result (though, in that case it's actually due to the volume level of my files, since the SPC level wouldn't have changed at all, it's just that the audio files really are too quiet).


I would be more likely to side with the SD2SNES implementation on this, as the SPC volume level should have been unchanged, but in higan that doesn't seem to be the case. I know there's a laundry list of projects before you can work on higan again, but now that there seems to be more interest in the MSU-1, this is something that should probably be taken care of so that higan performs the same as the real hardware. I know that higan is considered the canonical implementation, but since this appears to be on the analog side and not a question of the chip spec (and also because it seems to legitimately be an issue with higan), my personal thought is that specifically for this, higan should be made to work like the SD2SNES, rather than the other way around.

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2014-12-01 22:17
User avatar

Joined: 2014-09-25 13:52
Posts: 8294
 Re: MSU-1 audio mixing levels
The problem is that I really don't know how to do optimal sound mixing. I know of only two strategies:

A:
sample = max(-32768, min(+32767, A + B))


This has the problem of clamping. When I mix sound channels like this, the output sounds pretty terrible.

B:
sample = A / 2 + B / 2


This has the problem of cutting the input volume in half for each input channel. But it's the only way to get around the clamping effect that I know of.

I use option B in higan, and that's why the SNES SPC volume is halved in SGB and MSU1 modes.

> higan should be made to work like the SD2SNES, rather than the other way around.

higan should be made to work like real hardware. I don't know what sd2snes is doing when it mixes audio, or how that might interfere.

What we need is someone with professional sound testing abilities to connect L/R audio sources to the SNES cartridge connector pins, and then record the sound levels between the SNES sounds and the cartridge pin sounds on the multi-AV sound output lines. We should then match those levels under emulation.

_________________
What the hell's going on? Can someone tell me please?
Why I'm switching faster than the channels on TV.
I'm black, then I'm white. No, something isn't right.
My enemy's invisible, I don't know how to fight.


2014-12-01 23:24
User avatar

Joined: 2014-09-27 09:23
Posts: 2201
Location: Germany
 Re: MSU-1 audio mixing levels
I have no idea about audio processing, but what about

Code:
sample = max(A, B)

?

_________________
My setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → Multi Out to SCART cable → EuroSCART to Mini cable → Framemeister (with Firebrandx' profiles) → AVerMedia Live Gamer Extreme capture unit → RECentral 4 viewing/recording software


2014-12-01 23:45
User avatar

Joined: 2014-09-25 13:52
Posts: 8294
 Re: MSU-1 audio mixing levels
No, that would not work at all on any level. The audio would sound like pure trash.

_________________
What the hell's going on? Can someone tell me please?
Why I'm switching faster than the channels on TV.
I'm black, then I'm white. No, something isn't right.
My enemy's invisible, I don't know how to fight.


2014-12-02 00:06
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: MSU-1 audio mixing levels
Technically, if the mixing is done in the analog domain on hardware, then summing (and, as a result, clipping) is exactly how it's done.

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2014-12-02 00:48
User avatar

Joined: 2014-09-27 10:02
Posts: 321
 Re: MSU-1 audio mixing levels
What about
sample = A + B
? Surely when A, B elem uintN_t and sample elem uintN*2_t, that should work?

Also, check out this StackExchange thread.

cYa,

Tauwasser


2014-12-02 00:50
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: MSU-1 audio mixing levels
Another option you might try is

Code:
if(a < 0 && b < 0) {sample = (a + b) - (ab/MIN);}
else if(a > 0 && b > 0) {sample = (a + b) - (ab/MAX);}
else {sample = a + b;}


source

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2014-12-02 01:01
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: MSU-1 audio mixing levels
Tauwasser wrote:
What about
sample = A + B
? Surely when A, B elem uintN_t and sample elem uintN*2_t, that should work?

Also, check out this StackExchange thread.

cYa,

Tauwasser


The problem is that sample *isn't* twice the resolution of the input. I'm not sure what bit depth the SPC emulation is using, but the MSU-1 tracks are 16-bit, and I know the final output is 24-bit at most.

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2014-12-02 01:04
User avatar

Joined: 2014-09-27 10:02
Posts: 321
 Re: MSU-1 audio mixing levels
qwertymodo wrote:
Another option you might try is [...]


Bad idea, see the thread I linked to. This will result in ringing effects.

qwertymodo wrote:
I'm not sure what bit depth the SPC emulation is using, but the MSU-1 tracks are 16-bit, and I know the final output is 24-bit at most.


So that just means you got half the headroom an optimal implementation would have. That doesn't sound like that big of a deal considering you're not running into it all the time and it has to clamp somewhere.
I should also note that the processing bit depth of the S-DSP might not be its output bit depth.
The SPC format is probably emulated relatively accurately considering it shares RAM with the S-DSP? So sample bit depth there should be known and fixed.

EDIT: I just found the article about BRR. Fuck it, that shit is compressed ~4:1 anyway... And I just took a quick look at the schematic again. So that's compressed 16 bit samples going in, 16 bit DAC values coming out. Should be relatively easy to actually determine bit depth and clamping behavior using test inputs.
Also, why can the S-DSP write to sample RAM? Could this be abused to process data and write it back uncompressed to RAM so all it needs is a test program on a flash cart?

cYa,

Tauwasser


2014-12-02 01:38
User avatar

Joined: 2014-09-27 09:56
Posts: 1688
 Re: MSU-1 audio mixing levels
The thread you posted listed A + B - AB, which is not the same as what I posted. What I posted has far less prominent artifacting, and definitely not full-swing ringing like A + B - AB.

_________________
byuu wrote:
Surely I can unite the vi vs emacs crowd like I have the ZSNES vs Snes9X crowd :)



higan WIP builds available here


2014-12-02 02:12
1, 2, 3, 4, 5 ... 12  Next