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

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #175 on: 24 Feb '14 - 16:24 »
Does the "crackled sound" contain the correct sound but it's stuttering, or is it unrecognisable rubbish? If the former, you could try increasing the device buffer length via the BASS_CONFIG_DEV_BUFFER option. Note that needs to be done prior to calling BASS_Init.

zittergie

  • Posts: 31
Re: BASS for ARM Linux
« Reply #176 on: 25 Feb '14 - 22:20 »
Hi Ian,

I have tried the BASS_CONFIG_DEV_BUFFER option, but it doesn't help (it did on x86 Linux Pulseaudio).  It sound more like stuttering rubbish.  Changing the Pulse Volume mixer to none and then again to duplex stereo works, until the music stops and a new song is loaded.  If however if a new stream is loaded and started before the first stream stops, it keeps playing correct.

I will make a recording next week.

On the Raspberry Pi however, everything is normal.

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #177 on: 26 Feb '14 - 17:00 »
There were some changes made to the x86 Linux BASS version fairly recently to work better with PulseAudio on the latest Ubuntu, and perhaps the same will apply on ARM Linux too. I could send an updated ARM Linux build for you to try; please confirm whether you need a softfp or hardfp version.

zittergie

  • Posts: 31
Re: BASS for ARM Linux
« Reply #178 on: 26 Feb '14 - 20:00 »
Thanks Ian,

I would need the hardfp build.

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #179 on: 3 Mar '14 - 16:28 »
For anyone else having sound problems with Ubuntu/PulseAudio, the previously mentioned x86 changes do appear to fix things on ARM too, so an updated BASS version is now up in the 1st post. The BASSMIDI add-on has also been updated to the latest stuff.

Oliver

  • Guest
Re: BASS for ARM Linux
« Reply #180 on: 20 Mar '14 - 20:52 »
Hija Ian,

got the Arm6 version up and running on the Rasperry Pi. Dunno about the Arm5 environment.
Actually are playing around with the BeagleBone Black which ist a Arm7 system.

When trying to run your library (v6) on the BeagleBone it crashes on initialize. Hard and soft float.
Also tried gdb'in with your description from the arm5 post and get "no registers", "no stack".

Do i need a Arm7 version of your library for the BeagleBone Black?  :o ::) ???

Thank you,
Oliver     

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #181 on: 21 Mar '14 - 15:46 »
ARMv7 CPUs support ARMv6 instructions, so that shouldn't be a problem.

When you say it "crashes on initialize", do you mean in a BASS_Init call? If so, please try using device=0 in that call (to initialize the "no sound" device) and see if it still crashes then.

Oliver

  • Guest
Re: BASS for ARM Linux
« Reply #182 on: 23 Mar '14 - 21:25 »
Arm7 / Beaglebone: Initializing with "no sound" (device = 0) works.
aplay -l lists 2 Sounddevices, iterating over GetDeviceInfo strangely shows 3 devices and unfortunately the "ghost" as default.
I need to dig into this more deeply the next days. Thanks for the tip!

Best,
Oliver 

PieterB

  • Posts: 4
Re: BASS for ARM Linux
« Reply #183 on: 14 Apr '14 - 01:18 »
Hi All,
I'm running my app through mono on linux on a Pandaboard. Using Bass.Net.Linux.dll 2.4.10.3.
I need the DetectPeakFrequency method in the Visuals class to detect the frequency of the incoming sound. I'm testing some hardware connected to the Pandaboard. I play a MP3 or wav file out via headphone out, containing some tones and need to detect them via mic input.

It would appear that the visuals class is not part of the Bass.Net.Linux DLL.

Any Ideas how I could proceed?

radio42

  • Posts: 4724
Re: BASS for ARM Linux
« Reply #184 on: 14 Apr '14 - 07:55 »
Hi Pieter,

as already explained via email, the Visuals and WaveForm classes use GDI+ to draw the graphics, which doesn’t exist in Xamarin (Mono, Linux).

