Author Topic: Strange behavior of BASS_MIXER_MATRIX when BASS_MIXER_POSEX is set  (Read 751 times)

jpf

  • Posts: 198
I do something like this:
A file decoding stream hBassCh is plugged into a decoding mixer hMix, which is plugged into another (non decoding) mixer hMix2.
Code: [Select]
    hBassCh = BASS_StreamCreateFile(BASSFALSE, StrPtr(Filename), 0, 0, BASS_STREAM_DECODE Or BASS_SAMPLE_FLOAT Or BASS_STREAM_PRESCAN)
    hMix = BASS_Mixer_StreamCreate(ChInfo.Freq, 2, BASS_STREAM_DECODE Or BASS_MIXER_POSEX)
...
    Debug.Print BASS_Mixer_StreamAddChannel(hMix, hBassCh, BASS_MIXER_MATRIX Or BASS_STREAM_AUTOFREE)
...
    hMix2 = BASS_Mixer_StreamCreate(ChInfo.Freq, 2, BASS_MIXER_POSEX)
    Call BASS_Mixer_StreamAddChannel(hMix2, hMix, BASS_MIXER_MATRIX)
...
    Debug.Print BASS_Mixer_ChannelSetMatrix(hBassCh, MixMatrix(0))
...
    Call BASS_Mixer_ChannelSetMatrix(hMix, MixMatrix2(0))

When I change the values on MixMatrix and apply it the sound heard on the speakers doesn't change; it seems to be a one to one assignment (I only tried mono and stereo files).

If I remove the BASS_MIXER_POSEX flag on hMix creation code then the sound heard follows the changes of the values of MixMatrix.

All the functions succeed.

What can I be doing wrong? What tests should I perform?

Ian @ un4seen

  • Administrator
  • Posts: 26177
That's strange, the BASS_MIXER_POSEX flag shouldn't have any effect on matrix mixing. Does a BASS_Mixer_ChannelGetMatrix call after BASS_Mixer_ChannelSetMatrix give back the same matrix?

jpf

  • Posts: 198
Thanks, Ian!

I got other problems in my app. I think some of them may have started after a massive virus infection I got recently. I had some DVD backups but they were not very up to date, so I had to use some of the now cleaned previously infected stuff in the new OS installation. Anyway, I decided to start a new project with freshly downloaded Bass & Vst stuff and the code from the previously (corrupted) project pasted in with only little modification. The strange behavior mysteriously desappeared. So I'll take the problem as solved.

Now I'm having a new issue I did not take care of before. It's how the final latency of the stream chain is calculated:

Is the calculation taking into account the delay introduced by the Dsp's? At least it doesn't seem so with bass_fx BASS_BFX_PITCHSHIFT. I'm seeing a noticeable offset between video and audio when the pitch effect kicks in.

The Vst's seem to have the same behavior, or at least some of them. With those I could probably compensate it by adding the value returned by BASS_VST_Info.InitialDelay, but I don't see a way to retrieve the latency from bass_fx. Am I missing something here?

Anyway, doing that compensation myself will probably involve applying latency changes anytime a parameter is changed on any dsp/vst. I'd like to spare that work if there's already a way for bass to do it for me.

Keeping a good sync between audio and subtitles is important when creating subtitles, and I'm not getting that when I set the timings using pitch shift, at least. So I've been setting the timings with no FX applied and keeping pitch shift (and voice isolation vst, among others) for the dialog transcription part.

And by the way, but not important at all, does bass (and its decoding plugins) support other multistream containers appart from mp4? I've seen other containers work but maybe they're played by bass using system codecs. In those cases, bass doesn't seem to have a way to chose what audio track to play.

Ian @ un4seen

  • Administrator
  • Posts: 26177
Is the calculation taking into account the delay introduced by the Dsp's? At least it doesn't seem so with bass_fx BASS_BFX_PITCHSHIFT. I'm seeing a noticeable offset between video and audio when the pitch effect kicks in.

The Vst's seem to have the same behavior, or at least some of them. With those I could probably compensate it by adding the value returned by BASS_VST_Info.InitialDelay, but I don't see a way to retrieve the latency from bass_fx. Am I missing something here?

It looks like the BASS_FX_BFX_PITCHSHIFT effect's delay (in samples) is determined by the BASS_BFX_PITCHSHIFT "lFFTsize" and "lOsamp" parameters, like this: lFFTsize - lOsamp

And by the way, but not important at all, does bass (and its decoding plugins) support other multistream containers appart from mp4? I've seen other containers work but maybe they're played by bass using system codecs. In those cases, bass doesn't seem to have a way to chose what audio track to play.

If a file has multiple overlapping audio tracks then BASS and add-ons will generally just play the first one. An exception is BASSWEBM, which has a "track" parameter in BASS_WEBM_StreamCreateFile/etc. Also, BASSHLS has bitrate based selection via the BASS_CONFIG_HLS_BANDWIDTH setting.

jpf

  • Posts: 198
It looks like the BASS_FX_BFX_PITCHSHIFT effect's delay (in samples) is determined by the BASS_BFX_PITCHSHIFT "lFFTsize" and "lOsamp" parameters, like this: lFFTsize - lOsamp

I'll experiment with that once I have other problems sorted. Thanks for the tip!