Author Topic: libbass.so I ask for help  (Read 174 times)

firemen

  • Posts: 161
libbass.so I ask for help
« on: 11 Dec '22 - 13:32 »
used the Android library from 2019, it worked fine. updated to the latest and noticed that on some karaokes the text sync be beaten up. attach  for the test. as I understand it, the old library correctly played silence before the beginning of the notes, the new library does not have this pause and the notes are played immediately, which is why the synchronization of the text of the song, where this pause is taken into account, flies.

libbassmidi.so is the latest version. I had to go back to the old version of libbass.so for now.

maybe in libbass.so there was a function of cutting silence at the beginning of the song and it can be disabled somehow?

Ian @ un4seen

  • Administrator
  • Posts: 25057
Re: libbass.so I ask for help
« Reply #1 on: 12 Dec '22 - 15:09 »
When playing your test file here with the MIDITEST example (included in the BASSMIDI package) and the current BASS+BASSMIDI libraries, the timing of the lyric syncs seems to be OK, ie. the lyrics are updating in sync with the melody. Please see if you can reproduce the problem with the MIDITEST example there. If the problem does happen with that, please also try on another device to see if it may be device-specific, and also on another platform (eg. Windows) for comparison.

BASS (new and old) doesn't automatically remove silence from the start of a file/stream, so I don't think that's the problem.

firemen

  • Posts: 161
Re: libbass.so I ask for help
« Reply #2 on: 12 Dec '22 - 15:56 »
Unfortunately I can't test MIDITEST as I'm writing in Delphi.
It plays correctly on Windows.
Checked on several android devices - everywhere is wrong.
I just revert back to the old 2019 libbass.so and the problem goes away. If I substitute a new libbass.so, then the playback of the midi file (the sound of the first notes) starts immediately, and on the old libbass.so or in the Windows version, there is a second pause before the start of the notes, taking into account which the lyrics are synchronized.
I'll leave the old version for now

firemen

  • Posts: 161
Re: libbass.so I ask for help
« Reply #3 on: 12 Dec '22 - 23:41 »
this code with the new library does not play a pause, but notes immediately start playing :

Code: [Select]
chan := BASS_StreamCreateFile(true, buffSong, 0, lenghtBuffSong, BASS_STREAM_PRESCAN or BASS_STREAM_DECODE or floatable or BASS_UNICODE);

if chan = 0 then  chan := BASS_MIDI_StreamCreateFile(true, buffSong,  0, lenghtBuffSong, BASS_SAMPLE_FX or BASS_MIDI_DECAYSEEK or BASS_MIDI_DECAYEND or BASS_MUSIC_DECODE or floatable or BASS_UNICODE, 0);

noticed that BASS_StreamCreateFile itself opens the midi file and returns the channel

put a check on midi that would open through BASS_MIDI_StreamCreateFile and the problem is gone:

Code: [Select]
if optNotMidiFile
   then chan := BASS_StreamCreateFile
   else  chan := BASS_MIDI_StreamCreateFile

windows version or old android 2019 BASS_StreamCreateFile did not open midi. the new one opens, as a result, the system midi device probably ignores the pause, and the soundfont I loaded is also ignored

I hope you understood what I wanted to say with the help of Google translator))
« Last Edit: 13 Dec '22 - 00:39 by firemen »

Ian @ un4seen

  • Administrator
  • Posts: 25057
Re: libbass.so I ask for help
« Reply #4 on: 13 Dec '22 - 13:15 »
Ah, I think I see what the problem is now. Because you're trying BASS_StreamCreateFile before BASS_MIDI_StreamCreateFile, that means Android's MIDI decoder could be used instead of BASSMIDI if you haven't loaded BASSMIDI via BASS_PluginLoad. Swapping the order of those calls should fix the problem.

If you do decide to use BASSMIDI via BASS_PluginLoad and BASS_StreamCreateFile, then also note that BASS_StreamCreateFile ignores plugin-specific flags (eg. BASS_MIDI_DECAYSEEK) because the same flag value can mean different things to different plugins. You can set those flags via BASS_ChannelFlags afterwards instead, something like this:

Code: [Select]
stream = BASS_StreamCreateFile(...); // create stream
BASS_CHANNELINFO info;
BASS_ChannelGetInfo(stream, &info); // get info
if (info.ctype == BASS_CTYPE_STREAM_MIDI) // it's a BASSMIDI stream
BASS_ChannelFlags(stream, BASS_MIDI_DECAYSEEK | BASS_MIDI_DECAYEND, BASS_MIDI_DECAYSEEK | BASS_MIDI_DECAYEND); // set BASSMIDI-specific flags

If you want, you can disable the use of Android's decoders via the BASS_CONFIG_AM_DISABLE option:

Code: [Select]
BASS_SetConfig(BASS_CONFIG_AM_DISABLE, 1);