Author Topic: BASS for Android  (Read 570440 times)

otherside

  • Posts: 43
Re: BASS for Android
« Reply #1500 on: 20 Dec '18 - 08:47 »
Thanks, I see what the problem is now. Here's an update that should fix it:

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still have the problem with that.

Thank you. It fixed the problem. Also wanted to ask why BASS.BASS_StreamGetFilePosition(chan, BASS.BASS_FILEPOS_END) returns -1 on .m4a files? Here's a file - https://yadi.sk/d/4XF2bH8PuUtTsw

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1501 on: 20 Dec '18 - 15:18 »
When using Android media codecs (except AAC/ADTS), the file reading isn't handled by BASS so most of the BASS_StreamGetFilePosition modes aren't available. BASS_FILEPOS_SIZE is the only one that is.

pony

  • Posts: 6
Re: BASS for Android
« Reply #1502 on: 15 Jan '19 - 08:36 »
android studio debug to this line,it will step over this line and exit the app. I don't konw the reason and need your help.thanks.

int version= BASSenc_MP3.BASS_Encode_MP3_GetVersion();

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1503 on: 15 Jan '19 - 13:22 »
That probably means the BASSenc_MP3 library (libbassenc_mp3.so files) hasn't been included in the app. You can open the app's APK file in ZIP software to check that. Also check the Logcat window for an error message.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1504 on: 17 Jan '19 - 16:38 »
The Android version of the BASS 2.4.14 release is up now in the 1st post.

pony

  • Posts: 6
Re: BASS for Android
« Reply #1505 on: 18 Jan '19 - 07:26 »
I think Such ".so" files have been complied,but the error I can't get it. the URL can't open.can you give some info about it.
Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration. For more information, go to:
 https://d.android.com/r/studio-ui/add-native-code.html
Alternatively, you can use the experimental plugin:
 https://developer.android.com/r/tools/experimental-plugin.html

pony

  • Posts: 6
Re: BASS for Android
« Reply #1506 on: 18 Jan '19 - 07:41 »
I can load libbass.so ,but  libbasssenc.so or libbassenc_mp3.so. I spend  a week to find a way load The last two ".so" files.please help me. 

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1507 on: 18 Jan '19 - 15:15 »
It looks like you're using Java there? If so, the BASS libraries should get loaded automatically when you call a function from them, due to the System.loadLibrary call(s) in the BASS Java classes. To help find what/where the problem is, perhaps you could try starting with the RECTEST example Android Studio project and add the BASSenc libraries/calls to it, and see if you still have the problem then?

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1508 on: 19 Jan '19 - 23:31 »
Hi Ian,

I have problems with BASS_FX_BFX_CHORUS effect. I have implemented sliders for its parameters to let users experiment the different settings in real-time, but after a few changes (the parameters are changed only when the slider is released), randomly, there is static and then silence. Removing the effect and re-enabling it fixes the problem.
I am using also BASS_FX_BFX_DAMP and BASS_FX_BFX_FREEVERB and for them there is no such issue.

As an example I had this problem with the following changes:

Adding effect: FxSetting{type=0x1000d, params=[65549, 58, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 76, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 54, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 35, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, -1, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 40, 50, 50, 10]}

Where I set the parameters from the values in the array with the following formulas (so I was changing the feedback parameter):

Code: [Select]
BASS_FX.BASS_BFX_CHORUS v = new BASS_FX.BASS_BFX_CHORUS();
v.fDryMix   = (100 - i[1]) / 100f; // dry (unaffected) signal mix           [-2......2]
v.fWetMix   = i[1]/ 100f;          // wet (affected) signal mix             [-2......2]
v.fFeedback = i[2] / 100f;         // output signal to feed back into input [-1......1]
v.fMinSweep = i[3] / 100f;         // minimal delay ms                      [0<...6000]
v.fMaxSweep = (i[3]+i[4])/100f;    // maximum delay ms                      [0<...6000]
v.fRate     = i[5];                // rate ms/s                             [0<...1000]
v.lChannel  = BASS_FX.BASS_BFX_CHANALL;