Sure you can implement a ‘DetectPeakFrequency’ functionality yourself (Bass.Net is also only using standard BASS methods and nothing magic).
You can call “BASS_ChannelGetData” to retrieve FFT data and then loop over all returned FFT data to find the entry with the maximum energy value.
The ‘Utils.FFTIndex2Frequency’ method can then be used to convert the index of the FFT entry containing the maximum back to a related frequency value.
See the docs for the mentioned methods for some examples.



PieterB

  • Posts: 4
Re: BASS for ARM Linux
« Reply #185 on: 15 Apr '14 - 02:57 »
Thanks for that.
I do have one more issue now. I'm able to play audio from a mp3 file, but are unable to init Recording Channel:
Code: [Select]
private const int _inputDevice = -1;
private const int _outputDevice = -1;
...
if (Bass.BASS_Init(_outputDevice, 44100, BASSInit.BASS_DEVICE_LATENCY, IntPtr.Zero))
{
    /* -------------------------------- playing setup -------------------- */
    _outStreamChannel = Bass.BASS_StreamCreate(44100, 2, 0, BASSStreamProc.STREAMPROC_PUSH);
    _prebuf = (int)Bass.BASS_ChannelSeconds2Bytes(_outStreamChannel, info.minbuf / 1000.0); // amount of data to pre-buffer
    // create a stream channel from a file
    int stream = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT);

    /* -------------------------------- recording setup -------------------- */
    if(!Bass.BASS_RecordInit(_inputDevice))
        Console.WriteLine("Record init error: {0}", Bass.BASS_ErrorGetCode());
        _recordingCallback = new RECORDPROC(MyRecording);
        // start recording paused
        int recChannel = Bass.BASS_RecordStart(44100, 2, BASSFlag.BASS_RECORD_PAUSE, 50, _recordingCallback, IntPtr.Zero);
        if (recChannel == 0)
            Console.WriteLine("Record Start error: {0}", Bass.BASS_ErrorGetCode());


    /* -------------------------------- begin recording -------------------- */
    // really start recording
    if(!Bass.BASS_ChannelPlay(recChannel, false))
        Console.WriteLine("Record Channel error: {0}", Bass.BASS_ErrorGetCode());


    /* -------------------------------- begin playing -------------------- */
    if (stream != 0)
    {
        // play the stream channel
        Bass.BASS_ChannelPlay(stream, false);
    }
    else
    {
        // error creating the stream
        Console.WriteLine("Stream error: {0}", Bass.BASS_ErrorGetCode());
    }
}

Bass.BASS_RecordInit(_inputDevice) is successful.

If _inputDevice = -1; I get BASS_ERROR_FORMAT @ BASS_RecordStart()
If _inputDevice =  0; I get BASS_ERROR_FORMAT @ BASS_RecordStart()
If _inputDevice =  1; I get BASS_ERROR_UNKNOWN @ BASS_RecordStart()
If _inputDevice =  8; I get BASS_ERROR_DRIVER @ BASS_RecordStart()

On _inputDevice = -1; I tried using BASS_SAMPLE_8BITS flag but got the same result.
Any suggestions?
« Last Edit: 15 Apr '14 - 05:48 by PieterB »

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #186 on: 15 Apr '14 - 17:37 »
Did you also try changing the "chans" and/or "freq" parameters in the BASS_RecordStart call? If not, please give try that; you could try chans=1 for mono first.

Also confirm what devices have been detected, like this...

Code: [Select]
BASS_DEVICEINFO di;
for (int a=0; BASS_RecordGetDeviceInfo(a, &di); a++)
printf("%d: %s flags=%d\n", a, di.name, di.flags);

PieterB

  • Posts: 4
Re: BASS for ARM Linux
« Reply #187 on: 15 Apr '14 - 22:33 »
I have tried recording in mono with chan =1, but still got the same error.
Here is the list of devices:
BASS VERSION: 33819161

