View previous topic :: View next topic |
Author |
Message |
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Fri Apr 13, 2018 11:34 am Post subject: Play all audio file types through bluez-alsa: possible? YES! |
|
|
Hi all.
I sometimes use and enjoy my Bluetooth speaker; it seems to accept only certain audio file types — it wouldn't play FLAC nor MP3, for instance and mplayer -ao alsa:device=bluealsa stalls playing these. But is it possible to play other or any type as well? Btw is ALSA not capable of transcoding an audio stream before sending it out? Transcoding with mplayer would also be an option though I'd rather play music with my usual tools (such as audacious).
Thanks in advance for any hint/suggestion.
EDIT: Yes, it's possible — at least I haven't yet come across a file type that I couldn't play that way. And thanks to Jocker16's hint! _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Last edited by VinzC on Tue Aug 21, 2018 5:53 pm; edited 2 times in total |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5934
|
Posted: Fri Apr 13, 2018 12:11 pm Post subject: |
|
|
i don't have the exact setup on hand, but it goes something like this:
~/.asoundrc
Code: | pcm.!default {
playback.pcm "jblflip"
}
pcm.jblflip {
type plug
slave.pcm {
type bluealsa
device "00:11:DD:AA:66:FF"
profile "a2dp"
}
hint {
show on
description "JBL Flip 2"
}
}
|
_________________
Neddyseagoon wrote: | The problem with leaving is that you can only do it once and it reduces your influence. |
banned from #gentoo since sept 2017 |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Fri Apr 13, 2018 12:25 pm Post subject: |
|
|
Jaglover wrote: | Player decodes the audio and sends it to the playback device raw. Thus, it should have nothing to do with input file encoding, be it MP3, FLAC or something else. I suspect the problem is sampling rate. 41 kHz vs 48 kHz. |
Aha! Now that you're mentioning that, indeed all the files that I successfully played were @ 48kHz... Good tip, I'll try resampling and report!
EDIT: I just can't figure out how to have mplayer resample @48000 Hz *and* play through blue-alsa. Resampling alone seems to work
mplayer -srate 48000 'Musique/...': | ==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 57.89.100 (external)
AUDIO: 44100 Hz, 2 ch, s16le, 881.0 kbit/62.43% (ratio: 110119->176400)
Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) | but not when I use blue-alsa as an output:
mplayer -srate 48000 -ao alsa:device=btheadset 'Musique/...': | ==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 57.89.100 (external)
AUDIO: 44100 Hz, 2 ch, s16le, 881.0 kbit/62.43% (ratio: 110119->176400)
Selected audio codec: [ffflac] afm: ffmpeg (FFmpeg FLAC audio)
==========================================================================
MPlayer interrupted by signal 2 in module: ao2_init |
I had to press Ctrl+C. And putting -srate *after* -ao doesn't change anything. FTR here's my global asound.conf:
/etc/asound.conf: | # Bluetooth headset
defaults.bluealsa {
interface "hci0" # host Bluetooth adapter
device "XX:YY:ZZ:52:1E:AA" # Radius Speaker MAC address
profile "a2dp"
# Doesn't seem to force resampling:
rate 48000
}
pcm.btheadset {
type plug
slave.pcm {
type bluealsa
device "XX:YY:ZZ:52:1E:AA"
profile "a2dp"
}
hint {
show on
description "Radius BT Speaker"
}
} |
_________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sat Apr 14, 2018 9:06 am Post subject: |
|
|
Any idea? _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Tue Apr 17, 2018 8:29 pm Post subject: |
|
|
audiodef wrote: | If you can get audacious connected to blue-alsa, audacious has a resampling plugin. |
I hadn't compiled audacious with that plugin. I did but it doesn't seem to work either: I set [which I assume is] the new sample rate to 48000 and I get an error message saying Quote: | ALSA error: snd_pcm_open failed: No such file or directory. | Still no change, hence. Even worse, none of the tracks that used to work with audacious do play anymore, I get that very error message or the connection gets lost almost everytime . Bummer...
EDIT: After a couple of unsuccessful attempts (stop/start Blueman, stop/start bluetooth, stop/start audacious, disconnect/reconnect with Radius Speaker, remove/add Radius Speaker...) it now... works!
Thanks for the hint anyway. At least I know it *can* do it! _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sun Apr 22, 2018 2:27 pm Post subject: |
|
|
audiodef wrote: | Good. I will want to do this myself at some point on my new laptop. I can connect bluetooth devices, but I have yet to try to run audio through them. |
Just note however that I still haven't found how to make mplayer (my player of choice) resample any audio file that I want to play through bluealsa. I'll report as soon as I find out. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
Jocker16 n00b
Joined: 18 Sep 2010 Posts: 6
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Thu Aug 16, 2018 6:16 am Post subject: |
|
|
@Jocker16
Awesome ! Thanks!
EDIT: And I'll add it works a treat! Yay! I've even added an alias to my .bashrc Code: | alias btplay="LIBASOUND_THREAD_SAFE=0 mplayer -ao alsa:device=btheadset" |
_________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
|