sounddevice
If you install the sounddevice module with pip on macOS or Windows, the PortAudio library (with ASIO support on Windows) will be installed automagically.
numpy==1.22.2
sounddevice==0.4.4
code: python
>> import sounddevice as sd
>> import numpy as np
>> frequency = 440
>> fs = 44100
>> seconds = 3
>> t = np.linspace(0, seconds, seconds * fs, False)
>> note = np.sin(frequency * t * 2 * np.pi)
>> audio = note * (2**15 - 1) / np.max(np.abs(note))
>> audio = audio.astype(np.int16)
>> sd.play(audio, fs) # audioを再生(再生中、対話モードは入力を受け付ける)
>> status = sd.wait() # waitを呼び出すと、対話モードは再生が終わるまで待つ
>> status # None(代入しなくてもいいのでは?)
sd.play(data, samplerate=fs, blocking=True)