Author Topic: BASS for Android  (Read 605199 times)

chadr

  • Guest
Re: BASS for Android
« Reply #1600 on: 14 Jul '19 - 14:36 »
Hi ;D

I've added x86_64 architecture support to the BASS_FX 2.4.12.2 beta package:
http://www.jobnik.org/BASS_FX/beta/bass_fx24122-android-beta.zip

Hello, How it is going on?  :)

hexise

  • Posts: 8
Re: BASS for Android
« Reply #1601 on: 15 Jul '19 - 04:11 »
Hi Ian,

I want to implement a 10-band equalizer. I found there are BASS_DX8_PARAMEQ in BASS and BASS_BFX_PEAKEQ in BASS_FX. Which one is more stable and suggested to use?

I saw from your another post as following: does it mean that BASS_BFX_PEAKEQ is the better choice for me since I am using 10 bands equalizer?

The big difference is that the BASS_BFX_PEAKEQ effect supports multiple bands in a single instance, while using BASS_DX8_PARAMEQ will require a separate effect for each band. So if multiple bands are needed, BASS_BFX_PEAKEQ would be the better choice.

I am also using compressor effect to reduce distortion after EQ. What is the value suggested for compressor2 effect in this case? Currently my implementation is as following, fAttack is 0.01f and fRatio is 20f, and the fThreshold is -30f but I saw many developers set this to -20f.

Code: [Select]
int compressorHandle = BASS.BASS_ChannelSetFX(channel, BASS_FX.BASS_FX_BFX_COMPRESSOR2, PRIORITY_COMPRESSOR);
BASS_FX.BASS_BFX_COMPRESSOR2 compressor = new BASS_FX.BASS_BFX_COMPRESSOR2();
compressor.fAttack = 0.01f;
compressor.fGain = 0f;
compressor.fRatio = 20f;
compressor.fRelease = 200f;
compressor.fThreshold= -30f;
compressor.lChannel = BASS_FX.BASS_BFX_CHANALL;
boolean result = BASS.BASS_FXGetParameters(compressorHandle, compressor);
if (!result) {
    Debug.error("FX: Set parameter error for compressor: " + BASS.BASS_ErrorGetCode());
}

Thank you!
« Last Edit: 15 Jul '19 - 08:09 by hexise »

andrey

  • Posts: 4
Re: BASS for Android
« Reply #1602 on: 15 Jul '19 - 09:58 »
Hi!
My application crashed on any C++ exceptions if linked with BASS library.
I use the latest NDK with clang compiler, as I can see BASS compiled with GCC 4.8 and this may be a problem because clang and gcc use incompatible unwinding libraries.
Detailed explanations here: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#Unwinding

Is it possible to get BASS that compiled with clang?

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1603 on: 15 Jul '19 - 14:30 »
I want to implement a 10-band equalizer. I found there are BASS_DX8_PARAMEQ in BASS and BASS_BFX_PEAKEQ in BASS_FX. Which one is more stable and suggested to use?

I saw from your another post as following: does it mean that BASS_BFX_PEAKEQ is the better choice for me since I am using 10 bands equalizer?

Yes, either will work but BASS_BFX_PEAKEQ would be best for that purpose due to the multi-band support.

I am also using compressor effect to reduce distortion after EQ. What is the value suggested for compressor2 effect in this case? Currently my implementation is as following, fAttack is 0.01f and fRatio is 20f, and the fThreshold is -30f but I saw many developers set this to -20f.

Code: [Select]
int compressorHandle = BASS.BASS_ChannelSetFX(channel, BASS_FX.BASS_FX_BFX_COMPRESSOR2, PRIORITY_COMPRESSOR);
BASS_FX.BASS_BFX_COMPRESSOR2 compressor = new BASS_FX.BASS_BFX_COMPRESSOR2();
compressor.fAttack = 0.01f;
compressor.fGain = 0f;
compressor.fRatio = 20f;
compressor.fRelease = 200f;
compressor.fThreshold= -30f;
compressor.lChannel = BASS_FX.BASS_BFX_CHANALL;
boolean result = BASS.BASS_FXGetParameters(compressorHandle, compressor);
if (!result) {
    Debug.error("FX: Set parameter error for compressor: " + BASS.BASS_ErrorGetCode());
}

You should use whatever sounds best to you. But for general use, that fRatio setting seems a bit high and the fThreshold setting a bit low. If you just want to adjust the level to compensate for the EQ, another option is to use the BASS_FX_VOLUME effect instead. For example, that's what you would use to implement a "Preamp" option like in the old Winamp. If you want it more automated, you could try using the negative of the average gain of the first few EQ bands to set the BASS_FX_VOLUME effect's level (and restrict it to 0 dB or below).

My application crashed on any C++ exceptions if linked with BASS library.
I use the latest NDK with clang compiler, as I can see BASS compiled with GCC 4.8 and this may be a problem because clang and gcc use incompatible unwinding libraries.

Are you using the TAGS add-on? I believe that is the only one that uses C++ exceptions. If you are using that, please note there are 2 versions included in the package (in the 1st post). The default version should be used if your app (including its other libraries) doesn't use C++ exceptions itself, and the "c++_shared" version should be used if it does (and "APP_STL" should be set to "c++_shared").

hexise

  • Posts: 8
Re: BASS for Android
« Reply #1604 on: 15 Jul '19 - 17:19 »
Setting the "fRatio" parameter very high and "fAttack" very low should basically make the effect a limiter.

I saw from this thread that to achieve a limiter, fRatio should be very high. Is 20 too high for the fRatio in my implementation?

Code: [Select]
int compressorHandle = BASS.BASS_ChannelSetFX(channel, BASS_FX.BASS_FX_BFX_COMPRESSOR2, PRIORITY_COMPRESSOR);
BASS_FX.BASS_BFX_COMPRESSOR2 compressor = new BASS_FX.BASS_BFX_COMPRESSOR2();
compressor.fAttack = 0.01f;
compressor.fGain = 0f;
compressor.fRatio = 20f;
compressor.fRelease = 200f;
compressor.fThreshold= -30f;
compressor.lChannel = BASS_FX.BASS_BFX_CHANALL;
boolean result = BASS.BASS_FXGetParameters(compressorHandle, compressor);
if (!result) {
    Debug.error("FX: Set parameter error for compressor: " + BASS.BASS_ErrorGetCode());
}

andrey

  • Posts: 4
Re: BASS for Android
« Reply #1605 on: 16 Jul '19 - 08:31 »
Are you using the TAGS add-on?
No, only libbass.
When I build app with BASS, linker uses gcc unwind library and app crashed when throw exception.
When I build app without BASS, linker uses clang unwind library and all exceptions works as expected.
I tried to setup linker to use clang unwind anyway but it didn't work or I do something wrong...
I tried link with c++_static and c++_shared and app crashed anyway.

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1606 on: 16 Jul '19 - 17:03 »
Setting the "fRatio" parameter very high and "fAttack" very low should basically make the effect a limiter.

I saw from this thread that to achieve a limiter, fRatio should be very high. Is 20 too high for the fRatio in my implementation?

A limiter would usually have a higher threshold setting. Here's a nice graph that shows how the threshold and ratio settings combine to affect the result:

   https://en.wikipedia.org/wiki/Dynamic_range_compression#Threshold

When I build app with BASS, linker uses gcc unwind library and app crashed when throw exception.
When I build app without BASS, linker uses clang unwind library and all exceptions works as expected.
I tried to setup linker to use clang unwind anyway but it didn't work or I do something wrong...
I tried link with c++_static and c++_shared and app crashed anyway.

That's strange. To investigate what's going on, can you create a little example to reproduce the problem with?

andrey

  • Posts: 4
Re: BASS for Android
« Reply #1607 on: 17 Jul '19 - 09:43 »
That's strange. To investigate what's going on, can you create a little example to reproduce the problem with?
This simple example crashed if uses c++_static and works with c++_shared.
https://drive.google.com/open?id=1j87Ln0K3KMQa-T1G49IuMFqOapQ7sD7p

I test my app again with c++_shared and some samples works, but I have strange crash. Call stack begins with __gnu_Unwind_ForcedUnwind and doesn't contains my code, so I don't know how to reproduce this crash. Without BASS this sample works with c++_static and c++_shared.

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1608 on: 17 Jul '19 - 16:24 »
The unwind symbols have been excluded in recent (not yet released) builds, so please give the latest build a try and see if you still get the problem with it:

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