Any ideas about how to fix this issue?
« Last Edit: 19 Jan '19 - 23:34 by gicci »

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1509 on: 21 Jan '19 - 16:31 »
Can you try only changing one of the effect's parameter on each run (leave rest at defaults), to hopefully find which is causing the problem? Also confirm what architecture(s) you're running the tests on.

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1510 on: 21 Jan '19 - 19:27 »
I tested multiple times, and I have been able to reproduce it only changing the "feedback" parameter, the others seem to be ok. I have tested with ARM, both 32 and 64 bits.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1511 on: 22 Jan '19 - 16:19 »
Oh yes, I'm able to reproduce that too. It looks like there may be a problem in how it's implementing feedback that will need fixing. For now you could use the BASS_FX_DX8_CHORUS effect instead. Note that despite "DX8" in the name, it is available on all platforms (not only Windows).

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1512 on: 22 Jan '19 - 21:41 »
Unfortunately there are problems with BASS_FX_DX8_CHORUS as well: starting from the default values in the doc if I start changing the depth, at a certain point there are disturbances in the output which repeat continuously. The same noise happens in a predictable way setting the delay to the max supported value (20). I guess there is some overflow somewhere.

With last library version I am also no longer able to receive BASS.BASS_SYNC_END events from MIDI files. Everything works if I put back the version I fetched in date 18/10/2018 (not sure it was the previous one).
« Last Edit: 22 Jan '19 - 22:14 by gicci »

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1513 on: 23 Jan '19 - 16:45 »
Unfortunately there are problems with BASS_FX_DX8_CHORUS as well: starting from the default values in the doc if I start changing the depth, at a certain point there are disturbances in the output which repeat continuously. The same noise happens in a predictable way setting the delay to the max supported value (20). I guess there is some overflow somewhere.

Oh yes, there is indeed a problem with the effect's delay buffer being too small when using high fDelay and fDepth parameters; it won't write beyond the buffer's size but it may read beyond that. Here's an update that should fix the problem:

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still have the problem with that.

With last library version I am also no longer able to receive BASS.BASS_SYNC_END events from MIDI files. Everything works if I put back the version I fetched in date 18/10/2018 (not sure it was the previous one).

That's strange. I guess you are referring to the BASS version, not BASSMIDI version? The latest BASS version (2.4.14) shouldn't change anything for MIDI streams except that custom flags are no longer supported via the plugin system, eg. BASS_StreamCreateFile. Are you using that? If so, what flags are you using, and does setting them afterwards via BASS_ChannelFlags fix things for you?

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1514 on: 23 Jan '19 - 19:27 »
Oh yes, there is indeed a problem with the effect's delay buffer being too small when using high fDelay and fDepth parameters; it won't write beyond the buffer's size but it may read beyond that. Here's an update that should fix the problem:

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still have the problem with that.

The test works without issues, thanks.

That's strange. I guess you are referring to the BASS version, not BASSMIDI version? The latest BASS version (2.4.14) shouldn't change anything for MIDI streams except that custom flags are no longer supported via the plugin system, eg. BASS_StreamCreateFile. Are you using that? If so, what flags are you using, and does setting them afterwards via BASS_ChannelFlags fix things for you?

The MIDI stream is created with something like:

Code: [Select]
BASSMIDI.BASS_MIDI_StreamCreateFile(file.getPath(), 0, 0, FX_FLAGS_ON | SINCINTER_FLAGS_ON | BASS.BASS_STREAM_DECODE, 44100)
and fed into a mixer created with something like:

Code: [Select]
BASSmix.BASS_Mixer_StreamCreate(44100, 2, BASSmix.BASS_MIXER_POSEX)
BASSmix.BASS_Mixer_StreamAddChannel(chanId, channel.getChanId(), BASSmix.BASS_MIXER_LIMIT)

The sync procedures are then set on the Mixer with BASSmix.BASS_Mixer_ChannelSetSync, not on the MIDI channel. So I am not getting the BASS.BASS_SYNC_END from the Mixer stream, fed with the MIDI stream.
The other BASSMIDI.BASS_SYNC_MIDI_EVENT and BASSMIDI.BASS_SYNC_MIDI_MARK (I set 14 of them...) are working properly.

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1515 on: 23 Jan '19 - 22:16 »
Another (much less important) thing: if I attach an effect of the FX library to a channel and then I close it without detaching the effect, all the FX effects no longer work on another file. The "DX8 chorus" instead does not have the same behavior.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1516 on: 24 Jan '19 - 14:05 »
Oh yes, there is indeed a problem with the effect's delay buffer being too small when using high fDelay and fDepth parameters; it won't write beyond the buffer's size but it may read beyond that. Here's an update that should fix the problem:

   www.un4seen.com/stuff/bass-android-test.zip

Let me know if you still have the problem with that.

The test works without issues, thanks.

