Author Topic: m4a files fail to play if BASS_MUSIC_MONO flag is used  (Read 547 times)

xfx

  • Posts: 8
Is there any reason why BASS (with BASS_AAC) cannot play m4a files with the BASS_MUSIC_MONO flag?

I'm currently using the following flags:
BASS_SPEAKER_FRONTLEFT Or BASS_MUSIC_MONO Or BASS_MIXER_DOWNMIX

I've also tried the following:
BASS_SPEAKER_FRONTLEFT Or BASS_MUSIC_MONO

This is the code used to create the stream:
Code: [Select]
Bass.BASS_StreamCreateFileUser(BASSStreamSystem.STREAMFILE_NOBUFFER,
                                                    BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_ASYNCFILE Or
                                                    BASS_SPEAKER_FRONTLEFT Or BASS_MUSIC_MONO Or BASS_MIXER_DOWNMIX,
                                                    bp.BASSFile,
                                                    IntPtr.Zero)

(bp.BASSFile returns a BASS_FILEPROCS struct)

The error message returned by BASS_ErrorGetCode is BASS_ERROR_SPEAKER

Any help on this matter will be greatly appreciated.
Oh and in case it helps, those m4a files were encoded using iTunes (latest version).

UPDATE
I've done some additional tests and it appears that the problem is the BASS_SPEAKER_FRONTLEFT flag.
Using BASS_SPEAKER_FRONT works just fine, but when using a mono-channel I get the aforementioned error.
« Last Edit: 18 Sep '18 - 20:30 by xfx »

Ian @ un4seen

  • Administrator
  • Posts: 21363
The BASS_AAC add-on doesn't currently use the BASS_MUSIC_MONO/BASS_STREAM_MONO flag (BASS_MIXER_DOWNMIX also isn't a valid flag for BASS_StreamCreateFileUser), so the stream will be stereo and that will be why the BASS_SPEAKER_FRONTLEFT flag is resulting in a BASS_ERROR_SPEAKER error, ie. a stereo stream can't be played on a mono speaker. If you want to convert it to mono, you could use the BASSmix add-on to do that, by creating a mono mixer (via BASS_Mixer_StreamCreate) and plugging the file into it (via BASS_Mixer_StreamAddChannel) with the BASS_MIXER_DOWNMIX flag. Another way you could achieve what you want (without a mixer) is to use the BASS_FX add-on's BASS_FX_BFX_MIX effect (via BASS_ChannelSetFX) to mix the left and right channels, and then use the BASS_ATTRIB_PAN setting (via BASS_ChannelSetAttribute) to pan it to the speaker that you want. Please see the documentation for details on the mentioned functions.

xfx

  • Posts: 8
Thank you very much for the information.