Sounds module on MacOS?
I would like to run my scripts to be portable and run them on mac. I use the sounds module, and I can’t find it in pip. Is it possible to use it on Mac?
soundmodule is specific to Pythonista, it uses native iOS APIs to play sound. It wouldn't run on any other platform since the APIs don't exist, so it's not available on PyPI or anywhere else.
I don't know of any regular Python library similar to Pythonista's
soundmodule. I'm guessing that most GUI/graphics libraries will also support playing sound - you could look at
tkinter, which is a GUI library included in Python's standard library (though not Pythonista, as it doesn't support iOS). There are also lots of other GUI and graphics libraries on PyPI - I don't have much experience with any, but if you just want to play sound, it probably doesn't make much difference which one you use.
Basically all modules listed here are not available outside of Pythonista. There's no repository, source code, package in PyPI, ... It has no sense, because they're Pythonista specific. If you'd like to run your script on Mac, you have to provide your own
soundmodule with functions you do use in Pythonista.
I was thinking about new project providing compatibility layer for Mac, because I was tired of patching, mocking, ... (Sphinx, Travis CI, ...) But then I realized that almost all build / CI / ... servers I do use are running GNU/Linux. One layer for Mac, another one for GNU/Linux, ... Decided not to do it, it's not worth it.
You should check PyObjC If you'd like to leverage existing macOS frameworks, which gives you bidirectional bridge between Python and ObjC world. If you'd like to just play sound, it can be as simple as calling
afplay /path/to/your/sound/filefrom the Python.
This post is deleted!last edited by