Author Topic: BASS for Android  (Read 390136 times)

Dahaka

  • Posts: 8
Re: BASS for Android
« Reply #300 on: 14 Feb '13 - 19:59 »
Are you sure you are playing the exact same files that you posted above? If so, please confirm what software is able to play them, as they have been unplayable with all software that I've tried so far.
I sure (attaching screenshot). I try NRG Player, PlayerPro Music Player, RockPlayer. This code play my files:
  MediaPlayer mediaPlayer = new  MediaPlayer();

    
    try {
          mediaPlayer.setDataSource("/sdcard/Arecord001.ogg");
          mediaPlayer.prepare();
          mediaPlayer.start();

        } catch (IllegalArgumentException iae) {
              // TODO Auto-generated catch block
              iae.printStackTrace();
 
        } catch (IllegalStateException ise) {
             // TODO Auto-generated catch block
             ise.printStackTrace();

        } catch (IOException ioe) {
             // TODO Auto-generated catch block
             ioe.printStackTrace();
        } catch (Exception e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
        }

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #301 on: 18 Feb '13 - 16:45 »
Having now looked at your OGG files more closely, the first "page" in both cases has an incorrect CRC, which is resulting in them being rejected. If the CRC error is ignored, then the files are playable, so that must be what the player that you are able to play them with is doing.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #302 on: 18 Feb '13 - 17:56 »
The latest BASS version (2.4.10) is now up in the first post.

Dahaka

  • Posts: 8
Re: BASS for Android
« Reply #303 on: 19 Feb '13 - 14:47 »
Having now looked at your OGG files more closely, the first "page" in both cases has an incorrect CRC, which is resulting in them being rejected. If the CRC error is ignored, then the files are playable, so that must be what the player that you are able to play them with is doing.
Hi, Ian. How to ignore CRC error (please show example with BASS.BASS_StreamCreateFile)? The latest BASS version (2.4.10) is the same problems (Application crash (Fly IQ 441 Android 4.0). LogCat:02-09 17:30:04.870: A/libc(21953): Fatal signal 7 (SIGBUS) at 0x00000000 (code=128))
thanks

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #304 on: 19 Feb '13 - 15:42 »
It isn't currently possible to have BASS ignore CRC errors, so I'm afraid those files won't be playable, but they shouldn't result in a crash. Do you have any add-ons loaded, ie. via BASS_PluginLoad? If so, please try removing them and see if the crash still occurs. If that fixes the crashing, you can then try putting the plugins back in one by one until you find which one is causing the crash. If you don't have any plugins loaded and it is still crashing, then I think I will have to send you a debug version to find out why.

Dahaka

  • Posts: 8
Re: BASS for Android
« Reply #305 on: 19 Feb '13 - 17:14 »
It isn't currently possible to have BASS ignore CRC errors, so I'm afraid those files won't be playable, but they shouldn't result in a crash. Do you have any add-ons loaded, ie. via BASS_PluginLoad? If so, please try removing them and see if the crash still occurs. If that fixes the crashing, you can then try putting the plugins back in one by one until you find which one is causing the crash. If you don't have any plugins loaded and it is still crashing, then I think I will have to send you a debug version to find out why.
You are right. :) I found a problem - libbassflac.so.
thanks

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #306 on: 19 Feb '13 - 18:02 »
Ah yes, I am able to reproduce that with the PLUGINS example. I will look into what's going wrong, and hopefully be back with a fix!

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #307 on: 20 Feb '13 - 14:35 »
An updated BASSFLAC build is now up in the package in the 1st post. Let me know if you still get the crashing with it and the OGG files.

Dahaka

  • Posts: 8
Re: BASS for Android
« Reply #308 on: 21 Feb '13 - 16:22 »
An updated BASSFLAC build is now up in the package in the 1st post. Let me know if you still get the crashing with it and the OGG files.
Great work. :)Thanks
P.S. I will wait of support BASSWMA  ;)

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #309 on: 25 Feb '13 - 17:46 »
The latest version (2.4.1) of the BASSOPUS add-on is now up in the first post.

Gaspar

  • Posts: 1
Re: BASS for Android
« Reply #310 on: 12 Mar '13 - 11:53 »
For convenience, the stream/sample/music creation functions include support for assets, via an "Asset" class.
Is there a way to use bass for playing files in assets without java? In C++ i have an AAssetManager object and i want to use bass without any jni.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #311 on: 12 Mar '13 - 18:08 »
I'm afraid BASS doesn't currently have any way to pass it a native AAssetManager object, but what you could do is wrap the asset stuff in BASS_FILEPROCS functions and use BASS_StreamCreateFileUser.

chuckd

  • Posts: 67
Re: BASS for Android
« Reply #312 on: 13 Mar '13 - 19:52 »
Simple question: Does the BASS for Android module use the Open SL ES low level API in Android?  Several people are telling me that this is the answer to our latency problems in Android (however just as many others say that it will still have annoying latency).

