Author Topic: BASS for Android  (Read 390125 times)

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #500 on: 14 Jan '14 - 11:58 »
Hi , Question about "BASS_BFX_Linear2dB":
im using :
level = bassA.BASS_ChannelGetLevel(Chan)
BASS_BFX_Linear2dB(level)

im getting a value around 175 and when the song ends i got NAN , i need to show dB values for right and left channels and LOWORD(int n) , HIWORD(int n) dont help , any suggestions?

Chris

  • Posts: 1808
Re: BASS for Android
« Reply #501 on: 14 Jan '14 - 16:10 »
somethink like this

Code: [Select]
var
 levL_DB,levR_DB:double;
begin
  levL_DB := BASS_BFX_Linear2dB(Bass_ChannelGetLevel(LoWord(Chan))/32768);
  levR_DB := BASS_BFX_Linear2dB(Bass_ChannelGetLevel(HiWord(Chan))/32768);

« Last Edit: 14 Jan '14 - 16:12 by Chris »

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #502 on: 14 Jan '14 - 16:25 »
Thank u Chris :) , it works fine , another question here : u know displaying the level is very fast , i would like to make release time when the level falls like in all level meters , is there anyway? or its complicated tnx again

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #503 on: 14 Jan '14 - 16:32 »
One little thing... for better performance, you should have one BASS_ChannelGetLevel call and then separate the left and right levels, rather than calling BASS_ChannelGetLevel separately for each.

Code: [Select]
int level=BASS.BASS_ChannelGetLevel(chan); // get level
if (level!=-1) { // didn't fail
int levell=BASS.Utils.LOWORD(level), levelr=BASS.Utils.HIWORD(level); // separate left and right levels
...

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #504 on: 14 Jan '14 - 16:37 »
Thank u Mr Ian :) can u please answer my second question? :)

Chris

  • Posts: 1808
Re: BASS for Android
« Reply #505 on: 14 Jan '14 - 19:56 »
Code: [Select]
var
  levl: Integer = 0;
  levr: Integer = 0;
  decay:Integer= 1500;

Code: [Select]
procedure UpdateVU;
var
 Level : DWORD;
 levL_DB,levR_DB:double;
begin
  level := BASS_ChannelGetLevel(chan);
  levl := levl - decay;
  if (levl < 0) then
    levl := 0;
  levr := levr - decay;
  if (levr < 0) then
    levr := 0;
//little ErrorChecking
  if (level <> DW_Error) then // DW_ERROR = -1
  begin
    if (levl < LOWORD(level)) then
      levl := LOWORD(level);
    if (levr < HIWORD(level)) then
      levr := HIWORD(level);
  end;
  levL_DB := BASS_BFX_Linear2dB(levl/32768);
  levR_DB := BASS_BFX_Linear2dB(levr/32768);
end;

« Last Edit: 15 Jan '14 - 03:01 by Chris »

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #506 on: 15 Jan '14 - 12:39 »
Thank u so mush Mr Chris , it worked well , appreciate ur help , best regards :)

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #507 on: 20 Jan '14 - 22:49 »
Hey guys here s a quick quest about getdata ;
BASS_ChannelGetData(handle, bbuf, amountofdatarequested)
bbuf should be 4bytes right? signed or unsigned integer?
if we split bbuf : the first 2bytes are for right channel and the second 2bytes are for the left channel?
amountofdata should be *4 right?

ykot

  • Posts: 7
Re: BASS for Android
« Reply #508 on: 21 Jan '14 - 17:18 »
Is loading of AIFF (.wav) samples supported on Android?

On Windows, I've been generating AIFF sample in memory and then have been using BASS_SampleLoad on that, but on Android it seems to crash with SIGSEGV.

Currently I'm using BASS_SampleCreate and then BASS_SampleSetData on Android, which seems to work, but this approach produces intermittent clicking sounds after sample finishes playing - the same issue happens on Windows. As a solution, I've been using BASS_SampleLoad to load AIFF sample data (which remains the same, I just format it within AIFF format), which seems to fix clicking problem on Windows. But on Android it crashes.

I thought that maybe I'm generating AIFF wrong on Android, but I've saved it to external storage and can load it on Windows without any issues.

P.S. I'm using latest BASS version from this post.
« Last Edit: 21 Jan '14 - 17:24 by ykot »

jhchoi

  • Posts: 14
Re: BASS for Android
« Reply #509 on: 22 Jan '14 - 11:29 »
Hi,

I am using BASS on my Android application, but it seems that opening few mp3 files via BASS throws fatal error and the app just crashes.

Here is a link of the file which causes fatal error like "Fatal signal 11 (SIGSEGV) at 0x00000030 (code=1), thread 7201 (.example.fxtest)."
https://drive.google.com/file/d/0B7T6d4b1aS2dbG0wUENobTQ5dFE/edit?usp=sharing

