[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Static on looping music



Hello.

I am having some trouble with playing music in my project.
- Platform is Windows XP. Running Python 2.5.4 and Pygame 1.8.1
- The song is in .ogg format and plays fine in both VLC and iTunes
- When playing the song for the first time in a pygame program it
plays fine
- When the music begins again when looping, there is a significant
audible static.

I was wondering if there is a problem with my code or the song file
itself and what steps I can take to fix it in either case. I have
tried the solution of putting a pygame.mixer.pre_init(44100, -16, 2,
4096) statement before pygame.init() but that seems to make the
problem worse.

Code Sample that reproduces the problem:
=======

import pygame
from pygame.locals import *
import os
from sys import exit

pygame.init()
screen =  pygame.display.set_mode((200,200),0, 32)
clock = pygame.time.Clock()

screen.fill((100,100,100))
pygame.mixer.music.load('02_battle1_2.ogg')
pygame.mixer.music.play(-1) # Play and Loop Forever
pygame.display.flip()
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
    clock.tick(30)

=====

Test script and music file
http://www.mediafire.com/?gjjfziy5dfh

Thank you in advance