MycroftAI / mimic1

Mycroft's TTS engine, based on CMU's Flite (Festival Lite)
https://mimic.mycroft.ai
Other
814 stars 152 forks source link

Doesn't work with Jabra 510 usb speaker #44

Open kendersec opened 8 years ago

kendersec commented 8 years ago

Hi all,

Mimic though alsa currently forces the audio output to be a single channel. I believe this device doesn't have support for single channel audio (yeah...odd). I get the following error:

$ ./bin/mimic -t "hello"
audio_open_alsa: failed to set number of channels to 1. Invalid argument.

In verbose mode doesn't seem to give any further information.

This is some information on the Jabra speaker according to aplay (happy to provide any other information):

$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=USB
    Jabra SPEAK 510 USB, USB Audio
    Default Audio Device
front:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    Front speakers
surround21:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    Direct sample mixing device
dsnoop:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    Direct sample snooping device
hw:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    Direct hardware device without any conversions
plughw:CARD=USB,DEV=0
    Jabra SPEAK 510 USB, USB Audio
    Hardware device with all software conversions
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: USB [Jabra SPEAK 510 USB], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
zeehio commented 8 years ago

I have created a branch to try and change the ALSA audio device. Would you mind trying this?

git clone git@github.com:MycroftAI/mimic.git
cd mimic
git checkout alsa_dev_change
./configure --with-audio=alsa
make
# this should fail:
bin/mimic -t "Hello" 
# this may work:
MIMIC_AUDIO_DEVICE="pulse" bin/mimic -t "Hello"
kendersec commented 8 years ago

Thanks for the prompt response and sorry to taking a while to get back to you, this is what I got:

$ ./bin/mimic -t "Hello"
audio_open_alsa: failed to set number of channels to 1. Invalid argument.
$ MIMIC_AUDIO_DEVICE="pulse" bin/mimic -t "Hello"
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

audio_open_alsa: failed to open audio device pulse. Connection refused

This is all with Jessie Raspbian unchanged. I had a quick play with Ubuntu Mate for the Raspberry Pi and that seemed to work (I believe it was all under pulseaudio and not direct alsa).

Happy to keep trying things if you want to get to the bottom of it but also happy to drop it if you don't feel it's worth the effort.

zeehio commented 8 years ago

As another quick test: could you try other ALSA audio devices to see if any of them work by chance?

MIMIC_AUDIO_DEVICE="dmix" bin/mimic -t "Hello"

A solution on mimic side is to adapt mimic output so it is able to send the same audio signal to two channels if one channel fails, that would require a bit more logic on our side but it is not impossible to do. I might do it at some point although I'm pretty busy, if you feel you can help coding I can try to guide you through the code (mainly changing src/audio/au_alsa.c)