User avatar
DaveCooper
Posts: 15
Joined: Wed Jan 25, 2017 11:08 pm
Location: Norfolk, UK
Contact: Website

Espeak to bluetooth speaker on pi zero w - having some trouble!

Mon Aug 12, 2019 8:30 pm

Hi. I'm (trying to!) build an a battery-powered application where the data from a sensor is output as speech. Rpi zero w seems like a pretty good fit and I'm using a bluetooth shower speaker (wet environment!) as the output device. I'm using raspbian buster. Getting bluetooth going was smooth and the rpi reconnects to the speaker on boot and the speaker plays wav files from VLC. I thought I was home and dry, but I can't get sound to the speaker from the command line. Trying to play a .wav file with aplay:

Code: Select all

$  aplay -D bluealsa ~/pi/Downloads/*
[email protected]:~ $ aplay -D bluealsa /home/pi/Downloads/*
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
aplay: main:828: audio open error: No such file or directory
Trying to use espeak as suggested by tutorial:

Code: Select all

$ espeak "hello world" --stdout | aplay -D bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
aplay: main:828: audio open error: No such file or directory
Just using "espeak "some text"" (works fine on my desktop running Fedora!)

Code: Select all

$ espeak "Hello World"
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM sysdefault
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM dmix
ALSA lib bluealsa-pcm.c:763:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA PCM: PCM not found
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Obviously I'm missing something vital here!

Here's a bit more about the environment:

Code: Select all

systemctl status blue*
● bluealsa.service - BluezALSA proxy
   Loaded: loaded (/lib/systemd/system/bluealsa.service; static; vendor preset: 
   Active: active (running) since Sun 2019-08-11 18:02:08 BST; 1 day 2h ago
 Main PID: 409 (bluealsa)
   Memory: 1004.0K
   CGroup: /system.slice/bluealsa.service
           └─409 /usr/bin/bluealsa

Aug 11 18:02:08 raspberrypi systemd[1]: Started BluezALSA proxy.
Aug 12 20:33:51 raspberrypi bluealsa[409]: /usr/bin/bluealsa: Unsupported AT mes

● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset
   Active: active (running) since Sun 2019-08-11 18:02:07 BST; 1 day 2h ago
     Docs: man:bluetoothd(8)
 Main PID: 384 (bluetoothd)
   Status: "Running"
   Memory: 2.4M
   CGroup: /system.slice/bluetooth.service
           └─384 /usr/lib/bluetooth/bluetoothd --noplugin=sap

Aug 11 18:02:05 raspberrypi systemd[1]: Starting Bluetooth service...
Aug 11 18:02:07 raspberrypi bluetoothd[384]: Bluetooth daemon 5.50
lines 1-23
Any help or suggestions gratefully received! Thanks in anticipation. Dave

hippy
Posts: 5590
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Espeak to bluetooth speaker on pi zero w - having some trouble!

Tue Aug 13, 2019 11:33 am

It is not clear to me where the root problem lies but a number of people have reported problems with aplay and espeak; errors being thrown, output being truncated, inconsistent behaviour -

https://www.raspberrypi.org/forums/view ... p?t=242374
https://www.raspberrypi.org/forums/view ... p?t=242842
https://www.raspberrypi.org/forums/view ... p?t=241814

The first link suggests rolling back to an earlier kernel to fix the issue.

User avatar
DaveCooper
Posts: 15
Joined: Wed Jan 25, 2017 11:08 pm
Location: Norfolk, UK
Contact: Website

Re: Espeak to bluetooth speaker on pi zero w - having some trouble!

Tue Aug 13, 2019 7:08 pm

Ok, I'll try it with stretch. Thanks for your advice. Dave

hippy
Posts: 5590
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Espeak to bluetooth speaker on pi zero w - having some trouble!

Tue Aug 13, 2019 7:37 pm

DaveCooper wrote:
Tue Aug 13, 2019 7:08 pm
Ok, I'll try it with stretch.
Stretch had similar problems; those carried over to Buster, got worse, and increasingly worse, for me.

It is the kernel which appears to be significant, not the distro.

User avatar
DaveCooper
Posts: 15
Joined: Wed Jan 25, 2017 11:08 pm
Location: Norfolk, UK
Contact: Website

Re: Espeak to bluetooth speaker on pi zero w - having some trouble!

Wed Aug 14, 2019 9:06 am

Well, without reading your last post I loaded up a stretch img from 2018-11-13 which is kernel 4.14 apparently, and it worked straight out of the box. :D I'll also try some older kernels. Thanks for your help! Dave

Return to “Troubleshooting”