BlueMSX core: PSG sound incorrectly defaults to stereo separation

Hi,

First of all, thanks for the great Libretro/Retroarch. As an MSX fan I was joyed to see the BlueMSX core, and hope to see this core developed up to the feature level of the standalone version.

In that respect there’s the following issue with the current core that I hope one of the authors can take a look at. The libretro BlueMSX core has stereo separation for the PSG (AY8910) soundchip enabled by default. Unfortunately this is completely opposite to the MSX standard, which is mono. And the PSG chip being only 3 channels, having stereo separation on sounds wrong for many games.

Note that the stereo feature was introduced with BlueMSX 2.8.3 just to accommodate some -very rare- machine configurations, but should definitely not be the default behaviour for the MSX, as 99% of MSX machines out there have mono PSG sound.

If you look at the attachment picture of the blueMSX GUI, you see that it’s an option that can be turned off/on in machine configurations in BlueMSX standalone. Saving it leads to below setting in the machine configuration file:

[AUDIO]
PSG Stereo=0
PSG Pan channel 0=center
PSG Pan channel 1=left
PSG Pan channel 2=right

Adding this to any of the “MSX” or “MSX2+” configuration files in the retroarch “system/machines” doesn’t change the behaviour for libretro bluemsx so I gather this needs a code modification.

Hopefully one of the authors can create some time for this one, and have the “PSG Stereo” variable set to 0 (mono) by default for the BlueMSX core.


Hi,

I did a little bit more investigation.

The PSG Stereo ON/OFF toggle in BlueMSX is normally set by reading the machine config. See the code at line 300 in Src/Board/Machine.c https://github.com/libretro/blueMSX-libretro/blob/master/Src/Board/Machine.c Specifically this part:

// Read audio info
    iniFileGetString(configIni, "AUDIO", "PSG Stereo", "none", buffer, 10000);
    if (0 == strcmp(buffer, "none")) machine->audio.psgstereo = 0;
    else if (0 == strcmp(buffer, "0")) machine->audio.psgstereo = 0;
    else if (0 == strcmp(buffer, "1")) machine->audio.psgstereo = 1;
    else { iniFileClose(configIni); return 0; }

But apparently the libretro core does not set / read this [AUDIO] [PSG Stereo] variable from “Retroarch/system/machines/MSX2+/config.ini”, see also my previous post, which I guess is why the PSG Stereo setting wrongly defaults to stereo instead of mono?

Would it be possible to add the above PSG Stereo ON/OFF toggle to the core options menu of BlueMSX? Like e.g. twinaphex did for some of the other MSX config.ini variables (for example the VDP V9938/V9958 etc. https://github.com/libretro/blueMSX-libretro/commit/18b2ba3ae6728684163c6d11ba0cfb813ade3786

Hopefully one of the devs can chime in?

Linked this thread to Github: https://github.com/libretro/blueMSX-libretro/issues/21

Hi Guys,

I finally found the real issue.

It’s not the PSG Stereo setting causing the audio balance to be wrong, but it’s the BlueMSX sound mixer default settings. This mixing panel is purely a perk in the standalone version where you can change the audio balance for all the various msx audio chips (PSG, SCC, MSX-AUDIO, MSX-MUSIC, etc.) from left to right. See for example this picture: http://msxblue.com/manual/mixer/mixer1.jpg .

For some odd reason the author decided to have the different soundchips slightly panned to either left or right in the default settings, which is opposite to real hardware behaviour.

To fix this, the default mixer “panning” settings in src/emulator/properties.c have to be set to 50 for all audio chips, see https://github.com/libretro/blueMSX-libretro/blob/master/Src/Emulator/Properties.c , starting at line 319.

Such that:

 properties->sound.mixerChannel[MIXER_CHANNEL_PSG].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_PSG].pan = 40;
    properties->sound.mixerChannel[MIXER_CHANNEL_PSG].volume = 100;

    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].pan = 60;
    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].volume = 100;

    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].pan = 60;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_IO].enable = 0;
    properties->sound.mixerChannel[MIXER_CHANNEL_IO].pan = 70;
    properties->sound.mixerChannel[MIXER_CHANNEL_IO].volume = 50;

    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].volume = 90;

    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].pan = 55;
    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].volume = 65;

is changed to:

 properties->sound.mixerChannel[MIXER_CHANNEL_PSG].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_PSG].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_PSG].volume = 100;

    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_SCC].volume = 100;

    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXMUSIC].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MSXAUDIO].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MOONSOUND].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_YAMAHA_SFG].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_PCM].volume = 95;

    properties->sound.mixerChannel[MIXER_CHANNEL_IO].enable = 0;
    properties->sound.mixerChannel[MIXER_CHANNEL_IO].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_IO].volume = 50;

    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_MIDI].volume = 90;

    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].enable = 1;
    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].pan = 50;
    properties->sound.mixerChannel[MIXER_CHANNEL_KEYBOARD].volume = 65;

Can someone pull this change into git?

I see. I guess he wanted to make a “fake stereo” effect. But when the whole music stays on the left speaker that can be strange.

I feel it’s more a request about having the sound mixer settings as core options, in the sense that there is not a libretro bug here. Just the original author decision.

[QUOTE=Tatsuya79;37676]I feel it’s more a request about having the sound mixer settings as core options, in the sense that there is not a libretro bug here. Just the original author decision.[/QUOTE]

Well worded, I agree.

But if that would mean not adding above patch I would be more hesistant.

The trouble is that bluemsx libretro development has been extremely slow, and that’s probably an understatement.

As such it would be a pity if the we would be stuck with fake stereo for a foreseable future, when we can have it configured like real hardware by default with a simple adjustment.

Possibly an idea to add above patch in the meantime until the core options have been added?

Not my decision, it’s up to the core maintainer. He’ll read your posts and decide. :slight_smile:

I guess that’s only fair. Thanks for the replies.