[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Pygame + Jack?
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Pygame + Jack?
- From: Brian Gryder <bgryderclock@xxxxxxxxx>
- Date: Tue, 15 Feb 2011 23:13:59 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 15 Feb 2011 23:14:08 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=qDd6TPlvGZhX6bWZG/VwsWHIkBfO6xfpwsavEzhXr2E=; b=QzOeB/JLKa+XaYn/nEK8kESJhb1gbDbM9iCXLe6k/4ritH5CSJy6pGKV/RubdyDPjn lunO0pOB+ytCvB5T2tjqPTCb+9LkTAloGHoYIkgsEAN5KM99zNKqiB+lY+s3LdKay75m zJTzqBD3T4O9x3hk96biOx3T88WkIzhCNaEBY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Tf8svVsBc3MPW/jgfMhmPlignllo99z/fwLTd1b9fR2WalQaxaAZKUEKattSAcf8Sc GpbAa0U4bt/3K1CL4gvrcwMPJd/wK49UhLSX2E8kIPl6tPt7L8UTOXfq8XI312G2ojId bNRzcdMe6S0QHSCuYc0MDnjstw3DCsA/DGZiQ=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
I wrote this simple drum pad program with pygame and the lag between key presses and the start of the sound bugs me. Can I use JACK with pygame so there will be less latency (in the same way that SooperLooper+Jack in Ubuntu is super fast)? Any code snippets or links to articles would be greatly appreciated.
###### start simple.py #############
import pygame
from pygame.locals import *
from sys import exit
pygame.mixer.pre_init(48000,-16,2,1024)
screen = pygame.display.set_mode((400, 300), RESIZABLE, 32)
pygame.display.set_caption("Simple!!1")
pygame.init()
pygame.mixer.set_reserved(1)
reserved_channel_0 = pygame.mixer.Channel(0)
sound1 = pygame.mixer.Sound("beat1.wav")
while True:
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type == KEYDOWN:
if event.key == K_UP:
sound1.play()
#print "UP"
if event.key == K_DOWN:
sound1.stop()
#print "DOWN"
###### end simple.py #################