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

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

Closed
dantheman39 opened this issue Nov 4, 2016 · 0 comments
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior. 🌟 enhancement Proposed improvement or feature request.

Comments

@dantheman39
Copy link
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.

@peircej peircej closed this as completed Nov 7, 2016
@hoechenberger hoechenberger added 🐞 bug Issue describes a bug (crash or error) or undefined behavior. 🌟 enhancement Proposed improvement or feature request. library labels Nov 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Issue describes a bug (crash or error) or undefined behavior. 🌟 enhancement Proposed improvement or feature request.
Projects
None yet
Development

No branches or pull requests

3 participants