BASS for ARM Linux

Started by Ian @ un4seen, 7 May '12 - 14:56

Ian @ un4seen

That looks like it isn't finding the ARM Linux libraries. The best thing to do is to copy the examples and makefile (but not makefile.in) from the standard Linux package to where you have extracted the ARM Linux package.

nockiro

Hi Ian,
with the standard linux package examples / bass.h / makefile and the ARM package files it did work without any problem.
What should I do next?

Oh, and by the way: Thanks for your fast answers :)
Regards,
Robin

Ian @ un4seen

OK. That confirms that BASS is working, so it looks like the problem is something .Net/Mono-related. I'm not a .Net/Mono user myself, but the "System.BadImageFormatException" error message sounds like Mono is finding an incompatible library. I notice you state that the exception occurs even if you only call BassNet.Registration? I don't think the BASS library is loaded at that stage, so perhaps it's the BASS.Net library that Mono doesn't like. Are you using the Linux BASS.Net version?

nockiro

Hello Ian,
it's possible that the error occurs in the Bass.net library.
Yes, I'm using the linux version of BASS.net and I noticed that, if I rename "Bass.net.Linux.dll" to "Bass.net.dll" and reference it then, mono seems to recognize the library, but then I get another message:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Un4seen.Bass.BassNet' threw an exception. ---> System.InvalidProgramException: Invalid IL code in Td.JT:i8M (int): IL_003b: brfalse   IL_1c0e
  at Un4seen.Bass.BassNet..cctor () <0x76b4e338 + 0x0001f> in <filename unknown>:0

But at this point I really don't know what to do - both possibilities lead to errors :D

Regards,
Robin

Ian @ un4seen

I just tried the latest BASS.Net with Mono on standard Linux, and I got the same "System.BadImageFormatException: Bad method token 0x685e49f0" error message, so at least we know it isn't something specific to ARM Linux. Unfortunately, I don't know what the problem could be, but I've asked the BASS.Net developer to check it out and hopefully they will have some ideas :)

nockiro

I'm glad to hear that it isn't only my configuration which causes the error and I'm also curious if the developer has some ideas.
Nevertheless, thanks for your work / effort. :)

Regards,
Robin

radio42

Yes, I am currently investigating what is causing the issue - as all previous versions worked fine, so there must be something funky going on...
... not sure yet...

radio42

28.04.2016: Version 2.4.12.1 is out!

Note:
   - Bass.Net: .Net Framework v4.5 rebuild
   - Bass.Net.iOS: latest Xamarin.iOS target framework support
   - Bass.Net.Android: latest Mono/Xamarin.Android target framework support
   - Bass.Net.Linux: .Net Framework v4.5 rebuild
   - Bass.Net.OSX: .Net Framework v4.5 rebuild


Full Install:
 www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
 www.un4seen.com/filez/4/Bass24.Net_update.zip


So I hope, that your issues are resolved now!

jalbers

Are there 64-bit versions of BASS for ARM Linux? If so, where can they be downloaded? If not, do you intend to create any in the future?

I'm hoping to be able to create a 64-bit build to run on the new Pine64.

Ian @ un4seen

Most of the add-ons aren't included yet, but a 64-bit ARM Linux version is available here:

   www.un4seen.com/stuff/bass24-linux-aarch64.zip

marcus

Hi everyone.

Could someone please write a step by step tutorial (or refer me to one) on how to get the simple sample working with mono on a Raspberry PI running Raspbian?

Thanks a millon.

derMartin

I'm getting an Error on start up when using Bass_FX for ARM.
Without Bass_FX the program worked just fine with Bass for ARM. (Recording and Playback worked fine)
Now I'm trying to add a modified playback (for example faster playback with BASS_FX_TempoCreate).
I'm using .Net 4 as my language of choice for my program and with the Bass.NET it works under Windows 10.
But under Linux (with mono on a raspberryPi) I get the below error when using Bass_FX (Recording and Playback worked fine there too).
Can someone please help me?
Thank you!

my program's name: "MusicPiMod" (location /home/pi/temp/TestWithSwitches)
hardware: RaspberryPi B+ 512MB
environment: Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l
Used libs (hardfp):
   Bass.NET 2.4.12.3
   bass24-linux-arm.zip (updated: 24 Aug '16 - this article)
   bass_fx24-linux-arm.zip (22.04.2015 - this article)

Error in shell: sudo mono --runtime=v4.0 MusicPiMod.exe

Stacktrace:

  at <unknown> <0xffffffff>
  at MusicPiMod.Program.Main (string[]) <0x00057>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:


Debug info from gdb:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb5b2b430 (LWP 2520)]
0xb6e79a3c in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0
  Id   Target Id         Frame
  2    Thread 0xb5b2b430 (LWP 2520) "mono" 0xb6e77700 in sem_wait@@GLIBC_2.4 () from /lib/arm-linux-gnueabihf/libpthread.so.0
