-
Notifications
You must be signed in to change notification settings - Fork 115
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
Linux-Debian: getting error while invoking playsound #1
Comments
Hi, I don't have any machines running Linux, so I'm not able to help with this. I copied the Linux function for this module from an old Python mailing list. If you manage to find a solution, please share it and I'll be happy to update the module to include it. Taylor |
Seeing the same issue on Centos 7.2.1511 |
And the same in pip install on openSUSE Time to learn some Linux :) |
@Rumbles - I have a lot of servers running RHEL that I can VNC into... But VNC doesn't stream audio, does it? Need to get something installed on one of my local machines... |
Got it working by removing AFMT_S16_LE, AFMT_S16_BE from the import statement. Those names do not exist in the wave package. After this I can play wav's correctly, mp3 does not work. in function _playsoundNix change: from wave import open as waveOpen, AFMT_S16_LE, AFMT_S16_BE to from wave import open as waveOpen |
Hi, Yeah, I only expected WAV to work. The problem is, I don't think there's any standard library that comes with any major Linux distribution that decompresses MP3. I've seen pure Python code that decompresses MP3 into WAV, but it runs at around 0.5x real time, meaning it's not capable of decompressing and playing at the same time. I'm thinking I might try installing Ubuntu on an old laptop I have this weekend. Maybe I'll find a solution for playing MP3s and other formats. Taylor Sent from my iPhone
|
Gstreamer might do the trick. I'll check if I have some time this weekend. I decompress all formats to wav anyway because I use them in psychological research where I need low latency and minimized background processes. But for normal use this is not preferable of course. |
I had the same issue as OP, so I followed dev-jam's advice and removed the two names from import, but now I'm getting Wave_read instance has no attribute 'exit' error. I use Python 2.7.11 in Lubuntu 16.04. Does anyone know how to fix this? |
Had the same problem.
to:
Then it works. |
Tried your suggestion, now I'm getting a different error: _File "/usr/local/lib/python2.7/dist-packages/playsound.py", line 94, in playsoundNix |
playsound don't work for linux, even when I made the aforementioned suggestions. I get all those errno. |
E2DUf: seems like you have not installed oss4 on your linux. Playsound uses oss4 and not ALSA/pulse/jack etc. Works perfectly for me on debian jessie with oss4. My goal with playsound was to test/use oss4 with low and reliable latencies. My tests showed Alsa to have lower latency. If I remember correctly: 3.5 ms with stddev 0.9 ms. Oss4 + playsound is more in the range of 10 ms latency. On my desktop I still use oss4 for assumed better audio quality. |
So no linux solution for this, am I right? |
Someone mentioned Gstreamer earlier. I have some experience with Gtk+ so I found this tutorial and I made this thing based on it. It works for me and I would like to know if it works for others too. import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
Gst.init(None)
playbin = Gst.ElementFactory.make('playbin', 'playbin')
playbin.props.uri = 'file:///path/to/the/file.mp3'
playbin.set_state(Gst.State.PLAYING)
bus = playbin.get_bus()
bus.poll(Gst.MessageType.EOS, Gst.CLOCK_TIME_NONE)
playbin.set_state(Gst.State.NULL) Edit: Most distributions come with the dependencies installed, so I think this is a good solution if this works. |
@Akuli it works for me on ElementaryOS Loki. |
I'll probably make a pull request about this thing tomorrow. Hopefully @gansai notices it. |
Oops, I meant that hopefully @TaylorSMarks notices it, not gansai :) |
I accepted your pull request. The version on PyPI should probably be updated to include this at some point... |
@TaylorSMarks - Just started using your package a week ago, ran into this bug today, and am pleasantly surprised to find out it is fixed! (Thank you, @Akuli!) But since the version on PyPI hasn't yet been updated, how do I install it from source (i.e., GitHub)? |
This StackOverflow Q&A should answer your question:
https://stackoverflow.com/questions/4830856/is-it-possible-to-use-pip-to-install-a-package-from-a-private-github-repository#4837571
… On May 27, 2017, at 19:50, Matthew Chen ***@***.***> wrote:
@TaylorSMarks - Just started using your package a week ago, ran into this bug today, and am pleasantly surprised to find out it is fixed! (Thank you, @Akuli!)
But since the version on PyPI hasn't yet been updated, how do I install it from source (i.e., GitHub)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks. Do you have any idea when the version on PyPI will be updated? |
The
|
Okay, I decided to try going through the effort of uploading a newer version to PyPI today. I'm not sure if I did things properly or not. I found that I had some local changes that I had never committed. Ran these commands to handle that: $ git add playsound.py It looks like my small change now shows up on github and it didn't blow away the pull requests that I've accepted, so I think that's all good. Then to actually upload to Pypi, I updated the version number in setup.py (from 1.2.1 to 1.2.2) then ran: It's not clear to me whether that worked or not. This is the output: But on the package's page on pypi, it shows I uploaded something... and So I think I've successfully updated whatever is on Pypi? |
I'm not sure if your I.e. did you ever update the download url? |
Hi Taylor,
My System Config:
python 3.4.2
Debian 64bit
I got the following error while invoking playsound:
Traceback (most recent call last):
File "/home/gansai/PycharmProjects/python_3.4.2/tryPlaySound.py", line 7, in
playsound('/home/gansai/Music/abc.mp3')
File "/usr/local/lib/python3.4/dist-packages/playsound.py", line 81, in _playsoundNix
from wave import open as waveOpen, AFMT_S16_LE, AFMT_S16_BE
ImportError: cannot import name 'AFMT_S16_LE'
Please let me know how I should configure ossaudiodev.
Thanks.
The text was updated successfully, but these errors were encountered: