alexa-pi / AlexaPi

Alexa client for all your devices! # No active development. PRs welcome # consider https://github.com/respeaker/avs instead
MIT License
1.33k stars 396 forks source link

Alexa stutters and doesn't answer in one clear sentence [IMPORTANT] #335

Open marvinschopf opened 7 years ago

marvinschopf commented 7 years ago

Hello,

My AlexaPi answers in a lot of cases only a stuttering answer (........wea................frankfu.........clo....sky).

I use sox for my playback handler.

Output of the audio debugging script.


!!################################
!!ALSA Information Script v 0.4.64
!!################################

!!Script ran on: Tue Oct 31 07:19:24 UTC 2017

!!Linux Distribution
!!------------------

ID_LIKE=debian

!!DMI Information
!!---------------

Manufacturer:      
Product Name:      
Product Version:   
Firmware Version:  

!!Kernel Information
!!------------------

Kernel release:    4.9.41-v7 
Operating System:  GNU/Linux
Architecture:      armv7l
Processor:         unknown
SMP Enabled:       Yes

!!ALSA Version
!!------------

Driver version:     k4.9.41-v7 
Library version:    1.1.3
Utilities version:  1.1.3

!!Loaded ALSA modules
!!-------------------

snd_bcm2835
snd_usb_audio

!!Sound Servers on this system
!!----------------------------

Pulseaudio:
      Installed - Yes (/usr/bin/pulseaudio)
      Running - Yes

Jack:
      Installed - Yes (/usr/bin/jackd)
      Running - No

!!Soundcards recognised by ALSA
!!-----------------------------

 0 [ALSA           ]: bcm2835 - bcm2835 ALSA
                      bcm2835 ALSA
 1 [Device         ]: USB-Audio - USB PnP Sound Device
                      C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.2, full spe

!!Modprobe options (Sound related)
!!--------------------------------

snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2

!!Loaded sound module options
!!---------------------------

!!Module: snd_bcm2835
    force_bulk : N

!!Module: snd_usb_audio
    autoclock : Y
    device_setup : 0,0,0,0,0,0,0,0
    enable : Y,Y,Y,Y,Y,Y,Y,Y
    id : (null),(null),(null),(null),(null),(null),(null),(null)
    ignore_ctl_error : N
    index : -2,-1,-1,-1,-1,-1,-1,-1
    pid : -1,-1,-1,-1,-1,-1,-1,-1
    quirk_alias : (null),(null),(null),(null),(null),(null),(null),(null)
    vid : -1,-1,-1,-1,-1,-1,-1,-1

!!USB Mixer information
!!---------------------
--startcollapse--

USB Mixer: usb_id=0x0d8c013c, ctrlif=0, ctlerr=0
Card: C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.2, full spe
  Unit: 10
    Control: name="Auto Gain Control", index=0
    Info: id=10, control=7, cmask=0x0, channels=1, type="BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
  Unit: 10
    Control: name="Mic Capture Volume", index=0
    Info: id=10, control=2, cmask=0x0, channels=1, type="S16"
    Volume: min=0, max=6096, dBmin=0, dBmax=2381
  Unit: 10
    Control: name="Mic Capture Switch", index=0
    Info: id=10, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
--endcollapse--

!!ALSA Device nodes
!!-----------------

crw-rw----  1 root audio 116,  0 Oct 30 21:17 /dev/snd/controlC0
crw-rw----  1 root audio 116, 32 Oct 30 21:17 /dev/snd/controlC1
crw-rw----  1 root audio 116, 16 Oct 31 08:09 /dev/snd/pcmC0D0p
crw-rw----  1 root audio 116, 17 Oct 30 21:17 /dev/snd/pcmC0D1p
crw-rw----  1 root audio 116, 56 Oct 30 21:17 /dev/snd/pcmC1D0c
crw-rw----  1 root audio 116,  1 Oct 30 21:17 /dev/snd/seq
crw-rw----  1 root audio 116, 33 Oct 30 21:17 /dev/snd/timer

/dev/snd/by-id:
total 0
drwxr-xr-x 2 root root  60 Oct 30 21:17 .
drwxr-xr-x 4 root root 220 Oct 30 21:17 ..
lrwxrwxrwx 1 root root  12 Oct 30 21:17 usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00 -> ../controlC1

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  80 Oct 30 21:17 .
drwxr-xr-x 4 root root 220 Oct 30 21:17 ..
lrwxrwxrwx 1 root root  12 Oct 30 21:17 platform-3f980000.usb-usb-0:1.2:1.0 -> ../controlC1
lrwxrwxrwx 1 root root  12 Oct 30 21:17 platform-soc:audio -> ../controlC0

