Answer the question
In order to leave comments, you need to log in
How to adjust the playback speed of an mp3 file in python using the pygame module?
I need to run audio in python. For this, I chose the pygame module. It turned out that he plays mp3 very slowly. Please tell me how to change its playback speed?
import pygame
from pygame import mixer
mixer.init()
mixer.music.load('c:\\Music2\\Numb.mp3')
mixer.music.play()
input()
Answer the question
In order to leave comments, you need to log in
import pygame, mutagen.mp3
song_file = "c:\\Music2\\Numb.mp3"
mp3 = mutagen.mp3.MP3(song_file)
pygame.mixer.init(frequency=mp3.info.sample_rate)
pygame.mixer.music.load(song_file)
pygame.mixer.music.play()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question