4
我有蟒蛇下面的代碼如何使用numpy數組創建pydub AudioSegment?
from scipy.io.wavfile import read
rate, signal = read('./data/input.wav')
# get only one channel
signal = signal[:,0]
# do a bunch of processing here
現在我想用「信號」和「速度」
audio_segment = pydub.AudioSegment()
那麼,如何可以創建這個音頻段,之後創建一個pydub段 我怎樣才能找回我的信號作爲一個numpy數組?
當我嘗試這個,我得到IndexError:太多的指數上線「通道1 =信號[:0]」 – hubatish
但是,呃...。這是因爲我的文件只有一個通道。檢查與簡單singal.shape打印聲明 此外,在numpy版本1.9之前,我必須使用tostring而不是tobytes – hubatish