Library for working with sound files of the format: .ogg, .mp3, .wav

Overview

playsoundsimple.py

Description

Library for working with sound files of the format: .ogg, .mp3, .wav. By work is meant - playing sound files in a straight line and in the background, obtaining information about the sound file (author, performer, duration, bitrate, and so on). Playing goes through the pygame, and getting information through the mutagen.

Installation

pip install playsoundsimple.py mutagen pygame

More

import playsoundsimple.PlaySoundSimple as pss

# playsoundsimple.PlaySoundSimple.Player
player = pss.Player("sound.mp3")

player.name    # "Never Gonna Give You Up" or None
player.author  # "Rick Astley" or None
player.icon    # b"ICON_BYTES_DATA" or None
player.length  # 213000
player.bitrate # 256

player.play(mode=0 or 1 or -1)      # Modes can be read in pygame readme
player.replace_sound("sound_x.mp3") # Reloads sound file data
player.get_volume()                 # Returns the volume percentage from 0 to 100
player.set_volume(50)               # Sets the volume percentage from 0 to 100
player.pause()                      # Pauses the sound
player.unpause()                    # Resumes sound if it was stopped
player.get_pos()                    # Returns the position in milliseconds (in the form of a float) or 0 if it is not played
player.set_pos(30000)               # Takes a position in milliseconds (in the form of a float) and rewinds
player.stop()                       # Stops the sound and returns its position to the beginning

# playsoundsimple.PlaySoundSimple.Sound
sound = pss.Sound("sound.mp3")

sound.name    # "Never Gonna Give You Up" or None
sound.author  # "Rick Astley" or None
sound.icon    # b"ICON_BYTES_DATA" or None
sound.length  # 213000
sound.bitrate # 256

sound.play(mode=0 or 1 or -1)       # Modes can be read in pygame readme
sound.get_volume()                  # Returns the volume percentage from 0 to 100
sound.set_volume(50)                # Sets the volume percentage from 0 to 100
sound.stop()                        # Stops the sound and returns its position to the beginning

Author

You might also like...
Improved Python UI to convert Youtube URL to .mp3 file.
Improved Python UI to convert Youtube URL to .mp3 file.

YT-MP3 Improved Python UI to convert Youtube URL to .mp3 file. How to use? Just run python3 main.py Enter the URL of the video Enter the PATH of where

An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio.

yt-dl (GUI Edition) An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio. How do I download this? Windows: Fi

Synchronize a local directory of songs' (MP3, MP4) metadata (genre, ratings) and playlists with a Plex server.

PlexMusicSync Synchronize a local directory of songs' (MP3, MP4) metadata (genre, ratings) and playlists (m3u, m3u8) with a Plex server. The song file

Extract the songs from your osu! libary into proper mp3 form, complete with metadata and album art!
Extract the songs from your osu! libary into proper mp3 form, complete with metadata and album art!

osu-Extract Extract the songs from your osu! libary into proper mp3 form, complete with metadata and album art! Requirements python3 mutagen pillow Us

GNOME powered sound conversion
GNOME powered sound conversion

SoundConverter A simple sound converter application for the GNOME environment. It reads anything the GStreamer library can read, and writes Ogg Vorbis

Graphical interface to control granular sound synthesis.
Graphical interface to control granular sound synthesis.

Granular sound synthesis interface SoundGrain is a graphical interface where users can draw and edit trajectories to control granular sound synthesis

Open Sound Strip, Sequence or Record in Audacity
Open Sound Strip, Sequence or Record in Audacity

Audacity Tools For Blender Sound editing in Blender Video Sequence Editor with Audacity integrated. Send/receive the full edited sequence or single st

Reading list for research topics in sound event detection

Sound event detection aims at processing the continuous acoustic signal and converting it into symbolic descriptions of the corresponding sound events present at the auditory scene.

A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

A simple python script to play bell sound in your system infinitely, just for fun and experimental purposes

Releases(v0.5.0)
Owner
Romanin
I'm a Python programmer. But I also know C++, C#, PHP, JavaScript, plus HTML and CSS markup languages. I also know how to work with Linux.
Romanin
Read music meta data and length of MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave files with python 2 or 3

tinytag tinytag is a library for reading music meta data of MP3, OGG, OPUS, MP4, M4A, FLAC, WMA and Wave files with python Install pip install tinytag

Tom Wallroth 435 Feb 17, 2021
Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.

Rhet Turnbull 14 Nov 2, 2022
A python script that can play .mp3 URLs upon the ringing or motion detection of a Ring doorbell. The sound plays through Sonos speakers.

Ring x Sonos A python script that plays .mp3 files whenever a doorbell is rung or a doorbell detects motion. Features Music! Authors @braden Running T

braden 0 Nov 12, 2021
:sound: Play and Record Sound with Python :snake:

Play and Record Sound with Python This Python module provides bindings for the PortAudio library and a few convenience functions to play and record Nu

spatialaudio.net 750 Dec 31, 2022
Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5

Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5. It gives you the ability to play, pause, and Equalize any one-channel wav audio file and play 3 different instruments.

Mustafa Megahed  1 Jan 10, 2022
Generating a structured library of .wav samples with Python.

sample-library Scripts for generating a structured sample library with Python Requires Docker about Samples are written to wave files in lib/. Differe

Ben Mangold 1 Nov 11, 2021
A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream).

rfsoapyfile A Python 3 script for capturing and recording a SDR stream to a WAV file (or serving it to a HTTP audio stream). The script is threaded fo

null 4 Dec 19, 2022
nicfit 425 Jan 1, 2023
python script for getting mp3 files from yaoutube playlist

mp3-from-youtube-playlist python script for getting mp3 files from youtube playlist. Do your non-tech brown relatives ask you for downloading music fr

Shuhan Mirza 7 Oct 19, 2022
A python program to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks.

I'm writing a python script to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks called ReCut. So far there are two

Dönerspiess 1 Oct 27, 2021