Chuck

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #313 on: 14 Mar '13 - 16:45 »
Yes, BASS does indeed use the OpenSL ES API on Android.

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #314 on: 16 Mar '13 - 08:36 »
Sir IAN can u implement me a small ex about spectrum analyser :
again im converting the vb project "LiveSpectrum" , im using
ByteBuffer bbuf=ByteBuffer.allocateDirect(1024*4); // allocate a buffer for the FFT data
         bbuf.order(null);
b = new int[1024];
         bbuf.asIntBuffer().get(b);
to getdata its working almost fine until for low frequencies it s little bit cracky and it s displaying ugly big lines(im using opengl and im positive sure there is no issues in opengl drawing)
how can i control the frequencies?
i prefer to give an idea to display the spectrum im using now the waveform mode thnx....

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #315 on: 18 Mar '13 - 14:05 »
Have you based your code on the SPECTRUM example that comes with BASS on other platforms, and if so, are you seeing different results compared to that? One thing to note is that the example ignores the 1st FFT "bin", which contains the DC component.

If you still having any trouble with it, please post the code that you're using the get and process the FFT data.

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #316 on: 19 Mar '13 - 03:22 »
yes sir ur right maybe im displaying the DC Component..however im using the vb project "SPECTRUM" and its little bit different in android..so the vb code here:
If (specmode = 3) Then ' waveform
        Dim c As Long, buf() As Single, ci As BASS_CHANNELINFO
        ReDim specbuf(SPECWIDTH * (SPECHEIGHT + 1)) As Byte ' clear display

        Call BASS_ChannelGetInfo(chan, ci) ' get number of channels
        ReDim buf(ci.chans * SPECWIDTH * LenB(buf(0))) As Single ' allocate buffer for data

        Call BASS_ChannelGetData(chan, buf(0), ci.chans * SPECWIDTH * LenB(buf(0)) Or BASS_DATA_FLOAT)   ' get the sample data (floating-point to avoid 8 & 16 bit processing)
        For c = 0 To ci.chans - 1
            For X = 0 To SPECWIDTH - 1
                Dim v As Long
                v = (1 - buf(X * ci.chans + c)) * SPECHEIGHT / 2 ' invert and scale to fit display
            

                If (v < 0) Then
                    v = 0
                ElseIf (v >= SPECHEIGHT) Then
                    v = SPECHEIGHT - 1
                End If
                If (X = 0) Then Y = v
                Do  ' draw line from previous sample...
                    If (Y < v) Then
                        Y = Y + 1
                    ElseIf (Y > v) Then
                        Y = Y - 1
                    End If
                                      
                    specbuf(Y * SPECWIDTH + X) = IIf(c And 1, 127, 1) ' left=green, right=red (could add more colours to palette for more chans)
                
                Loop While (Y <> v)
            Next X
        Next c

my java code here:
public static class waveform{
      public int[] b;
      public int monB;
            public void conv(int chan , int len){
         ByteBuffer bbuf=ByteBuffer.allocateDirect(1024*4); // allocate a buffer for the FFT data
         bbuf.order(null); // little-endian byte order
         monB = BASS.BASS_ChannelGetData(chan, bbuf, len); // get the FFT data
         //int[] fft=new int[1024]; // allocate an "int" array for the FFT data
         //bbuf.asIntBuffer().get(fft); // get the data from the buffer into the array
         // do something with the FFT data...
          b = new int[1024];
         bbuf.asIntBuffer().get(b);
      }

im using B4A so i made a basslibrary and i call its functions from the B4A and my B4A code is
  BassService.jo.conv(chnm,400*4)   ' get the sample data (floating-point to avoid 8 & 16 bit processing)
            For g = 0 To 200-1
      ' Dim v As Long
                'v = (1 - BassService.jo.b(g * 2 + 1))  / 2 ' invert and scale to fit display
             
             drawp(int2float(g*12000),int2float(BassService.jo.b(g)/1000),g)
            glsv.RequestRender
         