0: Default flags=BASS_DEVICE_ENABLED, BASS_DEVICE_DEFAULT
1: PandaES:  flags=BASS_DEVICE_ENABLED
2: PandaES:  flags=BASS_DEVICE_ENABLED
3: PandaES:  flags=BASS_DEVICE_ENABLED
4: PandaES:  flags=BASS_DEVICE_ENABLED
5: PandaES:  flags=BASS_DEVICE_ENABLED
6: PandaES:  flags=BASS_DEVICE_ENABLED
7: PandaES:  flags=BASS_DEVICE_ENABLED
8: PandaES:  flags=BASS_DEVICE_ENABLED
9: PandaES:  flags=BASS_DEVICE_ENABLED
10: PandaES:  flags=BASS_DEVICE_ENABLED

I have used aplay and arecord from ALSA drivers on linux to play/record using this cmd:
arecord -Dplughw:0,8 -d20 -fS16_LE -c2 -r44100 -twav recording.wav

This gives me a wav file recorded at 16-bit @ 44100 samples/sec, stereo from plugin Hardware, Card 0,  device 8 (Mic input).
Here is some info from Linux that might be useful.
# cat /proc/asound/pcm
00-00: Multimedia (*) :  : playback 1 : capture 1
00-01: Multimedia Capture (*) :  : capture 1
00-02: Voice (*) :  : playback 1 : capture 1
00-03: Tone Playback (*) :  : playback 1
00-04: VIB-DL (*) :  : playback 1
00-05: MODEM (*) :  : playback 1 : capture 1
00-06: Multimedia (*) :  : playback 1
00-07: Multimedia snd-soc-dummy-dai-7 :
00-08: Headset Playback twl6040-legacy-8 :  : playback 1 : capture 1
00-09: (HS Playback) :  : playback 1
00-10: (Analog Capture) :  : capture 1
00-11: (HF Playback) :  : playback 1
00-12: (Vibra) :  : playback 1
00-13: (BT Capture) :  : playback 1 : capture 1
00-14: (BT Playback) :  : playback 1 : capture 1
00-15: (FM Playback) :  : playback 1 : capture 1
00-16: (FM Capture) :  : playback 1 : capture 1
01-00: HDMI omap-hdmi-hifi-0 :  : playback 1
# cat /proc/asound/devices
  2: [ 0- 8]: digital audio playback
  3: [ 0- 8]: digital audio capture
  4: [ 0- 6]: digital audio playback
  5: [ 0- 5]: digital audio playback
  6: [ 0- 5]: digital audio capture
  7: [ 0- 4]: digital audio playback
  8: [ 0- 3]: digital audio playback
  9: [ 0- 2]: digital audio playback
 10: [ 0- 2]: digital audio capture
 11: [ 0- 1]: digital audio capture
 12: [ 0- 0]: digital audio playback
 13: [ 0- 0]: digital audio capture
 14: [ 0]   : control
 15: [ 1- 0]: digital audio playback
 16: [ 1]   : control
 33:        : timer
# cat /proc/asound/cards
 0 [PandaES        ]: PandaES - PandaES
                      PandaES
 1 [OMAPHDMI       ]: OMAPHDMI - OMAPHDMI
                      OMAPHDMI
# ls /dev/snd/
by-path    pcmC0D0c   pcmC0D2c   pcmC0D4p   pcmC0D6p   pcmC1D0p
controlC0  pcmC0D0p   pcmC0D2p   pcmC0D5c   pcmC0D8c   timer
controlC1  pcmC0D1c   pcmC0D3p   pcmC0D5p   pcmC0D8p

I should be able to record from device 8, since I've done it from the console before.
Changing the sample frequency makes no difference.
Any more ideas?
Thanks.

« Last Edit: 16 Apr '14 - 00:10 by PieterB »

PieterB

  • Posts: 4
Re: BASS for ARM Linux
« Reply #188 on: 16 Apr '14 - 02:39 »
 :D Okay, figured it out. The device enumeration is a bit odd. I tested each device number starting from 0 and got the following.
BASS_RecordStart() errors
when _inputDevice =
0 -> BASS_ERROR_FORMAT
1 -> BASS_ERROR_UNKNOWN
2 -> BASS_ERROR_DRIVER
3 -> BASS_ERROR_DRIVER
    [89722.005157]  OMAP ABE Voice: asoc: OMAP ABE Voice no valid capture route from source to sink
4 -> BASS_ERROR_DRIVER
   [90186.655029]  OMAP ABE MODEM: asoc: OMAP ABE MODEM no valid capture route from source to sink
5 -> work but soon crash.
8 -> BASS_ERROR_DRIVER
9 -> BASS_ERROR_DRIVER

From the OMAP errors I was able to determine the device number is enumerated according to the capturable devices on the system starting from 1 (not 0). Since OMAP ABE Voice is Card 0 Device 2 and OMAP ABE MODEM is Card 0 Device 5 on my Pandaboard.

 ??? Only problem now is my kernel hits a NULL pointer dereference while recording:
[   72.340393] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[   72.351654] pgd = ed6ac000
[   72.354553] [00000008] *pgd=ad6fe831, *pte=00000000, *ppte=00000000
[   72.361358] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   72.367034] Modules linked in: ftdi_sio bnep btwilink bluetooth omapdce(C) omap_rpmsg_resmgr rpmsg_resmgr virtio_rpmsg_bus omap_remoteproc remoteproc wl12xx
[   72.381866] CPU: 1    Tainted: G         C    (3.4.12 #1)
[   72.387573] PC is at snd_pcm_info+0xd4/0xe4
[   72.391998] LR is at 0x30232065
[   72.395294] pc : [<c03d3d60>]    lr : [<30232065>]    psr: a0000113
[   72.395324] sp : ed683df8  ip : ed637ed0  fp : ed683e14
[   72.407440] r10: 00000009  r9 : ef0cc400  r8 : c08040b0
[   72.412933] r7 : ef3c88a8  r6 : ef3c8800  r5 : ef3c8a00  r4 : ed637e00
[   72.419830] r3 : 00000000  r2 : ed637e00  r1 : 00000001  r0 : ef3c8a00
[   72.426727] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   72.434295] Control: 10c5387d  Table: ad6ac04a  DAC: 00000015
[   72.440338]
...
[   73.484588] Backtrace:
[   73.487182] [<c03d3c8c>] (snd_pcm_info+0x0/0xe4) from [<c03d3dc4>] (snd_pcm_info_user+0x54/0xbc)
[   73.496459]  r7:00000000 r6:ef3c8a00 r5:b49fe670 r4:ed637e00
[   73.502471] [<c03d3d70>] (snd_pcm_info_user+0x0/0xbc) from [<c03cfa68>] (snd_pcm_control_ioctl+0x248/0x26c)
[   73.512756]  r6:ef0cc400 r5:00000000 r4:b49fe670 r3:00000000
[   73.518768] [<c03cf820>] (snd_pcm_control_ioctl+0x0/0x26c) from [<c03cb698>] (snd_ctl_ioctl+0xa08/0xbbc)
[   73.528778] [<c03cac90>] (snd_ctl_ioctl+0x0/0xbbc) from [<c010ef18>] (vfs_ioctl+0x38/0x4c)
[   73.537506] [<c010eee0>] (vfs_ioctl+0x0/0x4c) from [<c010fac4>] (do_vfs_ioctl+0x544/0x598)
[   73.546234] [<c010f580>] (do_vfs_ioctl+0x0/0x598) from [<c010fb5c>] (sys_ioctl+0x44/0x70)
[   73.554901] [<c010fb18>] (sys_ioctl+0x0/0x70) from [<c000e500>] (ret_fast_syscall+0x0/0x30)
[   73.563690]  r7:00000036 r6:b49fe7c0 r5:b51280b0 r4:00000000
[   73.569702] Code: e1a00005 e595309c e3a01001 e1a02004 (e5933008)
[   73.577087] ---[ end trace 46efbe5582039872 ]---

I'll tinker with the code and hope the error is not from the lib.
Any ideas please. I posted the code earlier, but changed the _inputDevice = 5;
Thanks.

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #189 on: 16 Apr '14 - 17:06 »
I have used aplay and arecord from ALSA drivers on linux to play/record using this cmd:
arecord -Dplughw:0,8 -d20 -fS16_LE -c2 -r44100 -twav recording.wav

This gives me a wav file recorded at 16-bit @ 44100 samples/sec, stereo from plugin Hardware, Card 0,  device 8 (Mic input).

To locate that device in BASS's device list, you can look for "hw:0,8" in the BASS_DEVICEINFO "driver" member.

Code: [Select]
BASS_DEVICEINFO di;
for (int a=0; BASS_RecordGetDeviceInfo(a, &di); a++)
printf("%d: %s flags=%d driver=%s\n", a, di.name, di.flags, di.driver);

To also find out the capabilities of the device/driver, you can try running "arecord -D hw:0,8 --dump-hw-params >/dev/null".

Gibol

  • Posts: 1
Re: BASS for ARM Linux
« Reply #190 on: 27 Apr '14 - 18:16 »
Hello! I want to use bass with my embedded system which is build using buildroot (ulibc). I see that bass requires glibc 2.4. Is there possible to get bass version using ulibc or is there any other solution?

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #191 on: 30 Jun '14 - 16:14 »
An updated BASS version that adds HTTPS support to BASS_StreamCreateURL (when the OpenSSL library is available) is now up in the 1st post.

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #192 on: 3 Jul '14 - 16:18 »
Another HTTP-related update is up in the 1st post. This time it removes the redirection limit, and provides the HTTP response headers (when requested via BASS_STREAM_STATUS) for each redirection, not only the final location.

AndroidMediaPlayer

  • Posts: 25
Re: BASS for ARM Linux
« Reply #193 on: 24 Aug '14 - 00:37 »
Hi Ian,

can you compile WavPack Addon for ARM-Linux?

Thank you :)

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #194 on: 25 Aug '14 - 13:18 »
As requested, the BASSWV add-on has now been added to the package in the 1st post.

Nuno

  • Guest
Re: BASS for ARM Linux
« Reply #195 on: 19 Sep '14 - 15:23 »
i forgot to answer..
yes it works perfect now.. :) thank you..
ps: you have to write in help files or somewhere that it does not support floating-point on arm :)))

Hi, i'm also trying to compile this in cubian (cubieboard 1) and i'm also receiving the same error.

Can you explain to me how do you resolve this, or if possible can you send me a simple working example of it (i'm trying to compile the contest sample and fail to acomplish)

Thanks

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #196 on: 19 Sep '14 - 16:20 »
Please give some detail on the error that you are receiving, eg. if the compiler is failing to build the CONTEST example, post the error message.

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #197 on: 20 Sep '14 - 13:58 »
Hey Ian,

Thanks for the ARM Linux version! I'm playing around with it on my Raspberry Pi and found that ChannelGetTagsHTTP(stream) will always return null on the Pi, whereas it works fine on Windows. I'm here to report this :)

Is there any chance of an AC3 plugin happening for ARM?

Anyways, keep up the good work!
« Last Edit: 20 Sep '14 - 14:10 by niston »

Ian @ un4seen

  • Administrator
  • Posts: 23889
Re: BASS for ARM Linux
« Reply #198 on: 22 Sep '14 - 15:39 »
I'm playing around with it on my Raspberry Pi and found that ChannelGetTagsHTTP(stream) will always return null on the Pi, whereas it works fine on Windows. I'm here to report this :)

By "ChannelGetTagsHTTP", do you mean BASS_ChannelGetTags with tags=BASS_TAG_HTTP? I checked that just now on an RPi, and it seemed to be working fine. Are you having the problem with a particular URL?

Is there any chance of an AC3 plugin happening for ARM?

The AC3 decoder's sample format is currently floating-point, so performance might not be great in an ARM port (particularly the "softfp" version). I'll see if it can be changed to use integer/fixed-point instead.

niston

  • Posts: 38
Re: BASS for ARM Linux
« Reply #199 on: 22 Sep '14 - 17:20 »
I should clarify that I'm using BASS.NET as an intermediate to BASS. I didn't use this layer back on VB6, so I assumed that Bass.BASS_ChannelGetTagsHTTP() is just a wrapper for a native call. So this is incorrect. And if the underlying native call is working fine, the problem might be my misunderstanding of the situation. I am currently investigating my code.