本文主要是介绍Python 立体声音频生成,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
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 立体声音频生成的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!