Great! The update is in the main package in the 1st post now. Linux and OSX updates with the same fix are also up on the BASS page now (the Windows version is unaffected).

The sync procedures are then set on the Mixer with BASSmix.BASS_Mixer_ChannelSetSync, not on the MIDI channel. So I am not getting the BASS.BASS_SYNC_END from the Mixer stream, fed with the MIDI stream.

Are you using the mixer's handle or the MIDI stream handle in the BASS_Mixer_ChannelSetSync call? It should be the MIDI stream handle. Is the call successful, ie. returning non-0?

Another (much less important) thing: if I attach an effect of the FX library to a channel and then I close it without detaching the effect, all the FX effects no longer work on another file. The "DX8 chorus" instead does not have the same behavior.

Strange, I'm not sure how that would be possible. Are you setting the effects directly on the file streams? Perhaps you're setting them on a mixer that's processing the files, and the mixer is being freed? To confirm whether the FX has been freed, what happens if you try using it in a BASS_FXReset call, ie. is it returning non-0?

(: JOBnik! :)

  • Posts: 1080
Re: BASS for Android
« Reply #1517 on: 24 Jan '19 - 14:22 »
Hi ;D

Hi Ian,

I have problems with BASS_FX_BFX_CHORUS effect. I have implemented sliders for its parameters to let users experiment the different settings in real-time, but after a few changes (the parameters are changed only when the slider is released), randomly, there is static and then silence. Removing the effect and re-enabling it fixes the problem.
I am using also BASS_FX_BFX_DAMP and BASS_FX_BFX_FREEVERB and for them there is no such issue.

As an example I had this problem with the following changes:

Adding effect: FxSetting{type=0x1000d, params=[65549, 58, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 76, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 54, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 0, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 35, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, -1, 50, 50, 10]}
Changing effect: FxSetting{type=0x1000d, params=[65549, 75, 40, 50, 50, 10]}

Where I set the parameters from the values in the array with the following formulas (so I was changing the feedback parameter):

Code: [Select]
BASS_FX.BASS_BFX_CHORUS v = new BASS_FX.BASS_BFX_CHORUS();
v.fDryMix   = (100 - i[1]) / 100f; // dry (unaffected) signal mix           [-2......2]
v.fWetMix   = i[1]/ 100f;          // wet (affected) signal mix             [-2......2]
v.fFeedback = i[2] / 100f;         // output signal to feed back into input [-1......1]
v.fMinSweep = i[3] / 100f;         // minimal delay ms                      [0<...6000]
v.fMaxSweep = (i[3]+i[4])/100f;    // maximum delay ms                      [0<...6000]
v.fRate     = i[5];                // rate ms/s                             [0<...1000]
v.lChannel  = BASS_FX.BASS_BFX_CHANALL;

Any ideas about how to fix this issue?

Please test the latest updates:

* Tempo:
  * Updated to the latest SoundTouch version 2.1.3

* Reverse:
  * Fixed BASS_ERROR_UNKNOWN error when restarting playback of a reverse stream, as described in this thread:
    www.un4seen.com/forum/?topic=18176

* BPM:
  * Updated to the latest SoundTouch version 2.1.3
  * Rewrote Beats-per-Minute analysis algorithm for more reliable BPM detection.

* DSP:
  * Fixed fFeedback parameter in BASS_FX_BFX_CHORUS effect.
  * Enabled fS parameter to be greater than 1 in BASS_FX_BFX_BQF effect.


Windows x86/x64: http://www.jobnik.org/BASS_FX/beta/bass_fx24122-beta.zip
Android: http://www.jobnik.org/BASS_FX/beta/bass_fx24122-android-beta.zip

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1518 on: 24 Jan '19 - 17:46 »
Are you using the mixer's handle or the MIDI stream handle in the BASS_Mixer_ChannelSetSync call? It should be the MIDI stream handle. Is the call successful, ie. returning non-0?

I am using the MIDI stream handle with the call, and no errors are returned (always != 0).
If I keep my code unchanged and just put the previous library version it is working.

Strange, I'm not sure how that would be possible. Are you setting the effects directly on the file streams? Perhaps you're setting them on a mixer that's processing the files, and the mixer is being freed? To confirm whether the FX has been freed, what happens if you try using it in a BASS_FXReset call, ie. is it returning non-0?

Yes, I set the effects directly on the MIDI stream, which is then decoding and feeding a Mixer. The Mixer is never freed, it just get plugged and unplugged with the files when they change.