            Next

please ignore the "drawp"call this is an opengl call
so instead of creating buffer like "Specbuff" im drawing the data directly to the vertex buffer of opengl..anyway is there any mistaking in calling data? and how can i ignore the DC Component... thanks again

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #317 on: 19 Mar '13 - 16:23 »
Oh. You are displaying a waveform from sample data, rather than getting and displaying FFT data. One big difference to note on Android is that the BASS_DATA_FLOAT flag will give you 8.24 fixed-point (rather than floating-point) data, so you will need to adjust the "invert and scale to fit display" calculation accordingly. It could look something like this...

Code: [Select]
v = (1 - buf(X * ci.chans + c) / 16777216.0) * SPECHEIGHT / 2 ' invert and scale to fit display

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #318 on: 20 Mar '13 - 16:05 »
thank u sir but didnt fix the prob anyway i will fix it later.
i want to discuss something with u plz:
im planing to develop an advanced music player with bass library to post it as paid app on google play store..so im in the test now i started form the begining and im working in parallel with basic4android and eclipse with creating and intializing bass in a service module and start it in the foreground...i created 2 chans (chan1 is a decode chan and then created a bassfx chan , chan2 is decode chan for peaks scaning) and a peak eq for chan1 using bassfx. i worked with opengl to display the peaks and the waveform spectrum analyser(calling bass_channelgetdata) and i created a modified dsp proc for chan1 wish i provided a ability to make an input and output gain for future using as audio limiter because till now compressor in bassfx is not yet implemented by bass. and a simple  file list to choose music file to play.
so all worked well till i experienced that the app is starving the battery drain because of high cpu usage i mean : i tested it with and without the peak scaning thread and the dsp proc and the service...i disabled all and i monitored the cpu again in the taskmanager not "basscpu" and still getting around unstable 33%. and sure there is lots of features in my mind i would like to provide in this app.
so the question is that will the users get satisfied with that usage of battery and cpu? will my app be an efficient app? im testing it on my samsung galaxy s2 with android 2.3...i need ur advice plz and im sry for bothering..thanks in advance and bass for me will always be the legend.........
« Last Edit: 20 Mar '13 - 16:18 by mrjoey »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #319 on: 21 Mar '13 - 16:04 »
A constant 33% CPU usage does seem a bit high for a media player (depending on how powerful the CPU is). Perhaps you could make some features (eg. any DSP or visuals) optional, so that the user can choose to disable them for lower CPU usage. For comparison, to see if the CPU usage level is something specific to your app, you could check the CPU usage of the BASS examples.

BulleTTime

  • Posts: 28
Re: BASS for Android
« Reply #320 on: 26 Mar '13 - 20:55 »
Hi guys,

I was looking for a way to extend the web radio player with AAC PLUS. I added the addon to my project. Do i need to use flags or how do i implement this?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #321 on: 27 Mar '13 - 14:59 »
To add AAC support, you need to copy the BASS_AAC libraries to your project's "libs" folder and add a BASS_PluginLoad call to your "onCreate" function...

Code: [Select]
BASS.BASS_PluginLoad(getApplicationInfo().nativeLibraryDir+"/libbass_aac.so", 0);

BulleTTime

  • Posts: 28
Re: BASS for Android
« Reply #322 on: 27 Mar '13 - 16:02 »
Hi Ian,

I was trying to play one of these aac plus radio channels from Sky.FM:

http://frozenshinigami.wordpress.com/2011/03/25/online-radio-streaming-via-sky-fm/


But these dont work. aac plus should work?



EDIT: I found out how to play them. Url's look like http://www.sky.fm/mp3/classicrap.pls these work!

« Last Edit: 27 Mar '13 - 16:28 by BulleTTime »

norbert

  • Posts: 119
[Solved]: Re: BASS for Android
« Reply #323 on: 27 Mar '13 - 18:03 »
Hi, the bass lib seems to be loaded successfully, but when I call BASS.BASS_Init it crashes with "UnsatisfiedLinkError":

03-27 18:15:39.632 D/dalvikvm(31521): Trying to load lib /data/data/AndroidApplication1.AndroidApplication1/app_dynlibs/libbass.so 0x41495110
03-27 18:15:39.642 D/dalvikvm(31521): Added shared lib /data/data/AndroidApplication1.AndroidApplication1/app_dynlibs/libbass.so 0x41495110
03-27 18:15:39.642 W/dalvikvm(31521): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/un4seen/bass/BASS;
Unhandled Exception:

Java.Lang.ExceptionInInitializerError:
03-27 18:17:30.712 I/MonoDroid(31521): UNHANDLED EXCEPTION: Java.Lang.ExceptionInInitializerError: Exception of type 'Java.Lang.ExceptionInInitializerError' was thrown.
03-27 18:17:30.712 I/MonoDroid(31521): at Android.Runtime.JNIEnv.GetStaticMethodID (intptr,string,string) [0x00024] in /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:744
03-27 18:17:30.712 I/MonoDroid(31521): at Com.Un4seen.Bass.BASS.BASS_Init (int,int,int) <IL 0x00026, 0x00127>

Any idea (I am using MonoDroid but maybe this error is also known when using it in JAVA )?

SOLVED it: a simple "Clean" and "Rebuild" didi the job.

That's cool: so you can code a whole android application that uses BASS while just using C#  (using MonoDroid) !!!



« Last Edit: 27 Mar '13 - 18:12 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #324 on: 28 Mar '13 - 15:42 »
I was trying to play one of these aac plus radio channels from Sky.FM:

http://frozenshinigami.wordpress.com/2011/03/25/online-radio-streaming-via-sky-fm/


But these dont work. aac plus should work?

Yes, I think those streams should be playable. If you're still having trouble with them after adding BASS_AAC to your project, did you refresh the "libs" folder in Eclipse? If not, try doing that, as the new libraries may otherwise not be included in your app package when you build it; you can open the APK file in a ZIP archiver to confirm whether the libraries are included. If it still isn't working, check that the BASS_PluginLoad call is successful (returning non-0), and what the error code is from the failed BASS_StreamCreateURL call.