I tested with FXTest example and it also throws same error for above file. Could you check about this?
Thank you.

recoilme

  • Posts: 11
Re: BASS for Android
« Reply #510 on: 23 Jan '14 - 14:54 »
Hi Ian!

A lot of people complain that my application falls ( (10+ it's only who write to me)
One of them found the cause. Example file: https://www.dropbox.com/s/j6gcje5ic72fflc/error.mp3
And it ruin my app on the string: chan = BASS.BASS_StreamCreateFile(path, 0, 0, 0); with segfault((((
May be you know some workaround how check file before processing? How to fix it?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #511 on: 23 Jan '14 - 16:22 »
Hey guys here s a quick quest about getdata ;
BASS_ChannelGetData(handle, bbuf, amountofdatarequested)
bbuf should be 4bytes right? signed or unsigned integer?
if we split bbuf : the first 2bytes are for right channel and the second 2bytes are for the left channel?
amountofdata should be *4 right?

BASS_ChannelGetData doesn't mind what type of buffer is passed to it; all it cares about is the size of the buffer (in the "length" parameter). But if you want to process the delivered data, then the buffer's type should match the sample data, eg. if it's 16-bit, then the buffer should be an array of signed 16-bit integers ("short" in Java).

Is loading of AIFF (.wav) samples supported on Android?

Yes, AIFF files should be supported, but a bug did sneak into the last update (when built-in ADPCM support was added). An update to fix that is now up in the 1st post.

I am using BASS on my Android application, but it seems that opening few mp3 files via BASS throws fatal error and the app just crashes.

Here is a link of the file which causes fatal error like "Fatal signal 11 (SIGSEGV) at 0x00000030 (code=1), thread 7201 (.example.fxtest)."
https://drive.google.com/file/d/0B7T6d4b1aS2dbG0wUENobTQ5dFE/edit?usp=sharing

That file seems to be playing OK with the latest build, now up in the 1st post. Please let me know if you find it still has a problem with any of your other MP3 files.

The same goes for recoilme :)

recoilme

  • Posts: 11
Re: BASS for Android
« Reply #512 on: 23 Jan '14 - 16:54 »
Thx Ian! Now work perfect with that file

I must update only libbass.so or other plugins like flac updated too?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #513 on: 23 Jan '14 - 17:50 »
Good to hear that the BASS update is working. There is no need to update the add-ons, unless you're currently using old versions, in which case you may as well update them at the same time :)

jhchoi

  • Posts: 14
Re: BASS for Android
« Reply #514 on: 24 Jan '14 - 00:45 »
That file seems to be playing OK with the latest build, now up in the 1st post. Please let me know if you find it still has a problem with any of your other MP3 files.

Now it works perfectly with latest BASS! I always appreciate your support!  :D

norbert

  • Posts: 119
Re: BASS for Android: BASS_MIDI_StreamGetMarks again
« Reply #515 on: 25 Jan '14 - 10:39 »
Again (see my Reply #473)  I'm having trouble with the BASS_MIDI_StreamGetMarks function, again only when using BASS_MIDI_MARK_LYRIC.
Your updated version of bassmidi works fine with the MIDI file I provided in Reply #473, but now I've found one which makes my app crash immediately without exception message when calling the function with  BASSMIDI.BASS_MIDI_MARK_LYRIC|BASSMIDI.BASS_MIDI_MARK_TICK.

First, it returns 511 as the number of markers, but when trying to get the marks - crash....

I have uploaded the affected MIDI file via your  "incoming" folder (..._Rhapsody).
« Last Edit: 25 Jan '14 - 10:44 by norbert »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #516 on: 27 Jan '14 - 15:25 »
Yep. There was an issue with the BASS_MIDI_StreamGetMarks function's Java wrapper possibly running out of space in the JNI local reference table when returning a lot of markers. A BASSMIDI update that should avoid that issue is now up in the 1st post.

ykot

  • Posts: 7
Re: BASS for Android
« Reply #517 on: 28 Jan '14 - 16:15 »
Is loading of AIFF (.wav) samples supported on Android?

Yes, AIFF files should be supported, but a bug did sneak into the last update (when built-in ADPCM support was added). An update to fix that is now up in the 1st post.
Thanks, it seems to be fixed now. Though, even when loaded from AIFF, there are random clicks (not always heard) after sample finishes playing. Sometimes there is a click at sample startup. Is there a way to prevent these clicks? I'm using 8-bit mono samples and clicks can be heard even if I use blank (0) data.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #518 on: 28 Jan '14 - 17:44 »
That sounds like the clicking may be occurring when the output device stops and starts. To avoid wasting CPU, BASS will stop feeding data to the output when nothing is playing, and Android will stop the output if it isn't given any data to play. That shouldn't generally result in a click sound, but I guess it's possible that it will with some devices. If you would like to avoid the chance of that, I've put an update up in the 1st post for you to try, which adds a BASS_CONFIG_NONSTOP option to have BASS continue to feed the output when nothing is playing. For example, you could do this...

Code: [Select]
BASS.BASS_SetConfig(BASS.BASS_CONFIG_NONSTOP, 1); // don't stop output when nothing is playing

ykot

  • Posts: 7
Re: BASS for Android
« Reply #519 on: 28 Jan '14 - 21:57 »
Hi Ian,

Thanks, but BASS_CONFIG_NONSTOP did not help. After some tests, the click sound is definitely heard at the end of sample playback. Calling BASS_ChannelPlay to restart the playback doesn't cause click, only when the sample reaches end.

When trying blank samples (e.g. only filling same with the same value) - samples filled with 128 (unsigned byte) only have click at the end, samples filled with 255 have clicking sound at start and end, while samples filled with 0 have click at the end and sometimes at start. I'm using 8-bit mono samples:
Code: (Pascal) [Select]
// SampleRate can be between 8000 and 14000, MaxChannels is usually 1.
Sample := BASS_SampleCreate(SampleLength, SampleRate, 1, MaxChannels, BASS_SAMPLE_8BITS or BASS_SAMPLE_SOFTWARE or BASS_SAMPLE_OVER_VOL);
BASS_SampleSetData(Sample, SampleBuffer);

// or alternatively (have AIFF prepared in memory):
Sample := BASS_SampleLoad(True, AiffBuffer, 0, AiffBufferSize, MaxChannels, BASS_SAMPLE_SOFTWARE or BASS_SAMPLE_OVER_VOL);

MultiParadigm

  • Posts: 2
Re: BASS for Android
« Reply #520 on: 29 Jan '14 - 05:15 »
Hi - please pardon if this has been asked before.  First, thank you for this framework.
Here's the question: should the Android netradio app be able to play an AAC stream?
Getting error 41 on several different streams fed via Icecast.
I did build the app with the bass_aac-android libs and source.
Thanks in advance!

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #521 on: 29 Jan '14 - 15:29 »
When trying blank samples (e.g. only filling same with the same value) - samples filled with 128 (unsigned byte) only have click at the end, samples filled with 255 have clicking sound at start and end, while samples filled with 0 have click at the end and sometimes at start. I'm using 8-bit mono samples:

Ah yes, I see what you mean now. There was indeed a problem at the end of 8-bit sample playback (due to the resampling buffer being padded with signed 0s rather than unsigned 128s). An update to correct that is now up in the 1st post.

Here's the question: should the Android netradio app be able to play an AAC stream?
Getting error 41 on several different streams fed via Icecast.
I did build the app with the bass_aac-android libs and source.

Yes, AAC support can be added to the NETRADIO example by adding the BASS_AAC libraries to the project's "libs" folder and a BASS_PluginLoad call to the code, eg. in the onCreate function...

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

MultiParadigm

  • Posts: 2
Re: BASS for Android
« Reply #522 on: 29 Jan '14 - 17:11 »
> BASS_PluginLoad

Aha.  That's what I'm missing.   Thank you!

ykot

  • Posts: 7
Re: BASS for Android
« Reply #523 on: 30 Jan '14 - 01:08 »
Ah yes, I see what you mean now. There was indeed a problem at the end of 8-bit sample playback (due to the resampling buffer being padded with signed 0s rather than unsigned 128s). An update to correct that is now up in the 1st post.

The clicking problem has been fixed now, thank you very much! (tested ARMv7 and x86 versions)

suathd

  • Posts: 48
Problem in BASS for Android while Getting FFT Data
« Reply #524 on: 4 Feb '14 - 00:20 »
Hello everybody,

I developed my first Android-Bass application by Using Delphi XE5.
It simply plays web streams from internet.

everything seems ok. but I think there is a bug in BASS_ChannelGetData while retrieving FFT data.

It returns irrelavant samples such as 1.2 E-39 (0.00000000...0000000000000000000012).
In Windows applications it returns samples such as 1.2 E-1 (0.12).

I've verified that "Single" variable directly match with "Float" variable and it is 4 bytes long (in both Windows and Android).

I think BASS_ChannelGetData returns samples in different data format (not in 4 -bytes float format).

Is there any body using  BASS_ChannelGetData with FFT and getting succes?

MyCode like this.


var
fftData:array [0..2047] of Single;

...
...
   BASS_ChannelGetData(UrlChan, @(fftData), BASS_DATA_FFT512);

best wishes...