Skip to content

Programming an audio player

Alex edited this page Jun 3, 2021 · 3 revisions

Audio manipulation

We've got to create an audio player and we've chosen Python3 as our programming language for it. We have to choose the way we will manipulate the sound and mainly the module we will use for that. There are several choices:

  • native player - depends on the system installed audio players which is a big problem
  • playsound module - can play .mp3 and .wave files which is not enough
  • pydub - simple, high level, but depends on PyAudio and ffmpeg and has different commands for different file types which makes new problems
  • snack sound kit - depends on Tkinter which is a GUI module and we will need a GUI to make the player so that's a plus but doesn't have good documentation and enough examples which will make it harder to work with
  • audioplayer module - on first glance looks like it has everything needed, but after some experimentation, I saw that it is not well enough made to do the work
  • PyGame.mixer - PyGame module for loading and playing sounds. A little bit complex, but has good documentation, enough examples, and many possibilities. Depends on PyGame which is a GUI module.
  • Python-VLC - An open-source module for playing different types of media. It does not have good documentation but is easy to understand. Supports many file formats.

Graphical Interface

There is another problem - how will we make the GUI? I'm hesitating between two variants (modules):

  • Tkinter - which we mentioned earlier, doesn't have good documentation but has many examples and tutorials which are helpful
  • PyGame - which we mentioned too. A module for game making in python that has its own sound manipulation modules and a good documentation

Conslusion

After some experimenting, I found that the only sound manipulation module that has all the functionality we need and can play multiple songs at a time is Python-VLC. For GUI I chose Tkinter because it is easier to use than PyGame in my opinion.