当代码相同时,为什么我的输出有所不同



我目前正在使用以下代码组合一个频道过滤器:https://ipython-books.github.io/116-applying-digital-digital-digital-filters-to-filter声音/

我对上述代码进行了很少的编辑,即该文件不再从URL中提取,而是从本地WAV文件中提取的。这是关联的编辑

def speak(voice):
    audio = pydub.AudioSegment.from_wav(BytesIO(voice))    
    with tempfile.temporaryfile() as fn:
        wavef = audio.export(fn, format='wav')
        wavef.seek(0)                            
        wave = wavef.read()
...
voice = open("C:\Users\tkim1\Documents\librosa\NEUT 41s 
shaking_gold.wav", "rb").read

当前" audio = pydub.audiosegresment.from_wav"代码输出以下错误:需要类似字节的对象,而不是'hindiin_function_or_method。这个错误正在浮出水面。非常感谢您阅读所有人。任何见解都将不胜感激!

您没有调用read,这是一种方法。

voice = open("...", "rb").read()
#                             ^

最新更新