Re: Audio wrapper for Python

@magurp244

the set_pos function on post 32  doesn't work. i could mesure length of mp3 within using mutagen but, couldn't succeed playing back and forward again. here is the code below:

import pygame
from pygame import mixer
import glob
from mutagen.mp3 import MP3
import sys

def play():
    pygame.init()
    mixer.init()
    pencere = pygame.display.set_mode([640,480])
    song = ("D:\Müzik\Rap-Hip-Hop Old School Break Beats.mp3")
    mixer.music.load(song)
    audio = MP3(song)
    length = audio.info.length

    while True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
                    mixer.music.play()
                if event.key == pygame.K_RIGHT:
                    if mixer.get_busy:
                        mixer.music.set_pos()+length*5/100
                if event.key == pygame.K_ESCAPE:
                    mixer.music.stop()
                    mixer.music.unload()
                    pygame.quit()
                    sys.exit(0)

    #update window
        pygame.display.update()


play()

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector

Reply via email to