[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Incrementing the frequency of the Pygame.mixer with a Loop?
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Incrementing the frequency of the Pygame.mixer with a Loop?
- From: Brian Gryder <bgryderclock@xxxxxxxxx>
- Date: Tue, 7 Jul 2009 22:50:11 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 07 Jul 2009 22:50:16 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=QtaejEjkf8ldslGfNOm2UUlNNP3OgLc9DGmsmeieEiE=; b=ee6vvwoweSulfceAkDObTCBG1S+w3rOu/RmkJms4xwDgbD8VAl9x+JaKJOfNSKj8kX 2LDqVGLdrUIchuRNaxtgjoouJ98KfB6iSYy9svEMfEi8Ulc0n2BlxOxFIF9hPbG6cI/i 2oxcdHz+gbkiu84G6sj5Oqug38kStjISCeNe4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=G2cxndlcudW6+lNZPf4h8Q12yyWPhFkXSOyldZGJaqA4YPzRbC8zoja/7+SVkC51j9 Rzt5gXill7geBBixwZOhtb6ue4eOm6w5w3nNxMAkAqs8JaT1QVu0Q/9vdkMTzxoHKitV lKohts05ma5aUEVr3qKGceMVVXDTJ0jPfH3LE=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
'''
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