richtier / alexa-voice-service-client

Python Client for Alexa Voice Service (AVS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

send_audio_file returnes NoneType.

Tubinex opened this issue · comments

I tried your example of using audio files but I get the error:
TypeError: 'NoneType' object is not iterable

when I run the script.
Is this bug known? And if so, how can I fix it?

This actually means that your audio file is not 'audible' to Alexa and that it returns nothing as a result. My problem was that the audio I was sending wasn't properly encoded (16000 hz sample rate, single channel, signed PCM is the way to go). When that was fixed I was able to get a result back.

@Tagge thanks for the explanation

@Tubinex did you solve the problem?

@richtier No, unfortunately I get my audio straight from Discord and I haven't figured out how to convert it to the correct format
but thanks anyway, maybe I'll find a way!

ah yes audio can be hard if there is little documentation.

in case it helps, if it's webaudio good news is I've done that myself: https://github.com/richtier/voice-command-lifecycle/blob/master/command_lifecycle/helpers.py#L23

used that in related project https://github.com/richtier/alexa-browser-client/

@Tubinex I was able to get Discord's audio 48k sample rate 2 channels -> 16k PCM 1 channels. Its a stream transformer in Node.JS though, lmk if you want it.