!!ALSA configuration files
!!------------------------

!!User specific config file (~/.asoundrc)

pcm.!default {
  type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   }
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"
   }
}

!!Aplay/Arecord output
!!--------------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

!!Amixer output
!!-------------

!!-------Mixer controls for card 0 [ALSA]

Card hw:0 'ALSA'/'bcm2835 ALSA'
  Mixer name    : 'Broadcom Mixer'
  Components    : ''
  Controls      : 6
  Simple ctrls  : 1
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback -10239 - 400
  Mono: Playback -610 [91%] [-6.10dB] [on]

!!-------Mixer controls for card 1 [Device]

Card hw:1 'Device'/'C-Media Electronics Inc. USB PnP Sound Device at usb-3f980000.usb-1.2, full spe'
  Mixer name    : 'USB Mixer'
  Components    : 'USB0d8c:013c'
  Controls      : 4
  Simple ctrls  : 2
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 16
  Mono: Capture 0 [0%] [0.00dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

!!Alsactl output
!!--------------

--startcollapse--
state.ALSA {
    control.1 {
        iface MIXER
        name 'PCM Playback Volume'
        value -610
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '-10239 - 400'
            dbmin -9999999
            dbmax 400
            dbvalue.0 -610
        }
    }
    control.2 {
        iface MIXER
        name 'PCM Playback Switch'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
    control.3 {
        iface MIXER
        name 'PCM Playback Route'
        value 1
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '0 - 2'
        }
    }
    control.4 {
        iface PCM
        name 'IEC958 Playback Default'
        value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
        comment {
            access 'read write'
            type IEC958
            count 1
        }
    }
    control.5 {
        iface PCM
        name 'IEC958 Playback Con Mask'
        value '0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
        comment {
            access read
            type IEC958
            count 1
        }
    }
    control.6 {
        iface PCM
        name 'IEC958 Playback PCM Stream'
        value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
        comment {
            access 'read write inactive'
            type IEC958
            count 1
        }
    }
}
state.Device {
    control.1 {
        iface PCM
        name 'Capture Channel Map'
        value 2
        comment {
            access read
            type INTEGER
            count 1
            range '0 - 36'
        }
    }
    control.2 {
        iface MIXER
        name 'Mic Capture Switch'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
    control.3 {
        iface MIXER
        name 'Mic Capture Volume'
        value 0
        comment {
            access 'read write'
            type INTEGER
            count 1
            range '0 - 16'
            dbmin 0
            dbmax 2381
            dbvalue.0 0
        }
    }
    control.4 {
        iface MIXER
        name 'Auto Gain Control'
        value true
        comment {
            access 'read write'
            type BOOLEAN
            count 1
        }
    }
}
--endcollapse--

!!All Loaded Modules
!!------------------

Module
rfcomm
cmac
bnep
hci_uart
btbcm
bluetooth
evdev
snd_usb_audio
snd_hwdep
snd_usbmidi_lib
snd_rawmidi
snd_seq_device
brcmfmac
brcmutil
cfg80211
rfkill
snd_bcm2835
snd_pcm
snd_timer
snd
i2c_bcm2835
bcm2835_gpiomem
fixed
uio_pdrv_genirq
uio
i2c_dev
ip_tables
x_tables
ipv6

!!ALSA/HDA dmesg
!!--------------

[    4.040372] usbcore: registered new interface driver brcmfmac
[    4.127589] usbcore: registered new interface driver snd-usb-audio
[    4.157362] brcmfmac: Firmware version = wl0: Aug  7 2017 00:46:29 version 7.45.41.46 (r666254 CY) FWID 01-f8a78378

Your OS (including version) where you are running AlexaPi:

Raspbian Stretch

Your hardware platform and model you are running on:

RaspberryPi 3

Python release (python2 --version):

Python 2.7.13

Description of problem:

My AlexaPi answers in a lot of cases only a stuttering answer (```........wea................frankfu.........clo....sky```), but there are also cases where she answers in clear sentences (```Alexa, who are you?```, Answer: ```I am Amazons Alexa ...```).

Expected:

AlexaPI answers in one clear sentence in all cases so I can understand it.

Problem-relevant config.yaml entries:

input_device: ""
playback_handler: "sox"
output: "alsa"
output_device: "default"

Steps to reproduce:

  1. Alexa, whats the weather in Frankfurt, Germany?
  2. Alexa, give me my sports update?
  3. etc etc

Traceback (if applicable):

Additional info:

renekliment commented 7 years ago

Mmm, not sure what we can do.

  1. Does VLC work any better for you?
  2. Have you tried using the other sound card? (USB vs. internal Pi)