BASS for iOS (iPhone/iPad)

Started by Ian @ un4seen,

Ian @ un4seen

I'm not a Swift user myself, so unfortunately I can't really help with that, but perhaps this will help?

   https://github.com/Starling-Inc/Bass

pgorasva

Need Help.

How to do type conversion ?

Ian @ un4seen

I'm not a Swift user myself, so this is just a guess, but how about something like this?

let infoPlay = UnsafeMutablePointer<BASS_CHANNELINFO>.allocate(capacity: 1)
...
infoPlay.deallocate()

pgorasva

Hello Ian,

How can use BASS_ATTRIB_TEMPO_PITCH for different voice conversion ?

Ian @ un4seen

The BASS_ATTRIB_TEMPO_PITCH value can be set via BASS_ChannelSetAttribute but only on tempo streams, ie. streams created with BASS_FX_TempoCreate (from the BASS_FX add-on).

pgorasva

#1280
Quote from: Ian @ un4seenThe BASS_ATTRIB_TEMPO_PITCH value can be set via BASS_ChannelSetAttribute but only on tempo streams, ie. streams created with BASS_FX_TempoCreate (from the BASS_FX add-on).

Thanks Ian.

BASS_ChannelPlay(playStream!, false)

How to get new file path.? i need to send file path to server and play on different platform.

Ian @ un4seen

Do you want to get the filename of an existing stream? If so, that is available from BASS_ChannelGetInfo (see the BASS_CHANNELINFO "filename" field).

pgorasva

#1282
Quote from: Ian @ un4seenDo you want to get the filename of an existing stream? If so, that is available from BASS_ChannelGetInfo (see the BASS_CHANNELINFO "filename" field).


After this i need to create new file which has this audio effect.

is there any idea to how to do this. ?

Thanks!

Ian @ un4seen

You can use the BASSenc add-on to write a new file. For example, to write a WAV file, you can do this:

encoder = BASS_Encode_Start(mChanPlay, filename, BASS_ENCODE_PCM, NULL, NULL);

The WAV file will then be written while the original file is decoded/played. Use BASS_Encode_Stop (on the "encoder" handle) afterwards to close the WAV file.

On iOS, you can use BASS_Encode_StartCAFile instead of BASS_Encode_Start for AAC for ALAC encoding. There are also add-ons available for FLAC, Ogg Vorbis, Opus encoding.

pgorasva

#1284
Quote from: Ian @ un4seenYou can use the BASSenc add-on to write a new file. For example, to write a WAV file, you can do this:

encoder = BASS_Encode_Start(mChanPlay, filename, BASS_ENCODE_PCM, NULL, NULL);

The WAV file will then be written while the original file is decoded/played. Use BASS_Encode_Stop (on the "encoder" handle) afterwards to close the WAV file.

On iOS, you can use BASS_Encode_StartCAFile instead of BASS_Encode_Start for AAC for ALAC encoding. There are also add-ons available for FLAC, Ogg Vorbis, Opus encoding.

Thanks Ian.

i am using this https://github.com/Starling-Inc/Bass.

if i remove this and add manually bass.h and bass_fx.h and bassenc.h than i get this types of error (Use of unresolved identifier BASS_FX_TempoGetSource.) 

now what can do for encoding file.?

or
using GitHub link how to load BASSENC plugin ?

Ian @ un4seen

Quote from: pgorasvai am using this https://github.com/Starling-Inc/Bass.

It looks like the way they've done it is to append the add-on headers to the BASS.H file, so you could take the BASSENC.H file from the BASSenc package on the BASS page and copy'n'paste it to the end of that BASS.H file. Or perhaps add an #include "bassenc.h" line to the BassPluginLoad.c file instead.

pgorasva

#1286
encoder = BASS_Encode_Start(mChanPlay, filename, BASS_ENCODE_PCM, NULL, NULL);

can you describe more .?



pgorasva

#1289
Can we encode to wave file without BASS_ChannelPlay .?


Ian @ un4seen

Yes. For that you need to create a "decoding channel" by using the BASS_STREAM_DECODE flag in your BASS_StreamCreateFile call, and then repeatedly call BASS_ChannelGetData on it (eg. in a worker thread or timer) until you reach the end.

pgorasva

Thanks Ian.

if i remove this line BASS_ChannelPlay(mChanPlay!, false) than my new file is empty.

how to write in file without BASS_ChannelPlay(mChanPlay!, false)  .?

Can you help us.? share some example to how to do this.

 

Ian @ un4seen

That sounds like you probably didn't add the BASS_STREAM_DECODE flag to your BASS_StreamCreateFile call. You could do something like this:

DWORD decoder = BASS_StreamCreateFile(false, filename, 0, 0, BASS_STREAM_DECODE); // create a decoder for the file
DWORD encoder = BASS_Encode_Start(decoder, outfilename, BASS_ENCODE_PCM | BASS_ENCODE_AUTOFREE, 0, 0); // set a WAV writer on it

// processing loop
while (1) {
BYTE buf[20000]; // processing buffer
int r = BASS_ChannelGetData(decoder, buf, sizeof(buf)); // process the decoder (feeds the encoder)
if (r < 0) break; // reached the end
}

BASS_StreamFree(decoder); // free the decoder (and encoder due to AUTOFREE)

pgorasva

Quote from: Ian @ un4seenThat sounds like you probably didn't add the BASS_STREAM_DECODE flag to your BASS_StreamCreateFile call. You could do something like this:

DWORD decoder = BASS_StreamCreateFile(false, filename, 0, 0, BASS_STREAM_DECODE); // create a decoder for the file
DWORD encoder = BASS_Encode_Start(decoder, outfilename, BASS_ENCODE_PCM | BASS_ENCODE_AUTOFREE, 0, 0); // set a WAV writer on it

// processing loop
while (1) {
BYTE buf[20000]; // processing buffer
int r = BASS_ChannelGetData(decoder, buf, sizeof(buf)); // process the decoder (feeds the encoder)
if (r < 0) break; // reached the end
}

BASS_StreamFree(decoder); // free the decoder (and encoder due to AUTOFREE)

it's work.

Thanks Ian.

Ian @ un4seen

The iOS version of the new BASSenc, BASSenc_FLAC and BASSenc_MP3 releases are up now in the 1st post.

vandenbrakel

I'm trying to figure out which (compressed) audio format would use the least cpu with Bass on iOS. I've found out that m4a works better than ogg.

Any wise words on this?

Thanks.

Ian @ un4seen

Yes, M4A/AAC files are indeed likely to use less CPU because they can use hardware accelerated decoding on iOS devices. That applies to MP3 too when using the "mp3-free" BASS version.

vandenbrakel

Thanks! Very usefull.

Quote from: Ian @ un4seenYes, M4A/AAC files are indeed likely to use less CPU because they can use hardware accelerated decoding on iOS devices. That applies to MP3 too when using the "mp3-free" BASS version.

khoinguyenios

Hi all, I'm struggling with MPNowPlayingInfoCenter when using BASS. It doesn't update like play/pause status, playback position...
Anyone has an example that I could follow?

Thanks a lot

nikos

On Ios 64  The function bass_record_start Gives Error on Delphi's IDE.Works fine in ios 32
Any solution?