-
Notifications
You must be signed in to change notification settings - Fork 153
Description
Hi! I'm not reporting a bug, but suggesting a minor change.
First, I have to say that I use sounddevice a lot in my projects, and I really like it, so thanks for that. The thing is, the rec function of the module returns a numpy.ndarray (when out is None) whose shape[1] equals the given channels, but the recorded data has always two dimensions (ndim is 2). This could be okay, but both scipy.io.wavfile and soundfile read functions return a 1D numpy array when loading a one-channel audio file. So, both
from scipy.io.wavfile read
sample_rate, audio = read('audio_mono.wav')
print(audio.ndim)
and
import soundfile as sf
audio, sample_rate = sf.read('audio_mono.wav')
print(audio.ndim)
show 1. I think that, if one is loading a mono audio, sd.rec should return a 1D array, like those read functions. Besides, the rec function could take an always_2d boolean argument, like the one in the read function of the Bastian Bechtold's soundfile library, to let one decide the ndim of the returned array.
So why I'm asking here, when I can ask both scipy and soundfile developers to change their functions to complain sd.rec? My criterion is simple: those libraries are older, and consequently, there are more people using those than this one for a while. I hope that "sounds" reasonable. Regards.