* 1    Thread 0xb6f49000 (LWP 2519) "mono" 0xb6e79a3c in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0

Thread 2 (Thread 0xb5b2b430 (LWP 2520)):
#0  0xb6e77700 in sem_wait@@GLIBC_2.4 () from /lib/arm-linux-gnueabihf/libpthread.so.0
#1  0x001fff10 in mono_sem_wait (sem=0x2f523c, alertable=1) at mono-semaphore.c:119
#2  0x0017db28 in finalizer_thread (unused=<optimized out>) at gc.c:1073
#3  0x001625b4 in start_wrapper_internal (data=0x1118e98) at threads.c:643
#4  start_wrapper (data=0x1118e98) at threads.c:688
#5  0x001f5c30 in thread_start_routine (args=0x10d46c0) at wthreads.c:294
#6  0x00204268 in inner_start_thread (arg=0x10d46b4) at mono-threads-posix.c:49
#7  0xb6e70bfc in start_thread () from /lib/arm-linux-gnueabihf/libpthread.so.0
#8  0xb6ddd868 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
#9  0xb6ddd868 in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0xb6f49000 (LWP 2519)):
#0  0xb6e79a3c in waitpid () from /lib/arm-linux-gnueabihf/libpthread.so.0
#1  0x000b2148 in mono_handle_native_sigsegv (signal=<optimized out>, ctx=<optimized out>) at mini-exceptions.c:2299
#2  0x00027af8 in mono_sigsegv_signal_handler (_dummy=11, info=0xbec223f0, context=0xbec22470) at mini.c:6777
#3  <signal handler called>
#4  0xb594fd8c in ?? () from /home/pi/temp/TestWithSwitches/libbass_fx.so
#5  0xb6f3cfc4 in ?? () from /lib/ld-linux-armhf.so.3
#6  0x04000354 in ?? ()
#7  0x04000354 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Ian @ un4seen

Is the crash happening in a BASS_FX_TempoCreate call? If you're unsure, please try to locate what call it is happening in, eg. by stepping over the calls in a debugger or using logging (make sure it's unbuffered). And then check if the crashing stops when you remove that call, to confirm it is the problem.

derMartin

Hi Ian,

thanks for the fast reply.

I located the codepart.
It was the BASS_FX_GetVersion()-Method on the wrong location.
I have a Player-Class with a static-constructor like the one below.
There I called BASS_FX_GetVersion() and now I removed that call and I can use it in the static methods of this class without a problem.
Now the TempoCreate works and also BASS_ChannelSetFX with  BASSFXType.BASS_FX_DX8_ECHO.

Thank you

        static MyPlayer()
        {
            BassNet.Registration("...", "...");

            // init BASS using the default output device
            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);

            Console.WriteLine("Bass_FX_GetVersion() is: " + BassFx.BASS_FX_GetVersion());
         }

derMartin

Hi again,

I'm now trying to record audio on the raspberry Pi B+ 512 MB.
The same code is running on Windows 10 and it works (I can record audio and playback it afterwards).
Now I'm not sure what I'm doing wrong.
I'm using the ACMFORMAT-Class for the Encoding and the call of the Constructor throws an Exception.
For recording I plugged in an USB Soundcard with an standard mic plugged into that.
The Bass-DeviceInfo differs between Windows 10 and Linux.
So I don't know if the device itself is the problem or the using of the ACMFORMAT.

Thank you!!!
Martin

==== Logged device Info
DeviceInfo Windows 10:
Device 0: Mikrofon (USB PnP Sound Device), usb#vid_0d8c&pid_013c&mi_00#7&25ba7e06&0&0000#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global, {0.0.1.00000000}.{0a1af7ac-d040-4a6b-b36e-f571675a079d}, BASS_DEVICE_ENABLED, BASS_DEVICE_DEFAULT, BASS_DEVICE_TYPE_MICROPHONE, BASS_DEVICE_ENABLED, BASS_DEVICE_DEFAULT, BASS_DEVICE_TYPE_MICROPHONE

DeviceInfo Linux (Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l):
Device 1: USB PnP Sound Device: USB Audio, , hw:1,0, BASS_DEVICE_ENABLED, BASS_DEVICE_NONE, BASS_DEVICE_ENABLED

