On Wed, Jul 8, 2009 at 2:26 AM, Lenard Lindstrom
<len-l@xxxxxxxxx> wrote:
Hi Brian,
You would probably have to do a pygame.quit rather than pygame.mixer.quit for each pass of the loop. The pgyame.display.set_mode must also come after the pygame.init. The display is not necessary for mixer though.
Lenard
Brian Gryder wrote:
'''
How do I change the frequency of the Pygame.mixer by incrementing the frequency value in a loop?
Please see the example below where I am trying to initialize the frequency at 44100 and then add 2000 to the frequency each time it loops. In this example below the pitch does not change, I really want it to change.
Any links or snippet of code would be greatly appreciated, Thanks!
'''
import pygame
from pygame.locals import *
from sys import exit
screen = pygame.display.set_mode((800, 600), 0, 32)
frequency = 44100
while True:
frequency = frequency + 2000
print frequency
pygame.mixer.pre_init(frequency, 16, 2, 4096)
pygame.init()
test_sound = ""
test_sound = pygame.mixer.Sound("check.wav")
mychannel = test_sound.play()
while pygame.mixer.get_busy() == True:
pass
#"passing"
pygame.mixer.quit