Bluez-Alsa

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#21 Post by greengeek »

rcrsn51 wrote:I wonder if running the bt4stretch processes at higher priority might solve this problem.

In /usr/local/bin/bt4stretch, change:

Code: Select all

line 15: nice -n -10 mplayer ...
line 193: nice -n -10 bluealsa &
I have made no progress so far using this mod. Sometimes the BT seems to connect but mostly not, and I have not heard any sound from my BT device in the last few tests with BT4stretch (Slacko connection with older bluez still works fine). I can't tell if the issue with BT is my lack of understanding or some variation in the order I am doing things. I am repeating the excercise a number of times in an effort to document the steps required to get the BT working so that I can repeat exactly what I am doing each time.

Should I move to the newer bt4stretch before continuing testing?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#22 Post by rcrsn51 »

greengeek wrote:Should I move to the newer bt4stretch before continuing testing?
If you want, but it is still using bluetoothctl as the connection app instead of the legacy tools that were in PuppyBT with bluez4.

I am not convinced that bluetoothctl is necessarily any better, but I couldn't get the legacy tools to work with bluez5.

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

#23 Post by greengeek »

rcrsn51 wrote:I wonder if running the bt4stretch processes at higher priority might solve this problem.

In /usr/local/bin/bt4stretch, change:

Code: Select all

line 15: nice -n -10 mplayer ...
line 193: nice -n -10 bluealsa &
Tested this mod again tonight and the BT connection seems perfect. This test was using a different BT device so not 100% a fair test but I will test again on the previous headset as soon as I get the chance.

BT seems problematic on devices that lack their own volume control. The BT stream seems to come through at FULL amplitude. Be prepared.. :shock:

EDIT : still using the old version of bluez-alsa. Decided to make sure I was correctly repeating previous syntax before updating to the later version. I realised tonight that i was not heeding the HELP1 directive to #quit the control terminal before running player. Probably not an issue but i want to be sure I understand the previous issue in a repeatable way before upgrading.

Edit 2: The audio response from tonight's testing made me realise that the previous testing was on a set of earmuff headphones that are mono not stereo (earmuffs intended for receiving phone calls in an industrial environment). I need to get those earmuffs back for more testing.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#24 Post by rcrsn51 »

V1.2 creates a standard ALSA output device. You set it as the default in your .asoundrc. Then you can control it from the system tray volume applet.

Because v1.2 eliminates the pipelining, the "nice" commands may not be needed to get consistent output.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#25 Post by rcrsn51 »

Any update on tests of v1.2?

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

#26 Post by greengeek »

Not yet sorry - i have to wait till i have several hours to myself otherwise my testing gets interrupted and i make no progress.

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

#27 Post by greengeek »

I seem to be struggling uphill with this a bit - my last few attempts at testing I feel I have gone backwards somehow. Now i am unable to get a BT connection and during the initial run of bt4stretch i see a message telling me that no bluetooth adapter is found and that the daemon is not running.

Is it possible that the PPM (or whatever stretch uses) is corrupt and I'm downloading a bad package?

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#28 Post by rcrsn51 »

The download is OK. I have tested this on various platforms and it works fine for me.

Maybe you need a clean install. Just delete your "changes" folder and start again.

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

#29 Post by greengeek »

I don't have a changes folder (as far as I know) - I always select the "no save" option so that each boot gives me the same original environment.

(Just booting from CD each time - no HDD install)

I will keep trying.

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

#30 Post by greengeek »

Much more successful tonight - I was able to connect to the headset that previously had "stuttering" issues, and it played perfectly using either carousel or mplayer.

I did try fredx's youtube-viewer but could not make it stream to the headset - it still came out of the laptop speakers.

However Palemoon streamed to the headset fine.

I suspect yesterdays problems with the "daemon not running" must have been some combination of the new bt4strectch version being downloaded by apt-get, but my install/usage method adding in the wrong asoundrc (or something similar)

Anyway, v 1.2 seems promising.

cheers!

EDIT : interestingly - the "stuttering" came back when I unpaired the first headset (the mono one) and tried to stream to a different BT device (a stereo one). I unpaired the first one, paired with the new one, then played via carousel. The sound starts in stuttery fashion for 8 seconds, then comes perfectly clear for 8 seconds, then goes stuttery again, and keeps cycling like that.

Might do some more tests with different devices when time permits.

I then tried streaming from Palemoon again, but no sound came through.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#31 Post by rcrsn51 »

Thanks for testing.

Regarding the stuttering: if you thought that the "nice" command helped in v1.1, you can try it at line 157 of v1.2.

Here are some troubleshooting tips if a device stops working:

1. In bluetoothctl, use the "info" command. It will confirm if a device is properly paired/connected.

2. Check two things in your .asoundrc file:
a. the correct MAC address is inserted
b. the "bluetooth" ALSA device is enabled at the bottom.

You don't need to unpair a device if switching to another one.

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

#32 Post by greengeek »

rcrsn51 wrote:You don't need to unpair a device if switching to another one.
I am still rather confused by the various steps required to link BT devices. For example, i don't understand the difference between "pairing" and "connecting" - according to the bt4stretch help file you have to manually "pair" to the MAC first, then go on to "connect" to the MAC (unless I have misunderstood, which is frequently the case )

Then there is the need to release the remote device before shutting down - is that "unpairing" or "unconnecting"?

I feel that once I have a clearer idea of the layers of the BT protocol I may experience more repeatability and reliability.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#33 Post by rcrsn51 »

I'm not either, except that bluetoothctl clearly needs both.

You only need to pair once, then bluetoothctl adds that info to its database and remembers it.

But you need to connect at each session. If you watch the device's indicator lights and listen to the beeps, you can tell when the connection is made properly.

At one time, I thought that disconnecting a device made it more amenable to connecting at the next session. But that may not be true.

Read here.

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

#34 Post by greengeek »

Thanks, that info is useful. I definitely have one device which doesn't connect (or maybe I mean pair?) properly if it is not disconnected properly from previous devices. That device would not show in Linux at all until I disconnected it from my wife's phone (even though she had not connected to it for months). Even if she was out of the house and miles away (obviously not connected) the device stayed hidden.

Is there some way to use apt-get to download the bt4stretch and peasymp3 packages (rather than install) so that I can load the software when required (like a .pet)?

My wife is getting sick of the ethernet cable tracking across the floor.
:oops:

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#35 Post by rcrsn51 »

greengeek wrote:Is there some way to use apt-get to download the bt4stretch and peasymp3 packages (rather than install) so that I can load the software when required (like a .pet)?
Go into Fred's repo and download the packages. Then install them with Right-click/Install deb.

But you still need to be connected in order to get all the dependent packages.

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

#36 Post by greengeek »

Ran some more tests with v1.2 tonight and managed to switch repeatedly between two BT devices without any of the previous stuttering problems.

I did not unpair the devices - just clicked the "disconnect" button in the bt4stretch gui to free the current device, then entered "connect MACaddr" in the control terminal to connect the second device. Then altered the MACaddr in the .asoundrc and ran carousel.

I have three further tests to perform:

- establish what was causing the stuttering.
- establish why the BT adapter in the PC is sometimes not found, resulting in the daemon not running (seem to have to reboot to get past this)
- try several other BT devices to confirm reliability of switching between devices.

I do miss the ability that was in the old bluez package to "list currently paired devices", and also the ability to select a device from that gui list rather than using "control" to manually drive the connection. As far as I can tell "quickconnect" only tries to reconnect to the previously paired (or do i mean "connected"??) device (but i need to retest this)

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#37 Post by rcrsn51 »

greengeek wrote:Ran some more tests with v1.2 tonight and managed to switch repeatedly between two BT devices without any of the previous stuttering problems.
That's good news.
I did not unpair the devices - just clicked the "disconnect" button in the bt4stretch gui to free the current device, then entered "connect MACaddr" in the control terminal to connect the second device. Then altered the MACaddr in the .asoundrc and ran carousel.
That should be the standard procedure, if your BT devices cooperate. Depending on the device and the adapter, it's not always that easy. I have found that desktop machines with a separate USB adapter sometimes work better than laptops where the BT adapter is built-in and incorporated with the WiFi adapter.
I do miss the ability that was in the old bluez package to "list currently paired devices", and also the ability to select a device from that gui list rather than using "control" to manually drive the connection
.
PuppyBT used a combination of tools from bluez4 and bluez-tools. I tried again to make them work in bluez5 and failed.

Most people will find a BT speaker that works for them and lock it in.
As far as I can tell "quickconnect" only tries to reconnect to the previously paired (or do i mean "connected"??) device (but i need to retest this)
Quick Connect looks in your .asoundrc file, identifies the current MAC address that you set up and uses it to connect/disconnect. Because pairing info is saved between sessions, you don't need to re-pair.

For some reason, the agent tool in PuppyBT doesn't distinguish between pairing and connecting. It may automatically pair new devices.
establish why the BT adapter in the PC is sometimes not found, resulting in the daemon not running (seem to have to reboot to get past this)
That sounds like a timing problem, possibly because you are booting off an optical disc. I have never experienced it.

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

#38 Post by greengeek »

rcrsn51 wrote:Quick Connect looks in your .asoundrc file, identifies the current MAC address that you set up and uses it to connect/disconnect. Because pairing info is saved between sessions, you don't need to re-pair.
One of the things I am doing at present is to build up a collection of .asoundrc files that are modified for each specific BT device that I can connect to.

I will be trialling a script to swap between asoundrc files instead of manually editing each time. As you say most people will not need to do this as they will stay with one device - but doing this will let me test what can be done to make the bluez5 more usable for my needs. I am hoping that I can simplify and semi-automate the connect and disconnect process a little.

I intend to avoid persistence so that causes me some issues with losing the "database" of paired devices - so I would like to work out where bluez keeps it's list of paired devices and see if i can duplicate it so that Quickconnect could be used to manage the connections (without me using the BT control terminal in future sessions).

Dropping in an appropriate asoundrc and allowing quickconnect to do the rest might be a way I can make this more straightforward.

Here are the devices I am currently using:

- Samsung Soundplate (A flat chunky amplifier that sits under the TV to boost the TV and other audio)
- "H-163" generic usb BT receiver which has a headphone out jack to make ordinary headphones BT compatible
- "Tactix" earmuffs for use in an industrial environment
- "Veon" mini stereo i use for streaming my laptop music directory output to.
- "Marley chant sport" BT speaker for using BT music output in other rooms of the house. (also used as a phone interface when in the car)
Attachments
Veon_mini-stereo.jpg
(9.19 KiB) Downloaded 238 times
H163_audio.jpg
(38 KiB) Downloaded 244 times
TactixEarmuffs.jpg
(22.84 KiB) Downloaded 243 times
Marley_Chant_Sport.jpg
(9.34 KiB) Downloaded 243 times

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#39 Post by rcrsn51 »

I intend to avoid persistence so that causes me some issues with losing the "database" of paired devices - so I would like to work out where bluez keeps it's list of paired devices and see if i can duplicate it so that Quickconnect could be used to manage the connections (without me using the BT control terminal in future sessions).
Check out /var/lib/bluetooth

Post Reply