I'm using Google AIY Voice Kit (v2) with Raspberry Pi Zero to build a voice-control robot. It's working great! But I have an elementary question. While the robot is processing user speech (and deciding how to respond) I want to play a short sound file to indicate the robot is "thinking." The sound file is currently playing too loud. How to set the playback volume of a soundfile in python?
Here's a snippet of code:
aiy.voice.audio.play_wav_async("think.wav")
This plays successfully, but I can't figure out how to set the volume the way I can set volume in the text to speech function aiy.voice.tts.say(sentence, lang='en-GB', volume=10, pitch=120, speed=90, device='default')
Many thanks for any suggestions!
So this is a very hacky way to look at this problem, but after reading the AIY documentation and seeing that it is straight-up reading the bytes of the file pointer with no option to set volume [or anything else] I think hacks might be the best route.
Let's take your input file, modify it, then save it back as a tmp file to be read into AIY.
We can do something like the following: