Author Topic: BASS for ARM Linux  (Read 288525 times)

zittergie

  • Posts: 31
Re: BASS for ARM Linux
« Reply #25 on: 26 Nov '12 - 21:51 »
Hi Ian,
Is an arm version of BASS FX coming?
I would like to create a reverse stream on arm.

zittergie

  • Posts: 31
Re: BASS for ARM Linux
« Reply #26 on: 3 Dec '12 - 20:38 »
Just recompiled my application on the raspberry pi (raspbian) with Lazarus using bass & bassflac and everything worked out fine.

AndroidMediaPlayer

  • Posts: 25
Re: BASS for ARM Linux
« Reply #27 on: 8 Dec '12 - 08:22 »
Hi Ian,

got my RPi yesterday. BASS works fine with it. Now we need more Addons. ;)

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #28 on: 10 Dec '12 - 15:43 »
Good to hear that things are working well. If there is a particular add-on that you're missing, let me know, and I'll see what can be arranged :)

AndroidMediaPlayer

  • Posts: 25
Re: BASS for ARM Linux
« Reply #29 on: 10 Dec '12 - 17:31 »
Ape and Alac if you can would be great, other addons are welcome to, but not so important (for me). A player with more supported Formats is better than a player with less. ;)

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #30 on: 11 Dec '12 - 14:50 »
OK. ARM Linux versions of those 2 add-ons are now up in the first post. Let me know if you have any trouble with them.

void256

  • Guest
Re: BASS for ARM Linux
« Reply #31 on: 29 Dec '12 - 03:18 »
Hi,

BASS works great on my PI as well! I can load and play an MP3 using the hardfp version without any problems which is just awesome!  :)

However it seems that I'm not able to get FFT-Data using BASS_ChannelGetData(). I only get back an empty float array (all values being 0.0):

Code: [Select]
while (1) {
                // BASS_ChannelGetLevel works!
                DWORD level, left, right;
                level=BASS_ChannelGetLevel(chan);
                left=LOWORD(level); // the left level
                right=HIWORD(level); // the right level
                printf("%i %i\n", left, right);

                // BASS_ChannelGetData only returns an array of 0.0 (I'd expect different float values)
                float fft[512]; // fft data buffer
                DWORD res = BASS_ChannelGetData(chan, fft, BASS_DATA_FFT1024);
                int i;
                for (i=0; i<512; i++) {
                        printf("%f ", fft[i]);
                }
                printf("\n (%i)\n", res);
        }

Maybe I'm using BASS wrong? Or it might be something else? Someone had success getting FFT-Data on a PI?

Thank you!

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #32 on: 31 Dec '12 - 15:39 »
In the ARM Linux version, BASS_ChannelGetData actually delivers FFT data in 8.24 fixed-point form, even in the "hardfp" build. So you would need to modify your code like this...

Code: [Select]
               int fft[512]; // fft data buffer
                DWORD res = BASS_ChannelGetData(chan, fft, BASS_DATA_FFT1024);
                int i;
                for (i=0; i<512; i++) {
                        float f=(float)fft[i]/(1<<24);
                        printf("%f ", f);
                }

If you're still seeing only 0.0, please confirm what the BASS_ChannelGetData call is returning, ie. the "res" variable value.
« Last Edit: 31 Dec '12 - 17:50 by Ian @ un4seen »

xStSx

  • Posts: 11
Re: BASS for ARM Linux
« Reply #33 on: 4 Jan '13 - 13:58 »
Hi,
I'm using Raspberry Pi and ArchlinuxARM(3.6.11-2-ARCH+).
I'm trying to build simple examp of libbass but i'm unable to get it playing.

Here is my code:
Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <bass.h>
#include <unistd.h>

void geterror(char *msg)
{
printf("%s:%d\n", msg, BASS_ErrorGetCode());
}

int main(int argc, char *argv[])
{
int pos = 0;
int len = 0;
HSTREAM stream;
char *filepath = argv[1];

printf("\n-----------------------------------------------------------\n");

DWORD ver = BASS_GetVersion();
printf ("\nBASS Version: %d.%d.%d.%d\n\n",(ver>>24)&0xff, (ver>>16)&0xff, (ver>>8) & 0xff, (ver & 0xff));

if(!BASS_Init(-1, 44100, BASS_DEVICE_DMIX, 0, NULL))
{
geterror("Init Error");
}


// ------------------ Get Devices --------------------
int a;
BASS_DEVICEINFO info;
printf("*****Devices Info:*****\n");
for(a=0; BASS_GetDeviceInfo(a, &info);a++)
{
printf("Device %d:%s - %s - %d\n", a, info.name, info.driver, info.flags);
}
printf("\n");
// ---------------------------------------------------




// ----------------- Current Device ------------------
if(BASS_GetDevice() == -1)
geterror("Device Error");
else
printf("Selected Device:%d\n", BASS_GetDevice());
// ---------------------------------------------------




// ---------------- Get Global Volume ----------------
if(BASS_GetVolume() == -1.0)
geterror("Cann't Get Volume Error");
else
printf("%f\n", BASS_GetVolume());
// ---------------------------------------------------


// ---------------- Create Stream --------------------
stream = BASS_StreamCreateFile(FALSE, filepath, 0, 0, 0);
if(stream == 0)
geterror("StreamCreate Error");
else
printf("StreamHandle:%d\n",stream);
// ---------------------------------------------------


len = BASS_ChannelBytes2Seconds(stream,BASS_ChannelGetLength(stream, BASS_POS_BYTE));
pos = 0;

// ---------------- Get Channel Info -------------------
BASS_CHANNELINFO chan_info;
BASS_ChannelGetInfo(stream, &chan_info);
printf("\n*****Channel Info:*****\n");
printf("Freq:%d\n",chan_info.freq);
printf("Channels:%d\n",chan_info.chans);
printf("Bps%d\n",chan_info.origres);
printf("Filename:%s\n\n",chan_info.filename);
printf("\n");
// -----------------------------------------------------

        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}
while(1)
{
if(BASS_ChannelIsActive(stream) != 0)
{
pos = BASS_ChannelBytes2Seconds(stream, BASS_ChannelGetPosition(stream, BASS_POS_BYTE));

if(len == pos)
break;

printf("%02d:%02d - %02d:%02d\n",(int)(len/60), (int)(len%60), (int)(pos/60), (int)(pos%60));
}
usleep(100000);
}
BASS_ChannelStop(stream);
BASS_StreamFree(stream);

BASS_Free();


return 0;
}

Output of this code:
Code: [Select]
-----------------------------------------------------------

BASS Version: 2.4.9.3

*****Devices Info:*****
Device 0:No sound - (null) - 1
Device 1:Default - default - 7
Device 2:bcm2835 ALSA: bcm2835 ALSA - hw:0,0 - 1

Selected Device:1
Cann't Get Volume Error:37
StreamHandle:-1342177279

*****Channel Info:*****
Freq:44100
Channels:2
Bps0
Filename:./Red Hot Chillipeper - Snow.mp3

GetVolume() return -1.0 with ErrorCode 37 (37 = BASS_ERROR_NOTAVAIL There is no volume control when using the "no sound" device.) but I'm using device 1.  ???

as well no sound, and stream doesn't playing.
Am I missing something ?
Thank you.
Stas.
« Last Edit: 4 Jan '13 - 14:03 by xStSx »

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #34 on: 4 Jan '13 - 16:31 »
Code: [Select]
        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}

Those BASS_ChannelPlay parameters should be the other way round, ie. the stream handle should be the 1st parameter. Also, a "TRUE" return value would indicate success rather than failure, so that needs to be changed too, ie. add a "!" in there. Let me know if it's still not working after doing that.

GetVolume() return -1.0 with ErrorCode 37 (37 = BASS_ERROR_NOTAVAIL There is no volume control when using the "no sound" device.) but I'm using device 1.  ???

It is also possible that BASS can't find a volume control on a soundcard/driver (I'll get the docs updated to mention that!), which seems to be the case there. In that case, the global volume options (eg. BASS_CONFIG_GVOL_STREAM) are still available to control the level of the BASS output.

xStSx

  • Posts: 11
Re: BASS for ARM Linux
« Reply #35 on: 4 Jan '13 - 17:52 »
Code: [Select]
        if(BASS_ChannelPlay(TRUE, stream))
{
geterror("Play");
}

Those BASS_ChannelPlay parameters should be the other way round, ie. the stream handle should be the 1st parameter. Also, a "TRUE" return value would indicate success rather than failure, so that needs to be changed too, ie. add a "!" in there. Let me know if it's still not working after doing that.

oops.. so stupid mistake  :)

Code: [Select]
        if(!BASS_ChannelPlay(stream, TRUE))
{
geterror("Play");
}

It's working , thanks  ;D

void256

  • Guest
Re: BASS for ARM Linux
« Reply #36 on: 5 Jan '13 - 16:11 »
In the ARM Linux version, BASS_ChannelGetData actually delivers FFT data in 8.24 fixed-point form, even in the "hardfp" build.

