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

nibbo

  • Posts: 7
Re: BASS for ARM Linux
« Reply #275 on: 29 Apr '15 - 16:04 »
Bass.Net.Linux.dll: I drove it through ILSpy to be sure, but there is no such enum value in BassConfig. It's the version from 19-1-2015.

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #276 on: 7 May '15 - 18:22 »
The ARM Linux version of the latest BASSenc add-on release (2.4.12.7) is now up in the 1st post.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #277 on: 20 May '15 - 13:58 »
Hello Ian,
I have tried the HWFloat enabled bass for Linux ARM version using mono on a Raspberry pi 2 and a C1-Odroid.
It appears that the check for floating point support (BASS_StreamCreate(44100, 1, BASS_SAMPLE_FLOAT, NULL, NULL)) always returns 0 on both devices, while creating a stream without the BASS_SAMPLE_FLOAT flag was successful.
They both have mono version 3.2.8 (Hardfloat) installed.
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen


And the libbass.so version I use is:
libbass.so (libc6,hard-float) => /usr/local/lib/libbass.so
As a Linux beginner I probably overlooked something, but would this mean that BASS_SAMPLE_FLOAT is not supported, right?
Could you explain what I am missing here?
If so, how can I enable support for playing files that have a 32 bit sample size?
Thank you.


Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #278 on: 20 May '15 - 17:39 »
What is the error code from the BASS_StreamCreate call? You can use BASS_ErrorGetCode to check that. Please also check that you are definitely using the "libbass.so" file that's in the "hardfp" directory of the BASS package, as it should always support the use of the BASS_SAMPLE_FLOAT flag.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #279 on: 21 May '15 - 08:22 »
Thanks for your reply.
I have modified the code to get the errorcode as presented by bass:

var floatable = Bass.BASS_StreamCreate(44100, 2, BASSFlag.BASS_SAMPLE_FLOAT, null, IntPtr.Zero);
            if (floatable > 0)
            {
                Console.Write("Float supported" + Environment.NewLine);
                Bass.BASS_StreamFree(floatable);
            }
            else
            {
                Console.Write("Float not supported" + Environment.NewLine);
                Console.Write(string.Format("Error encountered: {0}",Bass.BASS_ErrorGetCode()));
            }


The outcome of BASS_ErrorGetCode() = BASS_OK. This is strange.

I also double checked the version of libbass.so. It appears to be the correct one. I downloaded the linux arm version from the first post in this forum and copied the libbass.so from the hardfp folder to the usr/local/lib folder. Gave it execution credentials and did a "ldconfig". Not sure if I have to add the file to some kind of group. (staff or root, I just took root) I also rebooted just to make sure. The results are the same: float not supported but BASS reported BASS_OK. Any advise?

Thank you.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #280 on: 21 May '15 - 10:23 »
BTW, The BASS_StreamCreate function returns a negative value, not 0.
I was under the impression that only positive values indicate a successful creation of a stream?

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #281 on: 21 May '15 - 15:07 »
A negative value can be a valid stream handle, so it sounds like the BASS_StreamCreate call was actually successful. Does a subsequent BASS_ChannelPlay call on the stream succeed?

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #282 on: 23 May '15 - 19:40 »
Thank you for your reply. Yes, a subsequent ChannelPlay call succeeds. I have tested it with the dummy stream and with real streams, even dsf file based streams produce a very nice sound ;) on the raspberry Pi2 using a SA9023 USB receiver based USB DAC. I am impressed!
The Odroid-C1 however has some USB DAC issues and is not capable of playing using Bass. In fact, the C1 crashes at the moment Bass wants to create a stream. Aplay however is capable of playing without crashing the system. I'm not 100 percent sure who is to blame here. Apart from the libraries I used the same "Bass powered" program in a Windows, a x86 based Linux and an ARM based environment (raspberry and odroid). Only the odroid fails to play. This is probably not the right place to ask, but are you familiar with these kind of issues with C1-odroid ?

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #283 on: 25 May '15 - 17:00 »
I could send you a debug BASS version to help find out what's causing the crash with the Odroid-C1. To determine what the debug should be checking, in what BASS function call is the crash occurring?

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #284 on: 26 May '15 - 07:54 »
Thank you Ian, that would be great. Along with some instructions as to how to interpret the debug outcome, would be nice.
In the mean time I have found people with similar problems, C1-odroid related, but not bass ;). I have followed the steps they took in trying to solve the issues, like removing pulseaudio. Too bad it didn't work for me. Anyway, looking forward to the debug version of bass.

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #285 on: 26 May '15 - 16:42 »
Each debug BASS version is tailored to the problem that is being debugged (there would be too much irrelevant stuff to wade through if it always debugged everything), so please confirm what BASS function call (with parameters) the crash is occurring in, for an idea of what the debug version should be checking.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #286 on: 28 May '15 - 07:54 »
Okay, here is a code snippet I used. This is just a testcode I use in a small console program just to see if the functions I need are supported. The mixer is there just to enable gapless playback. The exact function at which the crash occurs is way before the mixer creation: var stream = Bass.BASS_StreamCreateFile(pathplusfile, 0, 0, flags);
The file it tries to play is in the exact same folder as the executing program, hence the pathplusfile.
Code: [Select]
[b]
 var flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_UNICODE | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_FLOAT;
            var pathplusfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "wavfile.wav");
            Console.Write(string.Format("We are looking for {0} {1}", pathplusfile, Environment.NewLine));
            var stream = Bass.BASS_StreamCreateFile(pathplusfile, 0, 0, flags);
            Console.Write(" came passed stream creation." + Environment.NewLine);
            var mixerflags = BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_NORAMPIN;
            if (stream == 0)
            {
                Console.WriteLine("We could not create stream due to: "); //todo: add bass error
            }



            BASS_CHANNELINFO ci = new BASS_CHANNELINFO();
            Bass.BASS_ChannelGetInfo(stream, ci); // get the sample format
            Console.Write(" came passed channel queryinfo." + Environment.NewLine);
            var success = false;
         
            var mixerHandle = BassMix.BASS_Mixer_StreamCreate(ci.freq,
                                                                  ci.chans,
                                                                    BASSFlag.BASS_MIXER_END); // create mixer
            Console.Write(" came passed mixerstream creation." + Environment.NewLine);

            if (mixerHandle == 0)
            {
                Console.Write("mixer handle failure");
            }
            var _mixerStallSync = new SYNCPROC(OnMixerStall); //attach the handler
            Bass.BASS_ChannelSetSync(mixerHandle,
                                     BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME,
                                     0L,
                                     _mixerStallSync,
                                    System.IntPtr.Zero);
            BassMix.BASS_Mixer_StreamAddChannel(mixerHandle,
                                                    stream,
                                                    mixerflags);





            if (Bass.BASS_ChannelPlay(mixerHandle, false))
            {
               
                Console.Write("Started playing" + Environment.NewLine);
                Console.WriteLine("Press button to stop playing");


            }
            else
            {
                Console.Write("Could not start playback");
                Console.Write("error: " + Bass.BASS_ErrorGetCode());
            }


           
           
        }

        static void OnMixerStall(int handle, int channel, int data, IntPtr user)
        { }[/b]

zittergie

  • Posts: 31
Re: BASS for ARM Linux
« Reply #287 on: 28 May '15 - 21:56 »
On Odroid U3 BASS works very fine.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #288 on: 1 Jun '15 - 07:46 »
On the Odroid-C1 BASS works fine, too. Just not with USB audio devices attached.

djagab

  • Posts: 35
Re: BASS for ARM Linux
« Reply #289 on: 3 Jun '15 - 19:13 »
A small update concerning BASS on the Odroid-C1:
We discovered that Bass plays fine on the Odroid-c1 under the following conditions:
On board sound is used. Bass will try to play with the highest possible resolution.
USB sound is used: Forcing Bass to limit the output to 16 bit resolution prevents the odroid c1 from crashing.

In case of USB audio devices (with resolution higher than 16 bit) normally the format 24_3LE is used. At the time of writing the Odroid-C1 does not appear to support this format and will crash. I have discovered this with Ian's help and performing a little trial and error. In this search for a possible cause I noticed that every possible odroid-c1 Linux distro had the same kernel 3.10.x. This is a back dated kernel because AMLogic (Odroid-c1's CPU and BSP supplier) appear to have other priorities than kernel updates (and solving issues) at the moment. This I found on Hardkernel's forum.

So, to make a long story even longer: In order to prevent usb audio crashes on the odroid-c1, a limit to 16 bit output is a possible work around. I believe Ian will say somthing about this,very soon.

On the other hand, if someone managed to get USB audio at 24_3LE playback format running on the odroid-c1 then please let me know how you did it. Was it Runeaudio or Volumio you used? tell me......

Anyway.

Ian, Thank you very much for your patience and support. It was very helpful.

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #290 on: 4 Jun '15 - 16:32 »
A BASS update that adds a BASS_DEVICE_16BITS flag for use with BASS_Init to limit the device's output to 16-bit is now up in the 1st post. BASS will otherwise use the highest resolution output that the device says it supports.

