Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audiolab.play : handling the data array the "wrong" way? #10

Open
wslihgt opened this issue Jul 5, 2012 · 2 comments
Open

audiolab.play : handling the data array the "wrong" way? #10

wslihgt opened this issue Jul 5, 2012 · 2 comments

Comments

@wslihgt
Copy link

wslihgt commented Jul 5, 2012

Hi David,

Just ran into that error, under MacOs 10.6 (Snow Leopard): I have some data array for a stereo audio file, with sampling rate 44.1kHz. While I usually prefer to avoid playing the sound from the Python interpreter (I use ipython -pylab), I just wondered if my old install worked. As a matter of fact, when I read data using audiolab (Sndfile or with wavread), then I get an array which cannot be played "as is"! It seems that it needs to be transposed so that it works (see the output error below).

I guess it's just about changing the number of channels in the soundio/play.py file. At least, it feels that there should be some compatibility between the way the data is stored in the array from the read functions, and the way it is handled in the method play. What do you think? My installation is not recent, but never really tried that before (actually probably ran into that error before, but never dug much into it). From my understanding, I don't believe that's due to my installation configuration, but if you need more details, I can dig a bit more.

Also, I m just wondering: while the wrapper seems to work fine and rely on libsndfile for all "advanced" stuff, is there gonna be any further development effort on this project? Is it still active? (and does it need to be active at all, anyway ?!!) Always thought that module would be perfect if included in some "bigger" module, such as numpy or more likely scipy, so that there is even less barrier for audio signal processing researcher who want to come from Matlab to Python!

Here is the output of the error:

In [24]: data.shape 
Out[24]: (1767316, 2)

In [25]: fs
Out[25]: 44100

In [26]: al.play(data,fs)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/Users/.../<ipython-input-26-8ecea18253de> in <module>()
----> 1 al.play(data,fs)

/Users/.../Library/Python/2.7/lib/python/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.5-x86_64.egg/scikits/audiolab/soundio/play.pyc in play(input, fs)
    107     handle mono on its own.
    108     """
--> 109     return _play(input, fs)

/Users/.../Library/Python/2.7/lib/python/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.5-x86_64.egg/scikits/audiolab/soundio/play.pyc in _play(input, fs)
     79                   "Only input of rank 1 and 2 supported for now."
     80 
---> 81         dev = CoreAudioDevice(fs=fs, nchannels=nc)
     82         dev.play(input)
     83 else:

/Users/.../Library/Python/2.7/lib/python/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.5-x86_64.egg/scikits/audiolab/soundio/macosx_backend.so in macosx_backend.CoreAudioDevice.__init__ (scikits/audiolab/soundio/macosx/macosx_backend.c:1077)()

RuntimeError: Error while setting stream format.

In [27]: al.play(data.T,fs) # this works just fine

In [28]: 

Cheers!
Jean-Louis

@cournape
Copy link
Owner

Hi Jean-Louis,

Sorry for the late answer, for some reasons, I did not have GH set up to ping me on updates on this project.

Audiolab will not be included in scipy or numpy for two reasons: first, the license of libsndfile is not BSD, and we want to ensure pure BSD for numpy/scipy. Second, even if the license were compatible, it would add some dependency: numpy/scipy are hard enough to build already. There may be a way to include it in the 'gpl/lgpl eggs' set of EPD (that you can use for free within an academic institution), but that's not just my decision to make :)

Regarding audiolab development, I realistically won't have time to make the package much better than its current state. I will take some time to fix most bugs that have been mentioned the last 2 years or so, maybe add support for python 3, but won't go much further.

@cournape
Copy link
Owner

Regarding your actual issue, there should be a way to specify the axis that specify time vs the one specifying channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants