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

Pysoundcard currently doesn't play sound from file, pull request with fix submitted #1299

Closed
dantheman39 opened this Issue Nov 4, 2016 · 0 comments

Comments

Projects
None yet
3 participants
@dantheman39
Contributor

dantheman39 commented Nov 4, 2016

Hey guys, here the text of the pull request I submitted which just about says it all:

I'm definitely not a master of audio programming, but I was able to get a sound file to play by making these changes.

The original error was from line 425, and was complaining that there is no attribute for "status":

return self.__dict__['status']
KeyError: 'status'

In soud.py, the comment in _setSndFromArray (about line 434) indicates that it is the function that will ultimately get called for pysoundcard, and the _setSndFromFile wasn't ever calling it, hence self._snd was still None, and the module failed to load correctly (see line 174 also, it seems like there is an error that should have been called since self._snd is None?):

if self._snd is None:
    pass # raise ValueError, "Could not make a "+value+" sound"

Therefore, my fix was to call _setSndFromArray from within _setSndFromFile. I also changed sndArray to be a local variable (removed self.), since this value would be set in _setSndFromArray . I can now play sound files. Please let me know if you have any comments.

Here's the pull request.

#1298

In the process, I found that there was a bug in pysoundfile (not sure if linux specific), that they fixed about a week ago, but which is apparently not in the pip repos. I'll make a separate issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment