-
pip安装依赖
pip install wave pip install numpy pip install soundfile
-
立体声音频生成示例代码
import wave import numpy as np import soundfile as sf # read wave files left_data, _ = sf.read("test_1.wav") right_data, _ = sf.read("test_2.wav") # A 2D array where the left and right tones are contained in their respective rows stereo = np.vstack((left_data, right_data)) # Reshape 2D array so that the left and right tones are contained in their respective columns stereo = stereo.transpose() sf.write('stereoAudio.wav', stereo, samplerate=44100)
Python 立体声音频生成
最新推荐文章于 2024-08-09 07:27:09 发布