所以这是看待这个问题的一种非常hacky的方式,但是在阅读了AIY文档并看到它直接读取文件指针的字节而没有设置音量[或其他任何东西]的选项后,我认为hacks可能是最好的路线。
让我们获取您的输入文件,对其进行修改,然后将其保存为 tmp 文件以供读入 AIY。
我们可以执行以下操作:
# Throw this line somewhere higher up so you can edit it
# like you would the volume level in
# aiy.voice.tts.say(sentence, lang='en-GB', volume=10, pitch=120, speed=90, device='default')
# or just replace the later reference with the int and modify that line directly instead
HOW_MUCH_QUIETER: 10
from pydub import AudioSegment
song = AudioSegment.from_wav("think.wav")
# reduce volume by 10 dB
song_10_db_quieter = song - HOW_MUCH_QUIETER
# save the output
song.export("quieter.wav", "wave")
aiy.voice.audio.play_wav_async("quieter.wav")