Bluetooth for Slacko 5.6 - Stream audio from PC.

Configuration wizards, scanners, remote desktop, etc.
Post Reply
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Bluetooth for Slacko 5.6 - Stream audio from PC.

#1 Post by greengeek »

I needed to get a bluetooth speaker connected to my Slacko 5.6 derivative in order to improve the quality of sound output from my laptop speakers.

Google searches and murga forum searches convinced me that there are potentially many pitfalls with getting bluetooth running, and that it is very easy to load too little, or too much software, or to load completely the wrong software.

I had a chuckle when I found this post from "Richard Cranium":
- "Bluetooth is a wonderful rat hole where you can spend lots of hours learning about it that could be used for other things, such as drinking wine or beer. The version of bluez in slackware is kinda old. (Don't try to use it to connect to a heart rate monitor, for instance.) See https://www.bluetooth.org/en-us/spec...specifications for the various things that are supported by various versions of bluetooth"

If you want to know lots about bluetooth devices the reference he directs you to is worth a look:
https://www.bluetooth.com/specifications

On the other hand - getting bluetooth running for the purposes of streaming your music directory to a BT speaker or BT headset - can be quite easy. I quickly decided I did not want to learn everything about bluetooth - I just wanted to find a quick and easy way to get sound from my bluetooth speaker.

I have posted below a .pet which I use on my Slacko 5.6 derivative to connect to a variety of devices for the purposes of streaming audio from my PC. It is not my intention at this point to connect to a bluetooth phone, or other bi-directional device.

PLEASE NOTE : All of my testing is done on a CD booted Slacko 5.6 with no savefile. There is a risk that my pet could overwrite existing files in your save file. If you want to try my pet I recommend that you boot with pfix=ram or hide your savefile (or have a good backup of it somewhere) so that you don't get any weird results. Especially - you don't want to end up with multiple BT packages lying around your system. You really only need the basics.

This pet is based on the puppyBT_2.1 package (I don't remember where I got that or who wrote it) combined with parts of rcrsn51's bt4stretch pet and also combined with a small amount of my own code. I have called my pet "slackstream" to ensure there is no confusion with the official packages.

Here is what to do:
1) Load the slackstreamBT pet available here:
http://www.mediafire.com/file/uoy6pnk6r ... BT-0.1.pet
2) Turn on your bluetooth device (make sure you have no other PCs or phones that automatically connect to that device!)
3) Run "slackstream" from the network menu
4) Work your way down the list of functions:
- scan for devices
- pair with the device you want.
- click the "btheadset" button
- choose the directory that contains the test files you wish to play
- click "play"

Before you shut down click the "Remove a pairing" button to let your device become available to other phones and PCs.
Any problems let me know...


Troubleshooting and extending your bluetooth knowledge:

The scan function only detects your device if the device is currently unpaired.

My pet only tries to play your media files with mplayer in "alsa" mode. Other software may or may not be able to access the alsa interface that is set up for bluetooth. Be prepared to try all sorts of things if you want to get more fancy with what/how you want to stream.

Once you have loaded the apropriate bluetooth software for your puppy check out the files currently in /etc/bluetooth - these rules will determine the behaviour of your BT adapter.

In weird cases may need to turn on then load firmware (Arch wiki has lots of info):

Note: Before using the bluetooth device adapter that is inbuilt in (or plugged into) your PC, make sure that it is not blocked by rfkill. Enter the following command into a terminal:
rfkill list

- For a better understanding of what is happening under the hood you can use this alternative method rather than relying totally on the slackstream gui started from the menu:

1) Install slackstreamBT.pet-0.1
2) Make a new directory in /root and call it /music. Copy one or more music files into that directory (just for the purposes of this test)
3) Turn BT external device on (making sure it does not get grabbed and paired by some other phone or PC)
4) Type the following command in a terminal:
hcitool scan
(and then record the BT address for your external device).
5) Type the following command in a terminal:
bluetooth-agent \PPPP \XX:XX:XX:XX:XX:XX
(where PPPP is the pin code for your device and XX:XX:XX:XX:XX:XX is the BT address for your external device as discovered in the scan).
6) Start the slackstreamBT gui from the network menu and click "btheadset" button (this writes a new .asoundrc file into /root (make a copy of this file somewhere in case you want to use it some other day without starting slackstream - this file is the key to getting alsa to drive the BT stream to BT heaphones or speaker))
7) Type the following command:
mplayer -ao alsa /root/music/*.*
(Which will use mplayer to sequentially play through every file in that directory)

8.) When mplayer has finished playing the /root/music directory you will probably want to release the pairing so that the external device is available to other devices. Simply type the following command in terminal:
bt-device -r \XX:XX:XX:XX:XX:XX
.
Last edited by greengeek on Sat 06 Jul 2019, 08:18, edited 14 times in total.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#2 Post by don570 »

An alternative to bluetooth that works well is USB sound card adaptor.
It will output high quality stereo. Drivers should be builtin.

http://murga-linux.com/puppy/viewtopic. ... 602#998602
____________________________________________________

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#3 Post by HerrBert »

works on slacko 5.7.0 with audacious 3.6

not the usual bloat and very easy to use.

alsamixer gets corrupted but no problem as i don't use savefiles.

thank you very much

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#4 Post by greengeek »

Hi Herr Bert, thanks for the Slacko 5.7 report. Good to know that it works there too.

I hope I will one day understand how to make alsamixer work with the new asoundrc setup. I think Zigbert has done some work with this to make pmusic and pEqualizer work better with Alsa and asound files

SFR also mentioned that his soft mixer affects alsamixer in this manner. It would be nice to make all this compatible somehow but for now I am just happy that I can stream BT when I need to. (I am the same as you in having no savefile so the corrupt alsamixer is not a problem - reboot brings me back to normal state).

For anyone that wants it I have just added some more info to the first post - to describe more about the actual CLI commands that drive the connect/disconnect process. Might be useful to someone, especially if they want to build a better gui or make a better player.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

Updated the link in the first post to point to a new version of the pet which makes the gui a bit more straightforward.

Pet v 0.1 is here:
http://www.mediafire.com/file/uoy6pnk6r ... BT-0.1.pet

If you already have the original pet installed you can just update the file /usr/sbin/slackstream using the new one inside the pet. All other files unchanged.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#6 Post by greengeek »

Ouch - just realised "Slackstream" is a name that was already in use elsewhere. Hmmpff. Thought I was being original. Will have to change it and remake the pet.
Bah. Humbug.

Post Reply