omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Sounds module on MacOS?

    Pythonista
    4
    4
    3146
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Sfoid
      Sfoid last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • dgelessus
        dgelessus last edited by

        The sound module 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 sound module. 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.

        1 Reply Last reply Reply Quote 0
        • zrzka
          zrzka last edited by

          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 sound module 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/file from the Python.

          1 Reply Last reply Reply Quote 0
          • gruntfutuk
            gruntfutuk last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors