GithubHelp home page GithubHelp logo

Comments (11)

arkq avatar arkq commented on June 4, 2024 1

Hi

Did you make make install? If yes, please check if the 20-bluealsa.conf file is installed in the ALSA shared configuration directory. On my system it is /usr/share/alsa/alsa.conf.d/. If you're using some "non-standard" Linux distribution, please let me know which one it is.

Optionally you can use "static" configuration in you .asoundrc file, as follows:

pcm.minijambox {
	type plug
	slave.pcm {
		type bluealsa
		device "E0:D1:E6:0B:AF:F1"
		profile "a2dp"
	}
	hint {
		show on
		description "MINIJAMBOX by Jawbone"
	}
}

then connect your device and run:

aplay -D minijambox test.wav 

from bluez-alsa.

memeplex avatar memeplex commented on June 4, 2024

Still no luck.

The shared config is there, nevertheless I tried the .asoundrc configuration you suggested but I get:

~$ aplay -D minijambox test.wav
ALSA lib bluealsa-pcm.c:701:(_snd_pcm_bluealsa_open) BlueALSA connection failed: Permission denied
aplay: main:788: audio open error: Permission denied

~$ sudo aplay -D minijambox test.wav
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM minijambox
aplay: main:788: audio open error: No such file or directory

I'm installing this as an Arch package, it's a pretty standard build script. I've also cloned and make-installed it myself but to no avail.

from bluez-alsa.

arkq avatar arkq commented on June 4, 2024

Abut the permission. Make sure that the directory shown below exists, and has right permissions and group:

$ ls -l /run/
drwxrwx---  2 root      audio     60 Feb  5 14:36 bluealsa

Then, make sure that your user is added to the audio group. That should fix the permission problem.

Using sudo should work as well, but you have to create .arecord file in your root's home directory (I guess).

from bluez-alsa.

memeplex avatar memeplex commented on June 4, 2024

Right. I've added myself to audio. Now I see some progress but yet hear no sound output. Besides the configuration you suggested I've added a ctl entry to .asoundrc:

ctl.minijambox {
    type bluealsa
    interface "hci0"
}

This screenshot shows the state of the mixer, bluealsa output, bluetoothctl repl and aplay output:

2017-02-05-112055_1366x768_scrot

Everything is frozen at that point, I can't even sigint aplay.

from bluez-alsa.

arkq avatar arkq commented on June 4, 2024

This freeze might be caused by the alsalib bug which can be "fixed" by exporting LIBASOUND_THREAD_SAFE=0. Try to use:

$ LIBASOUND_THREAD_SAFE=0 aplay -D minijambox test.wav

or add export LIBASOUND_THREAD_SAFE=0 to your .profile or .bashrc file.

EDIT:
I can see, that your device supports AAC encoding. Please, read "Troubleshooting" section from the README file. If you experience sound glitching, you might try run bluealsa server with the following options:

$ bluealsa --a2dp-force-audio-cd --aac-vbr-mode=2

from bluez-alsa.

memeplex avatar memeplex commented on June 4, 2024

Yes, beautiful, thank you!

add export LIBASOUND_THREAD_SAFE=0 to your .profile or .bashrc file.

May this have an undesired effect when set at the global level?

If you experience sound glitching

It seems to sound well but I took note of your advice just in case.

OT: how do you manage you "bluetooth session"? Say I want to channel my audio through bluetooth for a couple of hours, then wire everything again. Some apps doesn't even have a device argument (for example, sopotify AFAIK). And in any case you will have to create launchers or alias for each app in order to set the device and put them in "bluetooth mode". So, do you temporarily change the default alsa device?

from bluez-alsa.

infirit avatar infirit commented on June 4, 2024

Have a new BT speaker so been playing with this some more. I am seeing the same thing with a non static config, only a static config per #26 (comment) works.

The mixer shows up with amixer -D bluealsa but trying to play something with aplay -D bluealsa fails with "audio open error: No such file or directory"

ffs, now it works but before it didn't not sure why 😒.

from bluez-alsa.

arkq avatar arkq commented on June 4, 2024

May this have an undesired effect when set at the global level?

It's hard to tell. I think, that right now there will be no undesirable effects, but in the future there might be - ppl will start to make programs which will require ALSA to be thread safe. However, this bug will be fixed by that time - I hope so.

how do you manage you "bluetooth session"?

I do not. ALSA is not made to be user-friendly. That's why PulseAudio has emerged (I think). When, I'm using bluealsa, I'm also using other audio devices as well, and I'm doing it simultaneously. I choose which device should be used for every application I start (I'm not using applications which do not provide options for selecting audio device).

But to answer your question more adequately, I have to say, that it might be impossible (or at least very tricky) to get the Windowsβ„’ experience out of bluealsa - aka audio device auto-selection depending on whether BT speaker/headset is connected or not. The only possible/reasonable way, which comes to my mind, is indeed the change of the default section in the .asoundrc. You could write some scripts for such actions in order to make it more automatic.

PS.
Right now it is not possible to connect more than one application to particular bluetooth device using bluealsa. If you try to listen to spotify, and in the meantime you will want to listen to some youtube video, you will get "device busy" error. So using bluealsa as a default audio for a desktop environment might not be the best idea. Of course you can do it, but you have to know this limitation.

from bluez-alsa.

arkq avatar arkq commented on June 4, 2024

@infirit, I'll try to add some more meaningful debug error messages and in the meantime I'll try to setup bluealse from scratches on my host as well - it's easy to miss something trivial if one is using development environment all the time :D.

from bluez-alsa.

infirit avatar infirit commented on June 4, 2024

@arkq Cool. After rebuilding with debug flag it started working so may have been user error πŸ˜‰. Not sure what changed but I'll try to reproduce and report back.

from bluez-alsa.

memeplex avatar memeplex commented on June 4, 2024

Ok, regarding the "bluetooth session", and given that automating bluetoothctl is a PITA, I ended up writing a simple shell library to source inside a bash session and then launch bluetooth enabled apps from there:

connect() {
    disconnect
    export LIBASOUND_THREAD_SAFE=0 ALSA_CONFIG_PATH=/tmp/bluetoothrc
    sudo systemctl restart bluetooth
    sudo bluealsa &> /tmp/bluetooth.log &
    sleep 0.5
    echo 'power on' | bluetoothctl &> /dev/null
    bluetoothctl
    local device_id=$(echo quit | bluetoothctl | \
                      sed -nr 's/.*Device ([^ ]+).*/\1/p')
    cat > "$ALSA_CONFIG_PATH" <<EOF
pcm.!default {
    type plug
    slave.pcm {
        type bluealsa
        interface "hci0"
        device $device_id
        profile "a2dp"
    }
}
ctl.!default {
    type bluealsa
    interface "hci0"
}
EOF
}

disconnect() {
    rm -f "$ALSA_CONFIG_PATH"
    unset LIBASOUND_THREAD_SAFE ALSA_CONFIG_PATH
    sudo pkill bluealsa
    sudo systemctl stop bluetooth
}

from bluez-alsa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.