Thanks a lot! It works now!

And Ian? You Rock!  :D

drugoimir

  • Posts: 39
Re: BASS for ARM Linux
« Reply #37 on: 7 Jan '13 - 17:39 »
Hi Ian,

is also bassenc planned to be recompiled for arm?

Bye
Tom

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #38 on: 8 Jan '13 - 14:41 »
Yep. An ARM Linux version of the BASSenc add-on is now up in the first post.

drugoimir

  • Posts: 39
Re: BASS for ARM Linux
« Reply #39 on: 8 Jan '13 - 20:39 »
Great Ian!!!!
I'll try and let you know!

Thanks!

drugoimir

  • Posts: 39
Re: BASS for ARM Linux
« Reply #40 on: 10 Jan '13 - 00:15 »
Hello Ian,

regarding the first tests on bassenc-arm-hf,
i recompiled your "server" test application
and tried with an usb headset.
So i get, at the client end, a glitchy audio,
something like if some samples were missing,
something like if i have a N length buffer but
i miss 1 or 2 samples when i read from it (or write to).
I cannot explain in a better way, but i used this
example because it is the same effect i got when
i was experimenting with the dsp callback and
i was processing the wrong number of samples.
Likewise, the vlc player i'm using, often disconnects
for a while then immediately rebuffers and restart, like
it's consuming data faster than those the encoder can produce.

I tried the mp3 encoder alone from console window,
converting a wav file into an mp3 and it seems ok.
I tried to write the encoded data directly to disc, instead
of streaming them out, tried both mp3 and wav,
and i get the "glitchy" audio on both.
The usb headset was brand new, i didn't know if it could
be defective, so i plugged it into a windows machine and it is ok.
Finally, i copied the same source i'm testing on the arm machine
and recompiled it on a linux-386: using your linux-386
bass and bassenc, all is ok, no glitches, no client disconnecting.

 ???
Bye
Tom

[edited]
after further investigation, it seems a driver/hardware problem
related to usb stream not being synchronized.
Hoping that someone will fix that.
« Last Edit: 10 Jan '13 - 15:22 by drugoimir »

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #41 on: 12 Jan '13 - 08:20 »
Another bump for bass_fx for Pi. :)

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #42 on: 12 Jan '13 - 15:06 »
It's on the way. Shouldn't be very much longer I think :)

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #43 on: 20 Jan '13 - 15:49 »
I see bass_fx in the Original Post now. Thanks much! :)

AndroidMediaPlayer

  • Posts: 25
Re: BASS for ARM Linux
« Reply #44 on: 23 Jan '13 - 22:55 »
Hey Ian,

plugins works fine, thanx. Whats about BASS_TAG for Linux / Android / ARM (PI)? Would it be possible? :)

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #45 on: 24 Jan '13 - 16:31 »
It was a while ago, but I did look into an Android version of the TAGS add-on and I recall there were some problems (C++ library issues I think). There have been NDK updates since then, so perhaps things have changed. I'll have to check again :)

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #46 on: 26 Jan '13 - 01:14 »
Hello,

Please excuse me for any ignorance I display here as I have a lot of it on this subject. :P

Someone has just implemented hardware acceleration for Vorbis on Raspberry Pi (http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=19334&start=275#p269992) among other codecs (all video besides Vorbis.) What would it take to use this in BASS?

I didn't have a bare bones BASS program to test with, but ogg123 eats about 9-10% of the Pi CPU just playing an OGG from flash. Seems to me if I could get an extra WHATEVER (~5%? I'm not sure) reduction that would help huge on such a low spec system (I make games.)

Anyway, just throwing this out there and letting you know it exists if you haven't seen it.

Thanks,
Trent

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #47 on: 6 Feb '13 - 04:46 »
Well that last post went un-replied to, but it was really just hopeful thinking anyway.. this is more important.

Foremost: will we see an mp3-free version for ARM? And secondly, hypothetically because I'm not going to be releasing my game in the immediate future, how do we get a license for the ARM version?

Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 26021
Re: BASS for ARM Linux
« Reply #48 on: 6 Feb '13 - 17:15 »
An "mp3-free" BASS build (which will use libmpg123 when present) has now been added to the ARM Linux package in the 1st post. The standard BASS version has also been updated to the latest stuff at the same time.

Regarding licensing, the ARM Linux version is covered by the Linux BASS licence, so you can get that when you're ready to go :)

trentggg

  • Guest
Re: BASS for ARM Linux
« Reply #49 on: 7 Feb '13 - 02:25 »
Thanks Ian. I have most of the available licenses already (except Windows CE) :D.