将文本转换为采样率为8kHz的16位PCM WAV文件-Python

问题描述 投票:0回答:1
  1. 从网站抓取数据
  2. 以8kHz的采样率保存在16bit PCM WAV文件中的记录

假设我有:

text = "Hello this is content that I need to convert to 16bit PCM WAV file with a sampling rate of 8kHz, Hello this is content that I need to convert to 16bit PCM WAV file with a sampling rate of 8kHz, Hello this is content that I need to convert to 16bit PCM WAV file with a sampling rate of 8kHz, "

我有将其转换为mp3或.wav的代码,但是如何设置其他参数以将其保存为16bit PCM WAV文件,采样率为8kHz。谢谢

from gtts import gTTS
text = "........."
language = 'en'
myobj = gTTS(text=mytext, lang=language, slow=False)
myobj.save("data.mp3")
python wav
1个回答
0
投票

gtts模块本身不是在创建音频数据,它只是从Google的API请求。

它不提供任何更改输出格式的方法。

Source

© www.soinside.com 2019 - 2024. All rights reserved.