Author Topic: BASS for Android  (Read 390026 times)

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1225 on: 22 Dec '16 - 15:51 »
You're right, it was actually after:
const char *name = BASS_MIDI_FontGetPreset(sf, preset, bank);
that it crashed, because name was NULL. Do you see any preset names?

No, I don't think SFZ has a preset name opcode? BASS_MIDI_FontGetPreset could perhaps be made to give the SFZ filename in that case.

But I'm not there yet, since now I can load the file, but nothing gets played (this is with all .sfz's in the package)

Yes, I did hear sound with the few SFZ files that I tried (the harps) from that package. Note that filenames are case-sensitive on Android, so the SFZ "sample" opcodes must match exactly the path/filename of the sample files. The package includes a mixture of lower and uppercase paths/filenames, which you will need to preserve when copying to the Android device. BASSMIDI will handle forward and back slashes, so you don't need to switch those.

To confirm whether it may be a path/filename case issue, you could check if the SFZ files are working on Windows, eg. with the pre-compiled SYNTH.EXE example included in the BASSMIDI package.

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1226 on: 3 Jan '17 - 08:30 »
can i play audio inside Tmemorystream with this library ? i am using firemonkey  and if yes any example for that ?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1227 on: 3 Jan '17 - 15:30 »
I'm not a Delphi/FireMonkey user myself, but I think you would play a TMemoryStream something like this:

Code: [Select]
handle:=BASS_StreamCreateFile(True, memorystream.Memory, 0, memorystream.Size, 0);
BASS_ChannelPlay(handle, False);

Please see the BASS_StreamCreateFile documentation for details on that. Note that the memory must remain in place until the BASS stream is freed (eg. BASS_StreamFree called).

rancidfrog

  • Posts: 7
Re: BASS for Android
« Reply #1228 on: 12 Jan '17 - 09:44 »
Currently BASS library bypasses remote submix.
Is there a way to force routing through submix while using library?
Or OpenSL does not allow for routing?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1229 on: 12 Jan '17 - 14:30 »
I haven't tried it myself, but from the Android docs it looks like STREAM_RING/STREAM_ALARM/STREAM_NOTIFICATION stream types aren't included in remote submix. The "Default" BASS device uses STREAM_MUSIC, but there is also a "Default (alarm)" device that uses STREAM_ALARM. Which device are you using in your BASS_Init call?

rancidfrog

  • Posts: 7
Re: BASS for Android
« Reply #1230 on: 14 Jan '17 - 14:35 »
The issue I am having is that the ROM I use has visualization embedded on navbar which relies on "output "sink", remote submix in which audio may pass through for operations like downsampling (a2dp compliance etc), pre and post processing (fx) and other things including passing track data through the visualizer library. Most output destinations like bluetooth, headphones, music Chromecast, Android intercepts the audio track automatically and routes it through remote submix. The visualizer library gets the track data and we have Pulse. Device speaker output does not require remote submix operations", [ https://github.com/DirtyUnicorns/android_packages_apps_DUI/tree/n7x/src/com/android/systemui/navigation/pulse].

I am not quite sure, as I am not dev.
But both apps that I tested which use BASS library, AIMP and myPlayer, fail in regards to displaying visualizing.
VLC on the other hand works when Audio output AudioTrack is selected, but fails when OpenSL is selected.
The dev of AIMP said forcing AudioTrack, a suggestion of a possibility from this forum, was to complicated, so I was wondering if BASS library was able to route to Android visualizer library, as currently default is not to do so.
Thanks once again for your time

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1231 on: 25 Jan '17 - 17:59 »
The Android versions of the recent BASSDSD/FLAC/OPUS/WV and BASSenc_OPUS add-on updates are up now in the 1st post.

Ya-Grisha

  • Posts: 1
Re: BASS for Android
« Reply #1232 on: 3 Feb '17 - 11:19 »
Good health to you!  :)
I want to thank you for the development of the engine, and to ask whether it is planned
Support AMR format?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1233 on: 3 Feb '17 - 16:19 »
There are no plans for AMR support in BASS at the moment. If you can find an AMR decoder library, then you could use that with BASS via a custom stream, ie. BASS_StreamCreate. When BASS requests data from your STREAMPROC callback function, it would get the data from the AMR decoder.

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1234 on: 9 Feb '17 - 17:34 »
A BASSDSD add-on update is up now in the 1st post to fix a problem with DFF format support on Android (other platforms are unaffected).

DaveAE

  • Posts: 8
Re: BASS for Android
« Reply #1235 on: 14 Feb '17 - 14:44 »
Yes, I did hear sound with the few SFZ files that I tried (the harps) from that package. Note that filenames are case-sensitive on Android, so the SFZ "sample" opcodes must match exactly the path/filename of the sample files. The package includes a mixture of lower and uppercase paths/filenames, which you will need to preserve when copying to the Android device. BASSMIDI will handle forward and back slashes, so you don't need to switch those.

To confirm whether it may be a path/filename case issue, you could check if the SFZ files are working on Windows, eg. with the pre-compiled SYNTH.EXE example included in the BASSMIDI package.

Sorry for the late reply. Turned out I did not copy the samples where the sfz's were pointing to. I was used to just copying sf2 files which have the data embedded, sorry!

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1236 on: 21 Feb '17 - 15:36 »
Where to fine bass for fire monkey ?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1237 on: 21 Feb '17 - 15:49 »
Here is a thread with some info on using BASS on Android with FireMonkey:

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

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1238 on: 21 Feb '17 - 16:11 »
i have downloaded bass-24 android i cannot find bass.pas inside it

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1239 on: 21 Feb '17 - 16:27 »
The Delphi/Pascal BASS.PAS file can be found in the Windows and Linux BASS packages. I'm not a FireMonkey user myself, but from that thread it looks it may need some modification for FireMonkey. There are some modified versions of it posted in the thread.

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1240 on: 21 Feb '17 - 16:45 »
hmm yes i can see , but those plugin load cannot be found in the android bass that i just downloaded

    BASS_PluginLoad(PChar(DocDir + 'libbass_aac.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_alac.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_ape.so'), BASS_UNICODE);
    BASS_PluginLoad(PChar(DocDir + 'libbass_mpc.so'), BASS_UNICODE);

are they changed ? or there name changed ?

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1241 on: 23 Feb '17 - 14:15 »
The BASS_ALAC add-on (libbass_alac.so) was replaced by a new BASSALAC add-on (libbassalac.so). The rest of them are the same as before, but note that they are separate downloads (links in the 1st post).

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1242 on: 23 Feb '17 - 16:50 »
i tried to play memorystream but sadly i got now sound i have did the initiate of the bass in the main form then try to play from a thread without any luck

Code: [Select]
if LoadBASS  then
begin
if LoadBASSPlugins then
begin
 BASS_Init(-1, 44100, BASS_DEVICE_DEFAULT, self.Handle, nil);
end;

end;

playing stream in thread
Code: [Select]
while not Terminated  do
begin
  Stream := AudioQueue.Dequeue;
  if AudioQueue.Count > 0 then
  begin
    Stream.Position := 0;
    try
      AudioDataSize := BASS_StreamCreateFile(True,Stream.Memory,0,Stream.Size, 0 {$IFDEF UNICODE} or BASS_UNICODE {$ENDIF});
      BASS_ChannelPlay(AudioDataSize, False);
    except
      //log any exception
    end;
  end
  else
    AudioInQueue.ResetEvent;
end;

but sadly no sound

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1243 on: 23 Feb '17 - 17:06 »
What is the return value from the BASS_StreamCreateFile call, ie. the "AudioDataSize" value? If it's 0, that means the call failed. In that case, you can find out why it failed by calling BASS_ErrorGetCode straight after and looking up the returned error code in the BASS_StreamCreateFile documentation.

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1244 on: 23 Feb '17 - 17:18 »
Value returned is  0

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1245 on: 23 Feb '17 - 17:22 »
Error code 41 Error File Format . how could be this ? its an memorystream raw audio
« Last Edit: 23 Feb '17 - 17:25 by drama22 »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1246 on: 23 Feb '17 - 17:44 »
BASS_StreamCreateFile needs a signature (eg. header or some other structure) to detect the format of the file and initialize a parser/decoder to process it. Raw data doesn't have any such signature, so there is no way for BASS_StreamCreateFile detect what it is. BASS_StreamCreate can be used to play that data instead (you can tell it what the data's format is).

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1247 on: 23 Feb '17 - 17:49 »
BASS_StreamCreate its not exist in the wraper that posted into the other thread

drama22

  • Posts: 17
Re: BASS for Android
« Reply #1248 on: 23 Feb '17 - 18:18 »
i have added that function to the wrapper but i think i call it in incorrect way because the sound its not play correctly

the raw data were in ENCODING_PCM_16BIT and 8000 buffersize what i am doing wrong ?

AudioDataSize := BASS_StreamCreate(8000,2, BASS_SAMPLE_8BITS, STREAMPROC_DUMMY ,Stream.Memory);
« Last Edit: 23 Feb '17 - 18:22 by drama22 »

Ian @ un4seen

  • Administrator
  • Posts: 20389
Re: BASS for Android
« Reply #1249 on: 24 Feb '17 - 12:36 »
Rather than STREAMPROC_DUMMY, you should use STREAMPROC_PUSH in the BASS_StreamCreate call to create a "push" stream. You can then use BASS_StreamPutData to pass the data to the stream. If you are playing a large block of data, a more memory efficient option is to use a STREAMPROC callback function, and feed the data to the stream in smaller blocks through that. Please see the BASS_StreamCreate documentation for details.