Author Topic: BASS for Android  (Read 390081 times)

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #725 on: 22 Oct '14 - 16:40 »
OK so I would actually need to time it accurately, the issue it's called when ever the visualization frame is finished which varies a lot. I guess I need to time how long it was since the last data was retrieved, then work out how much I need to request? If the visualisation is too slow I will miss data and there is not much I can do about that. If the visualtation is really fast it will only get a small amount of data.

The sample data is buffered during playback (see BASS_CONFIG_BUFFER), which allows BASS_ChannelGetData to deliver the same data more than once, so requesting data more quickly than it is played won't be a problem; you will just receive some of the data more than once rather than a smaller amount of data. Missing some of the data generally won't be a big problem for visualisation purposes either. What sort of visualisation are you doing?

A 5.8ms period is probably a bit too short for visualisation updates, so if you do want to avoid missing any data, you should probably get/process more data each time so that you can increase the period.

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #726 on: 23 Oct '14 - 10:54 »
OK so I would actually need to time it accurately, the issue it's called when ever the visualization frame is finished which varies a lot. I guess I need to time how long it was since the last data was retrieved, then work out how much I need to request? If the visualisation is too slow I will miss data and there is not much I can do about that. If the visualtation is really fast it will only get a small amount of data.

The sample data is buffered during playback (see BASS_CONFIG_BUFFER), which allows BASS_ChannelGetData to deliver the same data more than once, so requesting data more quickly than it is played won't be a problem; you will just receive some of the data more than once rather than a smaller amount of data. Missing some of the data generally won't be a big problem for visualisation purposes either. What sort of visualisation are you doing?

A 5.8ms period is probably a bit too short for visualisation updates, so if you do want to avoid missing any data, you should probably get/process more data each time so that you can increase the period.

Great thanks again, it runs about 30fps so I upped the same data to 2048 samples, seems to look fine. The visualisation is ProjectM, it's a pretty nice remake of Milkdrop.
Thanks, Emile.

mrjoey

  • Posts: 31
Re: BASS for Android
« Reply #727 on: 28 Oct '14 - 19:43 »
mr Ian , how to tell if the radio station is sending the cover art and how to catch it , thank u :)

Pranjal

  • Posts: 79
Re: BASS for Android
« Reply #728 on: 31 Oct '14 - 10:43 »
The latest version (2.4.12) of the BASSenc add-on is now up in the 1st first, adding support for user-provided encoders, eg. it is now possible to use the LAME library instead of the standalone LAME executable (which isn't available on Android).
Hi Ian,

Is it possible to give a sample of encoding using LAME lib?

Thanx.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #729 on: 31 Oct '14 - 16:34 »
mr Ian , how to tell if the radio station is sending the cover art and how to catch it , thank u :)

Most streams don't send cover art, but some may include a cover art URL in the "StreamUrl" part of the Shoutcast metadata. In that case, you can use BASS_ChannelGetTags with BASS_TAG_META to get the metadata and extract the URL from that. For example, the NETRADIO.JAVA example could be modified something like this...

Code: [Select]
void DoMeta() {
String meta=(String)BASS.BASS_ChannelGetTags(chan, BASS.BASS_TAG_META);
if (meta!=null) { // got Shoutcast metadata
int ti=meta.indexOf("StreamTitle='");
if (ti>=0) {
String title=meta.substring(ti+13, meta.indexOf("';", ti+13));
((TextView)findViewById(R.id.status1)).setText(title);
}
ti=meta.indexOf("StreamUrl='");
if (ti>=0) {
String url=meta.substring(ti+11, meta.indexOf("';", ti+11));
// do something with the URL, eg. download it
}

Is it possible to give a sample of encoding using LAME lib?

Some info and code on using the LAME library with BASSenc on Android can be found in this thread...

   www.un4seen.com/forum/?topic=15657

norbert

  • Posts: 119
Re: BASS for Android
« Reply #730 on: 2 Nov '14 - 16:46 »
The BASS_MIDI_StreamGetMarks(...,BASS_MIDI_MARK_KEYSIG,...) function seems to return only positve values in the marker text:

Eg. having 4 flats and major it should be "-4 0" but actually it returns "252 0".

Can we rely on this workaround   "If first number is larger than 7 it is calculated by  X-256,  eg.  252-256= -4" ?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #731 on: 3 Nov '14 - 17:32 »
Oops, you're right. The number is being treated by BASSMIDI as unsigned rather than signed, so -4 becomes 252. A update to correct that is now up in the 1st post.

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #732 on: 4 Nov '14 - 17:33 »
Hi,
Sorry if this is obvious but I could not find it.. is there a callback function I can use to tell  when the track has finished playing on Android? I.E I ideally don't want to poll the state all the time if possible!
Thanks,Emile.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #733 on: 4 Nov '14 - 18:00 »
You can use a BASS_SYNC_END sync to be informed of when playback reaches the end. Something like this...

Code: [Select]
BASS.SYNCPROC EndSync=new BASS.SYNCPROC() {
public void SYNCPROC(int handle, int channel, int data, Object user) {
// do something here
}
};

BASS.BASS_ChannelSetSync(handle, BASS.BASS_SYNC_END, 0, EndSync,0);

Note that your SYNCPROC function will be called in a BASS thread, so if you want to do any UI stuff in it, you should use runOnUiThread to do that. A little demonstration of doing that can be found in the MIDITEST.JAVA example.

emile_b

  • Posts: 12
Re: BASS for Android
« Reply #734 on: 5 Nov '14 - 18:35 »
You can use a BASS_SYNC_END sync to be informed of when playback reaches the end. Something like this...

Code: [Select]
BASS.SYNCPROC EndSync=new BASS.SYNCPROC() {
public void SYNCPROC(int handle, int channel, int data, Object user) {
// do something here
}
};

BASS.BASS_ChannelSetSync(handle, BASS.BASS_SYNC_END, 0, EndSync,0);

Note that your SYNCPROC function will be called in a BASS thread, so if you want to do any UI stuff in it, you should use runOnUiThread to do that. A little demonstration of doing that can be found in the MIDITEST.JAVA example.

Perfect, thank you again.

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #735 on: 5 Nov '14 - 21:31 »
Hello mr Ian , Im trying to use Echo4 but when applied the app exits with no error , although BASS_BFX_PEAKEQ , BASS_BFX_COMPRESSOR2 , BASS_BFX_FREEVERB , BASS_BFX_CHORUS , BASS_BFX_PHASER  , are functional with no problems , the effects are applied to a mixer channel , im using the armeabi .so because i noticed that its mush faster and has low cpu usage, i tried the v7a but same problem, P.S : the stereo record is not working on the last update,  thank u.
« Last Edit: 8 Nov '14 - 09:49 by JoeK »

norbert

  • Posts: 119
Re: BASS for Android
« Reply #736 on: 8 Nov '14 - 14:25 »
Hi, again it's about the BASS_MIDI_StreamGetMarks(...,BASS_MIDI_MARK_KEYSIG,...) function (see my Reply #730):

After your fix (3. Nov) the first number (flats/sharps)  provides the correct value, but the second one returns a negative value in the marker text:

Eg. having F minor  (4 flats), according to the doc ("signifies major (if 0) or minor (if 1)") it should be "-4 1" but actually it returns "-4 -1".

weril

  • Posts: 19
Re: BASS for Android
« Reply #737 on: 8 Nov '14 - 15:41 »
Do I have to use tags plugin to get metadata in UTF-8 from a radio stream?

(: JOBnik! :)

  • Posts: 1065
Re: BASS for Android
« Reply #738 on: 9 Nov '14 - 21:38 »
Hi ;D

Hello mr Ian , Im trying to use Echo4 but when applied the app exits with no error , although BASS_BFX_PEAKEQ , BASS_BFX_COMPRESSOR2 , BASS_BFX_FREEVERB , BASS_BFX_CHORUS , BASS_BFX_PHASER  , are functional with no problems , the effects are applied to a mixer channel , im using the armeabi .so because i noticed that its mush faster and has low cpu usage, i tried the v7a but same problem, P.S : the stereo record is not working on the last update,  thank u.

Please redownload the package, it's fixed now:
http://www.jobnik.org/BASS_FX/bass_fx24-android.zip

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #739 on: 10 Nov '14 - 14:58 »
Hi ;D

Hello mr Ian , Im trying to use Echo4 but when applied the app exits with no error , although BASS_BFX_PEAKEQ , BASS_BFX_COMPRESSOR2 , BASS_BFX_FREEVERB , BASS_BFX_CHORUS , BASS_BFX_PHASER  , are functional with no problems , the effects are applied to a mixer channel , im using the armeabi .so because i noticed that its mush faster and has low cpu usage, i tried the v7a but same problem, P.S : the stereo record is not working on the last update,  thank u.

Please redownload the package, it's fixed now:
http://www.jobnik.org/BASS_FX/bass_fx24-android.zip
hey , tested , the app wont crash anymore but echo4 has no effect , when applied the volume will be raised a little but no echos my values are :
dry :2.0
wet:2.0
feedback:0.0
delay:250
stereo:true
channel :BASS_BFX_CHANALL
ofcourse tried another values but no effects. thank u

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #740 on: 10 Nov '14 - 15:04 »
Hi, again it's about the BASS_MIDI_StreamGetMarks(...,BASS_MIDI_MARK_KEYSIG,...) function (see my Reply #730):

After your fix (3. Nov) the first number (flats/sharps)  provides the correct value, but the second one returns a negative value in the marker text:

Eg. having F minor  (4 flats), according to the doc ("signifies major (if 0) or minor (if 1)") it should be "-4 1" but actually it returns "-4 -1".

That's strange. The unsigned to signed change in the last update shouldn't really affect the 2nd number, as it should be 0 or 1; I guess you would have got 255 with the old version if you're getting -1 with the update. Please upload the troublesome MIDI file to have a look at here...

   ftp.un4seen.com/incoming/

Do I have to use tags plugin to get metadata in UTF-8 from a radio stream?

On Android, BASS_ChannelGetTags will automatically convert to UTF-8 when used in Java (not in native code), so you don't need the Tags add-on for that.

norbert

  • Posts: 119
Re: BASS for Android
« Reply #741 on: 10 Nov '14 - 16:05 »
uploaded bev2i3pbWaltz...You're probably right with 255. But in my first post it was about another file (with a major key sig) so the error was not obvious...

weril

  • Posts: 19
Re: BASS for Android
« Reply #742 on: 10 Nov '14 - 16:19 »

Do I have to use tags plugin to get metadata in UTF-8 from a radio stream?

On Android, BASS_ChannelGetTags will automatically convert to UTF-8 when used in Java (not in native code), so you don't need the Tags add-on for that.

I can't get tags in Greek. I get some weird characters like these: "π. Αθανασίου Μυτιληναίου". (Radio stream: http://s6.onweb.gr:8084/)
I use the radio example code.
« Last Edit: 10 Nov '14 - 16:54 by weril »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #743 on: 10 Nov '14 - 17:28 »
uploaded bev2i3pbWaltz...You're probably right with 255. But in my first post it was about another file (with a major key sig) so the error was not obvious...

Yep, that file does indeed have -1 (255 unsigned) rather than 1. I guess it was possibly created by an app that was developed in a programming language that has a boolean true=-1, so -1 got written instead of 1. To be safe, you could treat anything non-0 as 1.

I can't get tags in Greek. I get some weird characters like these: "π. Αθανασίου Μυτιληναίου". (Radio stream: http://s6.onweb.gr:8084/)
I use the radio example code.

That stream uses Shoutcast, which generally uses the ISO-8859-1 character set rather then UTF-8. If the Shoutcast server happens to send UTF-8 text (your example isn't), then that will be retained, but otherwise BASS_ChannelGetTags will assume the ISO-8859-1 character set is used when converting to UTF-8.

weril

  • Posts: 19
Re: BASS for Android
« Reply #744 on: 10 Nov '14 - 21:37 »
That stream uses Shoutcast, which generally uses the ISO-8859-1 character set rather then UTF-8. If the Shoutcast server happens to send UTF-8 text (your example isn't), then that will be retained, but otherwise BASS_ChannelGetTags will assume the ISO-8859-1 character set is used when converting to UTF-8.

So what can i do now? Using java to convert Latin to Unicode was a failure.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #745 on: 11 Nov '14 - 17:05 »
hey , tested , the app wont crash anymore but echo4 has no effect , when applied the volume will be raised a little but no echos my values are :
dry :2.0
wet:2.0
feedback:0.0
delay:250
stereo:true
channel :BASS_BFX_CHANALL
ofcourse tried another values but no effects. thank u

To help locate the problem, does it only happen on Android or does it happen on other platforms too?

So what can i do now? Using java to convert Latin to Unicode was a failure.

Unfortunately, there probably isn't much that you can do about it. The problem is the source of that stream is (I guess) using a Greek code page in its titles. If you are the source of that stream, then you could try sending the titles to the server in UTF-8 form instead.

weril

  • Posts: 19
Re: BASS for Android
« Reply #746 on: 11 Nov '14 - 20:21 »
Unfortunately, there probably isn't much that you can do about it. The problem is the source of that stream is (I guess) using a Greek code page in its titles. If you are the source of that stream, then you could try sending the titles to the server in UTF-8 form instead.

Sadly this is not my stream. Anyway, thank you very much for your help.

JoeK

  • Posts: 22
Re: BASS for Android
« Reply #747 on: 12 Nov '14 - 07:15 »
hey , tested , the app wont crash anymore but echo4 has no effect , when applied the volume will be raised a little but no echos my values are :
dry :2.0
wet:2.0
feedback:0.0
delay:250
stereo:true
channel :BASS_BFX_CHANALL
ofcourse tried another values but no effects. thank u

To help locate the problem, does it only happen on Android or does it happen on other platforms too?


Android.

UserAlexandr

  • Posts: 37
Re: BASS for Android
« Reply #748 on: 15 Nov '14 - 17:03 »
Hello, how to change the playback speed? I'm using BASS_FX Tempo, but nothing changed...
Code: [Select]
public void setSpeed(float speed)
{
     int fx_channel = BASS_FX.BASS_FX_TempoCreate(channelHandle, BASS_FX.BASS_FX_FREESOURCE);
     BASS.BASS_ChannelSetAttribute(fx_channel, BASS_FX.BASS_ATTRIB_TEMPO, speed);
}

Is there another way to do this? Thx.

norbert

  • Posts: 119
Re: BASS for Android
« Reply #749 on: 16 Nov '14 - 16:34 »
Anyone tested BASS on a real device with the new Android version 5.0 (Lollipop) ?

I've tested it on emulator only, as it seems without any problems   (bass, bassmidi, bassflac, basswv)  :)

When I read this ("If your app makes use of C/C++ code"   JNI Issues)

https://developer.android.com/guide/practices/verifying-apps-art.html

I was first afraid that BASS (in its current state) could be affected, but maybe it'll work just fine without modifications...