Author Topic: BASS for Android  (Read 390102 times)

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #250 on: 22 Nov '12 - 15:34 »
No, I'm afraid it isn't currently possible for BASS to play WMA on Android (the BASSWMA add-on is not available). Regarding alternatives, the FFmpeg project includes a WMA decoder that you may be able to use with BASS (eg. feed the decoded sample data into a STREAMPROC), but you should check the licensing (some parts of FFmpeg are LGPL and some are GPL).

audioMagicUser

  • Posts: 1
Re: BASS for Android
« Reply #251 on: 23 Nov '12 - 19:49 »
Hi guys, your audio library is look like very powerful, and android support is excellent, i have some questions, please answer for me, it very important for me.

1. If i have raw pcm audio data in byte[], already decoded. Is any way to apply equalizer effect to pcm byte array, and how i can accomplish that, please post any code sample here or give me a link in which can be described how to create equalizer?
2. Is any way to apply other audio effects to raw pcm audio data?

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #252 on: 26 Nov '12 - 13:21 »
Yes, it is possible to apply BASS FX/DSP to raw PCM data via a "dummy" stream. That is a stream created by BASS_StreamCreate with proc=STREAMPROC_DUMMY, and it should have the same sample format as your data. For example, something like this...

Code: [Select]
fxdummy=BASS.BASS_StreamCreate(freq, chans, BASS.BASS_STREAM_DECODE, BASS.STREAMPROC_DUMMY, null); // create a dummy stream
eq=BASS.BASS_ChannelSetFX(fxdummy, BASS.BASS_FX_DX8_PARAMEQ, 0); // set an EQ effect on it
// set EQ parameters via BASS_FXSetParameters

...

// process some data...
ByteBuffer bb=ByteBuffer.wrap(bytearray); // wrap the byte array in a ByteBuffer
BASS.BASS_ChannelGetData(fxdummy, bb, bb.limit()); // pass it through the dummy stream to apply FX

Please see the documentation for details on the aforementioned functions.

trebun

  • Posts: 6
Re: BASS for Android
« Reply #253 on: 1 Dec '12 - 01:20 »
Hi,

is it possible to do this:

Code: [Select]
if ((chan=BASS.BASS_StreamCreateFile(InputFilename, 0, 0, BASS.BASS_STREAM_DECODE))==0
&& (chan=BASS.BASS_MusicLoad(InputFilename, 0, 0, BASS.BASS_MUSIC_DECODE|BASS.BASS_MUSIC_RAMP|BASS.BASS_MUSIC_PRESCAN, 1))==0) {

with an wav-file? It works perfect for mp3-files...

Regards,
trebun

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #254 on: 3 Dec '12 - 14:50 »
Yes, that should work fine for WAV files too (BASS_StreamCreateFile supports WAV as well as MP3). If you have a WAV file that isn't working, please check that it's playable with other software, and if it is, upload it to have a look at here...

   ftp.un4seen.com/incoming/

Clancey

  • Posts: 11
Re: BASS for Android
« Reply #255 on: 7 Dec '12 - 06:52 »
Do you have a timeframe of when BASS_FX_BFX_PEAKEQ will be supported for Android?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #256 on: 7 Dec '12 - 16:46 »
I'll look into getting that supported next week.

materialworlds

  • Posts: 17
Re: BASS for Android
« Reply #257 on: 10 Dec '12 - 15:27 »
re. timeframe for BASS_FX_BFX_PEAKEQ on Android: "I'll look into getting that supported next week."
Wonderful... and are BASS_FX_BFX_VOLUME_ENV and BASS_FX_BFX_MIX yet supported?
« Last Edit: 10 Dec '12 - 15:38 by materialworlds »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #258 on: 11 Dec '12 - 14:52 »
An updated BASS_FX version is now up in the first post, adding support for the BASS_FX_BFX_PEAKEQ/VOLUME_ENV/MIX effects.

Clancey

  • Posts: 11
Re: BASS for Android
« Reply #259 on: 13 Dec '12 - 00:08 »
Ian, You are the best!

cjh

  • Guest
Re: BASS for Android
« Reply #260 on: 14 Dec '12 - 03:20 »
BASS is pretty wonderful! However, there is a problem while playing audio in background.

When the application is on foreground, BASS plays audio very well. However, when the app goes into background, the audio stutters.
Changing BASS_CONFIG_BUFFER and BASS_CONFIG_DEV_BUFFER does not work. Of course, those settings are configured before BASS_Init. Any types of audio (mp3, ogg, PCM wave, ...) stutters on any Android devices I tested (Samsung Galaxy S3, Samsung Galaxy Player, LG Optimus LTE2, etc.) on any Android version (2.3, 2.3.3, 4.0.3, ...)
I tested FXTest example, but it also has same problem. Is there a way to prevent stuttering on BASS?

Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #261 on: 14 Dec '12 - 17:53 »
The reason for that is that background apps get lower priority, so they may get starved of CPU. To get around that, you need to implement a "foreground service". Here is some info on that...

   http://developer.android.com/guide/components/services.html#Foreground

Also, here is a modified version of the PLUGINS example that another user has provided...

   www.un4seen.com/stuff/android-service.zip

cjh

  • Guest
Re: BASS for Android
« Reply #262 on: 14 Dec '12 - 20:22 »
The reason for that is that background apps get lower priority, so they may get starved of CPU. To get around that, you need to implement a "foreground service". Here is some info on that...

   http://developer.android.com/guide/components/services.html#Foreground

Also, here is a modified version of the PLUGINS example that another user has provided...

   www.un4seen.com/stuff/android-service.zip

Wow! It works perfectly! Thanks, Ian!!! :D

tantra

  • Posts: 1
Re: BASS for Android
« Reply #263 on: 21 Dec '12 - 10:55 »
Hello!

Is it possible to include into bass lib for android x86 compiled lib. It needed when debug android apps in emulator with intel HAXM

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #264 on: 21 Dec '12 - 16:23 »
Here is an x86 build of the BASS library...

   www.un4seen.com/stuff/bass24-android-x86.zip

Denis

  • Guest
Re: BASS for Android
« Reply #265 on: 12 Jan '13 - 11:04 »
Hello! Is there way to remove these warnings?

/Users/deni/Desktop/android/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__cxa_begin_cleanup' in ./obj/local/armeabi/libgnustl_static.a(eh_arm.o) is referenced by DSO ./obj/local/armeabi/libbass.so
/Users/deni/Desktop/android/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__cxa_type_match' in ./obj/local/armeabi/libgnustl_static.a(eh_arm.o) is referenced by DSO ./obj/local/armeabi/libbass.so

Application.mk:
http://www.everfall.com/paste/id.php?n50jql1uz0j8

Android.mk:
http://www.everfall.com/paste/id.php?ybdhgbd6rinw

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #266 on: 12 Jan '13 - 15:12 »
That looks like the warnings may be due to your library using the "gnustl_static" C++ runtime library, while BASS is using the default C++ runtime library. I'm not sure if there is any way to remove the warnings, or how significant they are, but my guess is that they won't cause a problem (presumably the hidden symbol in your library won't get found/used by BASS). Are you having any trouble running your library/app?

Denis

  • Guest
Re: BASS for Android
« Reply #267 on: 12 Jan '13 - 17:00 »
Thanks for the reply! No, there are no problems with running. Just aesthetic discomfort :)

CMCE

  • Posts: 2
Re: BASS for Android
« Reply #268 on: 13 Jan '13 - 01:47 »
Hi!
I have tried for several ours to get the Netradio example working but I always get "UnsatisfiedLinkError".

The NetRadio.apk is created with lib\armeabi\libbass.so and \lib\armeabi-v7a\libbass.so. Do I have to add a reference to these files somewhere? It's a Java project.

Thank you very much for any help!

Here is the project (source+binary): http://www.cmce.se/forum/netradio.zip
« Last Edit: 13 Jan '13 - 01:51 by CMCE »

CMCE

  • Posts: 2
Re: BASS for Android
« Reply #269 on: 13 Jan '13 - 17:27 »
Solved it. I had included Bass.java in my project instead of using Link Source. This is how I solved it:

1. Right click on the project.
2. Choose Build Path => Configure Build Path...
3. Select the Source tab.
4. Click on Link Source...
5. Select the src directory with Bass.java and type Bass as the folder name.

Not that easy to know if you come from Visual Studio :)

bega

  • Posts: 22
Re: BASS for Android
« Reply #270 on: 18 Jan '13 - 08:58 »
Which Example for CUSTLOOP? Thank-you.
« Last Edit: 18 Jan '13 - 09:05 by bega »

Dodge

  • Posts: 32
Re: BASS for Android
« Reply #271 on: 23 Jan '13 - 13:11 »
Hey there,

first i would like to say that its awesome that you provide an Android version of BASS. Even if i had (and somehow still have) some trouble to find a good way to provide a BG Service for my webradio stream app.


I would like to know if there is a plan to release an android version of the encoding plugin or if there is another way to record a (webradio)stream?


thanks in advance

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #272 on: 23 Jan '13 - 17:03 »
There aren't any immediate plans for an Android version of the BASSenc add-on; I don't think there are any encoders (eg. LAME/OGGENC/etc) for it to use. If wanted, it would probably be possible to build the LAME/etc libraries into your app (using the NDK), and then feed the sample data from BASS to that.

Regarding recording a webradio stream, is that a stream that BASS is playing? If so, you can use a DOWNLOADPROC function (in your BASS_StreamCreateURL call) to record it, ie. write the data to a file in that function.

Dodge

  • Posts: 32
Re: BASS for Android
« Reply #273 on: 23 Jan '13 - 17:22 »
Hey Ian,

thank you for you fast reply, even if the news are more or less "bad". :)


Yes the stream is playing in BASS, its a shoutcast stream (depending on quality mp3 or aac).
Wouldn't the file miss some "header" information if i just write the streamdata in?



Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #274 on: 23 Jan '13 - 17:50 »
No, that will be fine. If you want to be clever, your DOWNLOADPROC could look for the beginning of the first frame in the MP3/AAC data to start writing from (the data sent by the server may begin mid-frame), but the written file will be playable even without doing that :)