Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python audio library
#1
I am creating a project that has a module which requires audio playback.(similar to a music player)
So I'm looking for a Python audio library that:

1- Supports mp3 and Ogg file format
2- Platform independent or supports Windows and Debian(Linux)
3- Support play, pause, and seeking.
4- Well documented and simple API.
5- Return signal on playback completion.


Few I tried:
a- PyQt4 phonon-> Not working on windows, getting errors.
b- Pydub - doesn't have pause and seeking.
c- Simpleaudio - supports only wave.

Please suggest.
Reply
#2
pygame's mixer.music module supports mp3 and ogg, runs on most platforms, supports play/pause/seek, has a fairly simple api, AND you can set a callback event to fire when it completes.

https://www.pygame.org/docs/ref/music.html

Don't let the pygame name fool you, it's built modularly, so you can init() just the mixer, and it can work without a display attached.
Reply
#3
Thanks for suggestion. I'll check it out.
Reply
#4
I have used PyGame module to build a basic mp3 player. The sound quality was awesome. Cool
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
An other option is Pyglet.
Sound and video
Quote:
  • Load images, sound, music and video in almost any format. 
  • pyglet can optionally use AVbin to play back audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as DivX, MPEG-2, H.264, WMV and Xvid.
Reply
#6
(Aug-07-2017, 08:40 PM)snippsat Wrote: An other option is Pyglet

Good suggestion, thank you. I thought it would be too many dependencies.Its well documented too.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  error python audio codiac 3 4,125 Mar-30-2023, 03:12 PM
Last Post: deanhystad
  python audio analysis kiyoshi7 3 1,764 Feb-22-2022, 06:09 PM
Last Post: Axel_Erfurt
  Real Time Audio Processing with Python Sound-Device not working Slartybartfast 2 3,962 Mar-14-2021, 07:20 PM
Last Post: Slartybartfast
  Handling multi-input/output audio in python bor1904 4 3,573 Nov-04-2020, 08:25 AM
Last Post: CHLOVRL
  Accessing IP Cam Audio In Python Haselsmasher 1 5,458 Jul-10-2020, 02:59 AM
Last Post: kiliantics
  How to do real-time audio signal processing using python Zenolen 7 16,537 Nov-04-2019, 02:57 AM
Last Post: jefsummers
  How to get the duration of AMR audio file using python Prince_Bhatia 0 2,246 Aug-12-2019, 05:58 AM
Last Post: Prince_Bhatia
  Python Idea Assist.: BerryIMU & Raspberry Pi 3 Audio Mapping StephLeber 0 2,280 Dec-09-2018, 10:43 AM
Last Post: StephLeber
  Play Audio File w/ Python ducky_12 8 4,615 Sep-30-2018, 08:54 AM
Last Post: wavic
  Help with python and audio Burca 2 3,145 Apr-29-2018, 09:52 PM
Last Post: Burca

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020