andrey

  • Posts: 4
Re: BASS for Android
« Reply #1609 on: 18 Jul '19 - 08:31 »
The unwind symbols have been excluded in recent (not yet released) builds, so please give the latest build a try and see if you still get the problem with it:
All my samples and tests now works with c++_static and c++_shared.
Thank you!

hexise

  • Posts: 8
Re: BASS for Android
« Reply #1610 on: 22 Jul '19 - 05:23 »
Hi, Ian,

Currently Android is suggesting/forcing to use App Bundles. When building using App Bundle, by default in Gradle 3.3.1, native libraries are served uncompressed in APKs on devices from Android M onwards so that the Android Framework doesn't have to decompress them. But in this way, old way to load plugin native library(BASS.BASS_PluginLoad) will not work, since the "*.so" files are not extracted to app directory, and the file cannot be found. Can we use System.loadLibrary() method(suggested by Google) to replace BASS.BASS_PluginLoad() method? Is this officially supported? Thanks.

For this issue, please have a look following thread:

https://issuetracker.google.com/issues/125164369#comment2

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1611 on: 23 Jul '19 - 12:26 »
BASS_PluginLoad seems to still be working fine then. The only issue I saw is that the libraries aren't in the nativeLibraryDir directory, so searching for them there (like in the PLUGINS example) won't work; perhaps there is a way to check what libraries are in the app's APK? In any case, an app could instead have a hardcoded list of plugins to load with BASS_PluginLoad.

otherside

  • Posts: 49
Re: BASS for Android
« Reply #1612 on: 30 Jul '19 - 16:14 »
I can confirm that with App Bundle BASS works like before.

but I found one error: on some devices with arm64-v8 architecture (if I include this bass arch libs), (P20 lite for example). Alac files are not supported.
All other types of files work as expected. Here's files to check - https://yadi.sk/d/NjlPE0itge4A_Q

But if I ship apk with armeabi-v7a, x86. Without even including arm64-v8 platform, then everything works fine
« Last Edit: 30 Jul '19 - 16:27 by otherside »

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1613 on: 30 Jul '19 - 16:54 »
Are you using the BASSALAC add-on, and if so, is that directly or via BASS_PluginLoad? If the latter, is the BASS_PluginLoad call reporting success? Does using BASSALAC directly (eg. BASS_ALAC_StreamCreateFile) make any difference?

itsme0112233

  • Posts: 1
Re: BASS for Android
« Reply #1614 on: 31 Jul '19 - 14:10 »
Congratulations!! Good Work...

otherside

  • Posts: 49
Re: BASS for Android
« Reply #1615 on: 6 Aug '19 - 12:02 »
Are you using the BASSALAC add-on, and if so, is that directly or via BASS_PluginLoad? If the latter, is the BASS_PluginLoad call reporting success? Does using BASSALAC directly (eg. BASS_ALAC_StreamCreateFile) make any difference?

I use BASSALAC via BASS_PluginLoad. I will investigate and try to answer other questions.

Update1:
I tried to use BASSALAC directly - it works! The only problem is that some files have mp3 extension thou inside they are alac files. So it is using PluginLoad is more convenient as it detects formats by itself.
« Last Edit: 7 Aug '19 - 12:56 by otherside »

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1616 on: 7 Aug '19 - 13:33 »
That sounds like another plugin may have been preventing BASSALAC getting a look at the file. What other add-ons are you loading before BASSALAC (via BASS_PluginLoad), and what is the error code from the failed BASS_StreamCreateFile call?

otherside

  • Posts: 49
Re: BASS for Android
« Reply #1617 on: 7 Aug '19 - 16:56 »
That sounds like another plugin may have been preventing BASSALAC getting a look at the file. What other add-ons are you loading before BASSALAC (via BASS_PluginLoad), and what is the error code from the failed BASS_StreamCreateFile call?

This is the code I use to load plugins:

Code: [Select]
                BASS.BASS_PluginLoad(path + "/libbass_aac.so", 0)
                BASS.BASS_PluginLoad(path + "/libbass_ape.so", 0)
                BASS.BASS_PluginLoad(path + "/libbass_mpc.so", 0)
                BASS.BASS_PluginLoad(path + "/libbassalac.so", 0)
                BASS.BASS_PluginLoad(path + "/libbassflac.so", 0)
                BASS.BASS_PluginLoad(path + "/libbassopus.so", 0)
                BASS.BASS_PluginLoad(path + "/libbasswv.so", 0)
                BASS.BASS_PluginLoad(path + "/libbasshls.so", 0)

I get unsupported format error when try to play alac file.

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1618 on: 7 Aug '19 - 17:32 »
Are those BASS_PluginLoad calls reporting success in their return values? If not, it may be that the libraries weren't extracted from the app's APK so they aren't where you expect them to be (eg. in the nativeLibraryDir directory). Try passing the filenames without any path.

If that isn't it, then to confirm whether it is one of the other plugins causing the problem, please try only loading BASSALAC and see what happens then. If that prevents the problem, then try reintroducing the other plugins one by one (starting at the top of the list) until the problem reappears, to find the culprit.

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1619 on: 9 Aug '19 - 16:14 »
The Android version of the new BASSWEBM add-on is up now in the 1st post.

otherside

  • Posts: 49
Re: BASS for Android
« Reply #1620 on: 25 Aug '19 - 15:20 »
Are those BASS_PluginLoad calls reporting success in their return values? If not, it may be that the libraries weren't extracted from the app's APK so they aren't where you expect them to be (eg. in the nativeLibraryDir directory). Try passing the filenames without any path.

If that isn't it, then to confirm whether it is one of the other plugins causing the problem, please try only loading BASSALAC and see what happens then. If that prevents the problem, then try reintroducing the other plugins one by one (starting at the top of the list) until the problem reappears, to find the culprit.

Hello again. Sorry for misinformation. Yes, BASS_PluginLoad reports 0. It was hard to test, because of appbundle. So the problem is that when apk is generated from appbundle, native libs places somewhere out of nativeLibraryDir. (because android:extractNativeLibs is being added to manifest) Is there any idea how to fix it? Here u can read more - https://stackoverflow.com/questions/56551036/native-libraries-not-found-in-applicationinfo-nativelibrarydir-when-building-app

Here you can read more about app bundles - https://developer.android.com/guide/app-bundle
« Last Edit: 25 Aug '19 - 15:25 by otherside »

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1621 on: 26 Aug '19 - 13:22 »
I'm not sure if there is any way to enumerate the libraries that are included in an app. If there isn't, you can hardcode a list of them (you will know what libraries are included) and pass each of them to BASS_PluginLoad.

otherside

  • Posts: 49
Re: BASS for Android
« Reply #1622 on: 29 Aug '19 - 08:52 »
I'm not sure if there is any way to enumerate the libraries that are included in an app. If there isn't, you can hardcode a list of them (you will know what libraries are included) and pass each of them to BASS_PluginLoad.

There's no trouble with enumeration of libs.

I tried to use BASS_PluginLoad passing
Code: [Select]
BASS.BASS_PluginLoad(path + "/libbass_aac.so", 0) and also this
Code: [Select]
BASS.BASS_PluginLoad("libbass_aac.so", 0). It doesn't work with any plugin (returnes 0). The problem is that I use apk app bundle. More details about the issue you can find here: https://stackoverflow.com/questions/56551036/native-libraries-not-found-in-applicationinfo-nativelibrarydir-when-building-app

More info what is appbundle is here - https://developer.android.com/guide/app-bundle

Ian @ un4seen

  • Administrator
  • Posts: 21986
Re: BASS for Android
« Reply #1623 on: 29 Aug '19 - 16:04 »
Passing the library filename without a path (eg. "libbass_aac.so") should work. Please confirm what Android and BASS versions you are using. If you haven't already done so, you could also try this latest BASS build:

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

teq

  • Posts: 41
Re: BASS for Android
« Reply #1624 on: 4 Sep '19 - 20:10 »
Hi there! One of my app users said that sound on Galaxy Tab s5e is "noises/glitches", and others app sound well. What i could do with that? Thanks.