==== Code
Console.WriteLine("StartRecording");
Console.WriteLine("1 " + Bass.BASS_ErrorGetCode());

// -1 on Windows for my default mic
// 1 on Linux (my Pi) for the USB-Soundcard
if (!Bass.BASS_RecordInit(1))
{
   Console.WriteLine("ERROR Init Record " + Bass.BASS_ErrorGetCode());
}
Console.WriteLine("2 " + Bass.BASS_ErrorGetCode());

_myRecProc = new RECORDPROC(RecordingCallback);
Console.WriteLine("3 " + Bass.BASS_ErrorGetCode());

_recHandle = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, _myRecProc, IntPtr.Zero);
Console.WriteLine("4 " + Bass.BASS_ErrorGetCode());

ACMFORMAT codec = new ACMFORMAT();
Console.WriteLine("5 " + Bass.BASS_ErrorGetCode());

BassEnc.BASS_Encode_GetACMFormat(0, ref codec, "title", 0);
Console.WriteLine("6 " + Bass.BASS_ErrorGetCode());

BassEnc.BASS_Encode_StartACMFile(_recHandle, codec, BASSEncode.BASS_ENCODE_AUTOFREE | BASSEncode.BASS_UNICODE, TempRecFileName);
Console.WriteLine("7 " + Bass.BASS_ErrorGetCode());

Bass.BASS_ChannelPlay(_recHandle, false);
Console.WriteLine("8 " + Bass.BASS_ErrorGetCode());

==== Console-Log
...
StartRecording
1 BASS_OK
2 BASS_OK
3 BASS_OK
4 BASS_OK
Error on Recording, code: BASS_OK
System.EntryPointNotFoundException: BASS_Encode_GetACMFormat
  at (wrapper managed-to-native) Un4seen.Bass.AddOn.Enc.BassEnc:BASS_Encode_GetACMFormatUnicode (int,intptr,int,string,Un4seen.Bass.AddOn.Enc.BASSACMFormat)
  at Un4seen.Bass.AddOn.Enc.BassEnc.BASS_Encode_GetACMFormat (Int32 handle, IntPtr form, Int32 fromlen, System.String title, BASSACMFormat flags) [0x00000] in <filename unknown>:0
  at Un4seen.Bass.AddOn.Enc.ACMFORMAT..ctor () [0x00000] in <filename unknown>:0
  at MusicCore.MyPlayer.StartRecording () [0x00000] in <filename unknown>:0

=== DeviceInfo-Logging Code
Console.WriteLine("Device "
   + a + ": "
   + info.name + ", "
   + info.id + ", "
   + info.driver + ", "
   + info.status + ", "
   + info.type + ", "
   + info.flags);

Ian @ un4seen

ACM encoding is only available on Windows, so it won't be possible to use that on ARM Linux. Do you want to write a WAV file? If so, you can use the BASS_ENCODE_PCM flag in a BASS_Encode_Start call for that, something like this:

BassEnc.BASS_Encode_Start(_recHandle, TempRecFileName, BASSEncode.BASS_ENCODE_PCM | BASSEncode.BASS_ENCODE_AUTOFREE, null, IntPtr.Zero);

derMartin

Hi Ian,

you made my day.

It works like you suggested!

Martin

Ian @ un4seen

The ARM Linux version of the BASSMIDI 2.4.10 release is now up in the 1st post.

Ian @ un4seen

The ARM Linux versions of the recent BASSDSD/FLAC/OPUS/WV add-on updates are up now in the 1st post.

Ian @ un4seen

The ARM Linux version of the BASSMIDI 2.4.11 release is now up in the 1st post.

BSV

Hello! Is it possible to build bass libraries for ARM v5 architecture? Thanks in advance.

Ian @ un4seen

There are no add-ons, but there is an armv5 BASS library available here:

   www.un4seen.com/stuff/bass24-linux-armv5.zip

BSV


DJAGABx

HI Ian,

I am currently testing a NanoPi Neo Plus2 which is based on an ARM64 architecture. I tested the libbass.so for ARM64 and it is working fine. Do you have any idea when additional libs will be made ARM64 ready? I would like to use the bassmix, libflac, libdsd, libaac as well on this ARM64 environment? Thanks in advance for your reply.

Ian @ un4seen

The BASSFLAC and BASSmix add-ons have been added to the 64-bit ARM Linux package. The BASS and BASSDSD libraries have also been updated to the latest versions.

   www.un4seen.com/stuff/bass24-linux-aarch64.zip