Calling BASS_FxReset after closing the MIDI return false. Anyway during this test I discovered I was by mistake removing the effect after disposing the MIDI channel (which correctly reports an error). Could be this action triggering the failure condition?


gicci

  • Posts: 64
Re: BASS for Android
« Reply #1519 on: 24 Jan '19 - 20:34 »
Hi ;D

Windows x86/x64: http://www.jobnik.org/BASS_FX/beta/bass_fx24122-beta.zip
Android: http://www.jobnik.org/BASS_FX/beta/bass_fx24122-android-beta.zip

Hi JOBnik,
thank you for the update.

The problem with the feedback parameter in chorus is no longer present, but there is a continuous background noise as soon as I enable the chorus effect. Reverb and damp (the other two I am using) work correctly.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1520 on: 25 Jan '19 - 14:16 »
Are you using the mixer's handle or the MIDI stream handle in the BASS_Mixer_ChannelSetSync call? It should be the MIDI stream handle. Is the call successful, ie. returning non-0?

I am using the MIDI stream handle with the call, and no errors are returned (always != 0).
If I keep my code unchanged and just put the previous library version it is working.

I don't seem to be able to reproduce the problem here. Please show the calls (including parameters) that you're using to create and setup the mixer and MIDI stream and the sync.

Strange, I'm not sure how that would be possible. Are you setting the effects directly on the file streams? Perhaps you're setting them on a mixer that's processing the files, and the mixer is being freed? To confirm whether the FX has been freed, what happens if you try using it in a BASS_FXReset call, ie. is it returning non-0?

Yes, I set the effects directly on the MIDI stream, which is then decoding and feeding a Mixer. The Mixer is never freed, it just get plugged and unplugged with the files when they change.

Calling BASS_FxReset after closing the MIDI return false. Anyway during this test I discovered I was by mistake removing the effect after disposing the MIDI channel (which correctly reports an error). Could be this action triggering the failure condition?

Calling BASS_ChannelRemoveFX on an FX handle that no longer exists won't cause a problem. But did you call BASS_FXReset on the other stream's FX, the one that you said the FX stops working on despite not being freed? If not, that is what I meant for you to try.

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1521 on: 25 Jan '19 - 16:11 »
I don't seem to be able to reproduce the problem here. Please show the calls (including parameters) that you're using to create and setup the mixer and MIDI stream and the sync.

The MIDI stream and Mixer were in my previous post, are you interested only in sync setting or also in all the other calls I might do? This will take some time, as all the setup is split in a number of classes unfortunately I can't just copy paste.
I will try to add logging to BASS calls so that I can capture the exact parameters.

Calling BASS_ChannelRemoveFX on an FX handle that no longer exists won't cause a problem. But did you call BASS_FXReset on the other stream's FX, the one that you said the FX stops working on despite not being freed? If not, that is what I meant for you to try.

I have solved in the meantime removing the FX effects before disposing the channel. Let's put this at lower priority, the other one is instead a big problem for my app.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1522 on: 25 Jan '19 - 17:51 »
The MIDI stream and Mixer were in my previous post, are you interested only in sync setting or also in all the other calls I might do? This will take some time, as all the setup is split in a number of classes unfortunately I can't just copy paste.
I will try to add logging to BASS calls so that I can capture the exact parameters.

Please include all calls on the mixer and MIDI stream, in case any of them are affecting things. If there are currently a lot of calls involved, perhaps you could also try trimming that down to the minimum required to produce the problem.

gicci

  • Posts: 64
Re: BASS for Android
« Reply #1523 on: 25 Jan '19 - 19:26 »
Hi Ian,

I managed to get tracings for the BASS calls I am using. You will find attached two files, one with the old library, the other with the new.

I start the play of a short MIDI file. In the "old library" the end sync proc gets called and stops the playback, with the "new library" the playback does not get stopped as the sync proc is not called.

Let me know if you need more details on the parameters.

Ian @ un4seen

  • Administrator
  • Posts: 21791
Re: BASS for Android
« Reply #1524 on: 28 Jan '19 - 17:28 »
I guess the BASS_ChannelStop call in the "old" log is coming from inside your BASS_SYNC_END sync's callback function? The "new" log shows the mixer stalling (BASS_ChannelIsActive returning BASS_ACTIVE_STALLED). To cause the problem you're having, I guess the mixer must be stalling before it reaches the sync's position, so the SYNCPROC doesn't get called. I will send you a debug BASS version to check that.