In this particular Odroid-C1 case, the USB soundcard is saying that it supports 16-bit and 24-bit, but the the entire system is apparently crashing when it's asked to use 24-bit by BASS or other software (eg. aplay). The soundcard doesn't appear to be the problem, as 24-bit output is fine when it's connected to an RPi. So I can only guess that the problem is in the Odroid hardware/firmware or kernel. At least there's a workaround now :)

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #291 on: 16 Jun '15 - 14:16 »
A BASSDSD update (2.4.0.1) is up in the 1st post, which fixes a problem with DSD-over-PCM playback of DSF files.

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #292 on: 31 Jul '15 - 07:20 »
Hi Ian,

With the stream at http://mp3.radio.ch/radiobern164k.m3u, I get no icy-name information on the raspberry.
I'm using this code to read station name from BASS_ChannelGetTagsICY() first, and -if no info could be obtained- from BASS_ChannelGetTagsHTTP():

Code: [Select]
       public string Station
        {
            get
            {
                // get station name from ICY tags
                string stationName = "";
                string[] icyInfo = Bass.BASS_ChannelGetTagsICY(_stream);
                if (icyInfo != null)
                {
                    for (int n = 0; n <= icyInfo.GetUpperBound(0); n++)
                    {
                        // found station name ?
                        if (icyInfo[n].Contains("icy-name")) { stationName = icyInfo[n].Replace("icy-name:", ""); }
                    }
                    
                }
                if (stationName == string.Empty)
                {
                    // still no info, try http tags
                    string[] httpInfo = Bass.BASS_ChannelGetTagsHTTP(_stream);
                    for (int n = 0; n <= httpInfo.GetUpperBound(0); n++)
                    {
                        // found station name ?
                        if (httpInfo[n].Contains("icy-name")) { stationName = httpInfo[n].Replace("icy-name:", ""); }
                    }
                }

                stationName = stationName.Trim();

                return stationName;
            }
        }

On Raspberry, I get empty String. Same code, same stream on Windows 7 returns "RADIO BERN1".

What could be amiss?

On a side note, also on Raspberry:
With stream http://mp3.radio.ch/radiozuerisee128k.m3u, I get no result from BASS_ChannelGetTagsICY() either. But I can read the icy-name using BASS_ChannelGetTagsHTTP(). Strange, no?
« Last Edit: 31 Jul '15 - 07:52 by niston »

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #293 on: 31 Jul '15 - 17:07 »
Those streams are using an Icecast server (rather than Shoutcast), which does include the stream info in the HTTP headers (Shoutcast uses "ICY"). Both seem to be working fine on an RPi here, ie. I can see the stream info in the HTTP headers. If you're still having the problem there, please download the standard Linux BASS package and build the NETRADIO example on your RPi, and then see if the stream title gets displayed by that.

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #294 on: 31 Jul '15 - 19:00 »
This is most unfortunate: I can't compile the netradio on my raspi, as there is no X, no GTK, nada - it's an embedded, headless system. And I don't have another berry-pi at hand that I could try instead.

What else can I do? Maybe hack up some p/Invoke stuff to see if the issue might disappear when not using BASS.NET?
Also, yes: The stream in question definately has icy-name tag in the http header. I can see it on my Windows box just fine.

I'm gonna try and see if https://github.com/giessweinapps/MonoDebugger will help.
« Last Edit: 31 Jul '15 - 19:43 by niston »

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #295 on: 3 Aug '15 - 16:56 »
Can you build console executables? If so, a modified version of the CONTEST example is attached to this post for you to try, which displays the HTTP and ICY tags. You can build it by putting the bass.h and libbass.so files in the same directory and running "gcc contest.c ./libbass.so -o contest".

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #296 on: 11 Aug '15 - 01:47 »
Ian,

Thank you. I got the contest to compile. Had to stick in a BASS_LoadLibray() for the AAC plugin, now here's what it had to say:

Code: [Select]
pi@raspi ~/contest $ ./contest http://radio.nello.tv:80/radiobern164k           Simple console mode BASS example : MOD/MPx/OGG/WAV player
---------------------------------------------------------
streaming internet file
HTTP headers:
  HTTP/1.0 200 OK
  Content-Type: audio/aacp
  icy-br:64
  ice-audio-info: ice-samplerate=44100;ice-bitrate=64;ice-channels=2
  icy-br:64
  icy-description:Die grössten Hits aus vier Jahrzehnten und die besten Pop-
  icy-genre:Adult Contemporary
  icy-name:RADIO BERN1
  icy-pub:0
  icy-url:http://www.radiobern1.ch
  Server: Icecast 2.3.3-kh7
  Cache-Control: no-cache
  Pragma: no-cache
  Expires: Mon, 26 Jul 1997 05:00:00 GMT
  icy-metaint:16000
pos 010854900 - 1:01 - L ---********** ***********-- R - cpu 25.27%

As we can clearly see, the icy-name tag is there. Which does however not change the fact that my .net application gets string.Empty on the raspberry pi, all the while working perfectly fine, as expected, on windows.

