Author Topic: BASS for Android  (Read 695976 times)

jnyang

  • Guest
Re: BASS for Android
« Reply #1800 on: 5 Jan '21 - 10:55 »
Here's an update for you to try:

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

Let me know if you have any trouble with it. Besides fixing your problem (hopefully), it has also switched to using the Android codecs via the native API instead of the Java API to improve performance a bit. BASS has up to now been using the Java API because it works on Android 4.1, while the native API requires Android 5, but there can't be many people still using Android 4.x now? BASS will still work on those (and older) Android versions but Android's codecs won't be used on them.

Hi Ian, I recently updated the BASS library to the latest version, but it seems that the above bug fix is not included. When my app tries to open a file that should be handled by Android's native codec (e.g., WMA, M4A), BASS throws BASS_ERROR_FILEFORM error and the log outputs like "E/ClearFileSource: Failed to open file '/mnt/media_rw/3D9F-BC89/Musics/test.wma'. (Permission denied)".

I tried to re-download the fixed version of BASS library from above link, but it seems that the link does not work anymore.
Can you check this bug again? Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1801 on: 5 Jan '21 - 14:33 »
Yes, that change isn't in the release version yet, which is still 2.4.15. It will be in 2.4.16, which should be released fairly soon. In the meantime, the latest build's URL has changed slightly to this:

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

The old bass-android-test.zip URL has now been re-enabled too (pointing to the same file), for anyone that's monitoring it for updates.

jnyang

  • Guest
Re: BASS for Android
« Reply #1802 on: 6 Jan '21 - 04:43 »
Yes, that change isn't in the release version yet, which is still 2.4.15. It will be in 2.4.16, which should be released fairly soon. In the meantime, the latest build's URL has changed slightly to this:

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

The old bass-android-test.zip URL has now been re-enabled too (pointing to the same file), for anyone that's monitoring it for updates.

Thank you for your reply. Happy new year!

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1803 on: 6 Jan '21 - 17:03 »
The Android version of the BASSALAC 2.4.0.2 release is up now in the 1st post.

gicci

  • Posts: 76
Re: BASS for Android
« Reply #1804 on: 7 Jan '21 - 01:50 »
Hi Ian,

I am testing some files with drums configured on multiple channels, but I am getting param=2 in the corresponding MIDI_EVENT_DRUMS events, not 1 as stated in the documentation.
Shall any value != 0 be interpreted as drums? Does this values carry any additional information?

Thank you.

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1805 on: 7 Jan '21 - 17:14 »
That's strange. Please upload one of the MIDI files to have a look at here:

   ftp.un4seen.com/incoming/

Also confirm that you're using the latest BASSMIDI version.

gicci

  • Posts: 76
Re: BASS for Android
« Reply #1806 on: 7 Jan '21 - 18:22 »
I have sent a sample file. Tested with the latest version with the same results. I am using BASS_MIDI_StreamGetEvents(), not looking for them during the playback.

Serg

  • Posts: 7
Re: BASS for Android
« Reply #1807 on: 7 Jan '21 - 20:08 »
Good day! Please tell me, on the android you need to output sound with a slight delay, without using a remote microphone. However, there is strong background audio and noise (unless a separate external microphone is used) :'( .
How to get rid of the squeak, noise?
I am using the following code:

BASS.BASS_SetConfig (BASS. BASS_CONFIG_DEV_BUFFER , 2000);
BASS.BASS_Init(-1, FREQ, 0);
..........

record=BASS.BASS_RecordStart(FREQ, chan, 0, null, null);

output=BASS.BASS_StreamCreate(FREQ, chan, 0, StreamProc, null);
BASS.BASS_ChannelSetAttribute(output, BASS.BASS_ATTRIB_NOBUFFER, 1);
BASS.BASS_ChannelPlay(output, false);
.......

BASSAMPROC(int handle, ByteBuffer buffer, int length, Object user) {
         int r=BASS.BASS_ChannelGetData(record, buffer, length); // get data from the recording
         return r;
      }
   };

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1808 on: 8 Jan '21 - 16:49 »
I have sent a sample file. Tested with the latest version with the same results. I am using BASS_MIDI_StreamGetEvents(), not looking for them during the playback.

