How to generate audio from a numpy array?

后端 未结 8 899
囚心锁ツ
囚心锁ツ 2020-11-28 04:09

I want to create \"heart rate monitor\" effect from a 2D array in numpy and want the tone to reflect the values in the array.

8条回答
  •  执念已碎
    2020-11-28 04:59

    For the people coming here in 2016 scikits.audiolab doesn't really seem to work anymore. I was able to get a solution using sounddevice.

    import numpy as np
    import sounddevice as sd
    
    fs = 44100
    data = np.random.uniform(-1, 1, fs)
    sd.play(data, fs)
    

提交回复
热议问题