This has me stomped...  ???

BTW: MonoDebugger is still totally an completely unstable alpha that crashes my Visual Studio ;D  so, no, it didn't help...  ::)
« Last Edit: 11 Aug '15 - 01:54 by niston »

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #297 on: 11 Aug '15 - 14:20 »
If you display/log the "httpInfo" array, do you see all of the other HTTP headers present in it, ie. only the "icy-name:" header is missing?

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #298 on: 12 Aug '15 - 04:13 »
I added some Console.Write debug logging to the relevant function:

Code: [Select]
        public string Station
        {
            get
            {
                // get station from ICY tags
                string stationName = "";
                string[] icyInfo = Bass.BASS_ChannelGetTagsICY(_stream);
                if (icyInfo != null)
                {
                    Console.Write("Bass.BASS_ChannelGetTagsICY() succeeded. Looking for icy-name tag...");                   
                    for (int n = 0; n <= icyInfo.GetUpperBound(0); n++)
                    {
                       
                        // found station name ?
                        if (icyInfo[n].Contains("icy-name")) { stationName = icyInfo[n].Replace("icy-name:", ""); Console.Write("Found."); break; }
                    }
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("Bass.BASS_ChannelGetTagsICY() returned NULL. ");
                }

                // station name still empty?
                if (stationName == string.Empty)
                {
                    Console.WriteLine("Station name undetermined so far. Trying HTTP headers...");
                    // still no info, try http tags
                    string[] httpInfo = Bass.BASS_ChannelGetTagsHTTP(_stream);
                    for (int n = 0; n <= httpInfo.GetUpperBound(0); n++)
                    {
                        Console.WriteLine("HTTP Header: " + httpInfo[n]);
                        // found station name ?
                        if (httpInfo[n].Contains("icy-name")) { stationName = httpInfo[n].Replace("icy-name:", ""); Console.WriteLine("Found icy-name tag."); break; }
                    }
                }

                stationName = stationName.Trim();

                if (stationName == string.Empty) { Console.WriteLine("Station name could not be determined."); }

                return stationName;
            }
        }

Here's the log output for stream http://mp3.radio.ch/radiozuerisee128k.m3u:

Code: [Select]
Bass.BASS_ChannelGetTagsICY() returned NULL.
Station name undetermined so far. Trying HTTP headers...
HTTP Header: HTTP/1.0 200 OK
HTTP Header: Content-Type: audio/mpeg
HTTP Header: icy-br:128
HTTP Header: ice-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2
HTTP Header: icy-br:128
HTTP Header: icy-description:Radio Zuerisee
HTTP Header: icy-genre:Rock
HTTP Header: icy-name:Radio Zuerisee
Found icy-name tag.

Output for stream http://mp3.radio.ch/radiobern164k.m3u:

Code: [Select]
Bass.BASS_ChannelGetTagsICY() returned NULL.
Station name undetermined so far. Trying HTTP headers...
HTTP Header: HTTP/1.0 200 OK
HTTP Header: Content-Type: audio/aacp
HTTP Header: icy-br:64
HTTP Header: ice-audio-info: ice-samplerate=44100;ice-bitrate=64;ice-channels=2
HTTP Header: icy-br:64
Station name could not be determined.

Now compare to what CONTEST says the headers actually are for the Radio Bern 1 stream:

Code: [Select]
  HTTP/1.0 200 OK
  Content-Type: audio/aacp
  icy-br:64
  ice-audio-info: ice-samplerate=44100;ice-bitrate=64;ice-channels=2
  icy-br:64
  icy-description:Die grössten Hits aus vier Jahrzehnten und die besten Pop-
  icy-genre:Adult Contemporary
  icy-name:RADIO BERN1
  icy-pub:0
  icy-url:http://www.radiobern1.ch
  Server: Icecast 2.3.3-kh7
  Cache-Control: no-cache
  Pragma: no-cache
  Expires: Mon, 26 Jul 1997 05:00:00 GMT
  icy-metaint:16000

Half the tags appear to be missing! Maybe the problem is with httpInfo.GetUpperBound(0)?

Code: [Select]
    string[] httpInfo = Bass.BASS_ChannelGetTagsHTTP(_stream);
    for (int n = 0; n <= httpInfo.GetUpperBound(0); n++)
    {
        // do stuff
    }

But... it works fine on Windows  ???

Ian @ un4seen

  • Administrator
  • Posts: 25047
Re: BASS for ARM Linux
« Reply #299 on: 12 Aug '15 - 16:39 »
I wonder if it could be the non-ASCII character (ö) in the "icy-description" header that's causing the problem in .Net. I'll check with the BASS.Net developer.