我在python中有以下代码
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现在,我想使用“信号”和“速率”创建一个pydub段。
audio_segment = pydub.AudioSegment()那么,我如何创建这个音频段,在此之后,如何作为一个数字数组返回我的信号呢?
发布于 2016-03-02 01:29:56
我能够在我的机器上运行这个代码:
from scipy.io.wavfile import read
from pydub import AudioSegment
rate, signal = read("./test/data/test1.wav")
channel1 = signal[:,0]
audio_segment = pydub.AudioSegment(
channel1.tobytes(),
frame_rate=rate,
sample_width=channel1.dtype.itemsize,
channels=1
)
# test that it sounds right (requires ffplay, or pyaudio):
from pydub.playback import play
play(audio_segment)https://stackoverflow.com/questions/35735497
复制相似问题