Ah, I see what it is now. In GS files (like the one you uploaded), the "USE FOR RHYTHM PART" sysex translates to a MIDI_EVENT_DRUMS event, and it can be set to 2 to request the 2nd drum map (GS allows up to 2). BASSMIDI doesn't have a limited number of global drum maps, rather each drum channel has its own map (with its own MIDI_EVENT_DRUM_XXX settings), so it will treat any non-0 setting as 1.

Good day! Please tell me, on the android you need to output sound with a slight delay, without using a remote microphone. However, there is strong background audio and noise (unless a separate external microphone is used) :'( .
How to get rid of the squeak, noise?
I am using the following code:
...

That sounds like what you're hearing is feedback, ie. the speaker is playing the sound from the microphone and the microphone is capturing it again. That can be avoided by using headphones. Otherwise, you will need some AEC (Acoustic Echo Cancellation). Unfortunately, BASS doesn't include that feature but if you would like to give it a try, Android has an AcousticEchoCanceler effect (note you will need to use the AudioRecord API instead of BASS_RecordInit/etc for recording then):

   https://developer.android.com/reference/android/media/audiofx/AcousticEchoCanceler.html

If that doesn't work for you, there is also the libspeex library that includes AEC processing (speex_echo_xxx functions), but I'm not sure whether there is a ready-made Android build of that available.

Serg

  • Posts: 7
Re: BASS for Android
« Reply #1809 on: 8 Jan '21 - 19:08 »
Thank you very much! I will try

Serg

  • Posts: 7
Re: BASS for Android
« Reply #1810 on: 17 Jan '21 - 09:11 »
I'm trying to use "audioRecord", but something doesn't work. The following code doesn't work, the crash occurs on "Output = BASS.BASS_StreamCreateFile (recbuf, 0, recbuf.limit (), 0);" ... Please tell me what I'm doing wrong?

  readCount = audioRecord.read(myBuffer, 0, myBufferSize);

  ByteBuffer recbuf = ByteBuffer.wrap(myBuffer,0,myBuffer.length);

  Output  = BASS.BASS_StreamCreateFile(recbuf, 0, recbuf.limit(), 0); //Falling
  BASS.BASS_ChannelPlay(Output, true);

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1811 on: 18 Jan '21 - 13:56 »
BASS_StreamCreateFile will need a WAVE header in front of the sample data (to describe the format of it). You can use BASS_StreamCreate instead to play raw PCM data.

Serg

  • Posts: 7
Re: BASS for Android
« Reply #1812 on: 21 Jan '21 - 05:47 »
BASS_StreamCreateFile will need a WAVE header in front of the sample data (to describe the format of it). You can use BASS_StreamCreate instead to play raw PCM data.

Nothing works with BASS_StreamCreate (), can you give an example with BASS_StreamCreate ()?

Ian @ un4seen

  • Administrator
  • Posts: 23288
Re: BASS for Android
« Reply #1813 on: 21 Jan '21 - 13:05 »
You would use BASS_StreamCreate something like this:

Code: [Select]
stream = BASS.BASS_StreamCreate(freq, chans, 0, StreamProc, null); // create stream
BASS.BASS_ChannelPlay(stream, false); // start it

BASS.STREAMPROC StreamProc = new BASS.STREAMPROC() {
public int STREAMPROC(int handle, ByteBuffer buffer, int length, Object user) {
// put up to "length" bytes of data in "buffer" here and return the amount
}
};

Another option is to create a "push" stream, where you use BASS_StreamPutData instead of a STREAMPROC to provide the data. Something like this:

Code: [Select]
stream = BASS.BASS_StreamCreate(freq, chans, 0, BASS.STREAMPROC_PUSH, null); // create stream
BASS.BASS_StreamPutData(stream, buffer, length); // give it data to play
BASS.BASS_ChannelPlay(stream, false); // start it

Please see the BASS_StreamCreate documentation for details.