[visionegg] Re: sound and visionegg (e.g. portaudio): demo code available?
- From: Christophe Pallier <pallier@xxxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Wed, 12 Nov 2003 15:20:13 +0100
Hello Christoph,
Andrew, (or anybody else): do you have some simple visionegg code
available, which you could send me?
Here is a very simple code using only pygame.
The filenames are stored in the "stims" variable, but they could be read
from a text file.
This script does not record any response from the subject.
#!/usr/bin/env python
"""playing a list of sound files at regulat intervals"""
import os.path
import pygame.mixer, pygame.time
mixer = pygame.mixer
time = pygame.time
#choose a desired audio format
mixer.init(16000)
stimpath="/home/pallier/sample_sounds/"
stims="""
tone0064.wav
tone0128.wav
tone0256.wav
tone0512.wav
tone1024.wav
tone2048.wav
tone4096.wav
tone8192.wav
"""
def play(file):
file = os.path.join(stimpath,file);
sound=mixer.Sound(file)
channel=sound.play()
while channel.get_busy():
time.wait(10)
start=time.get_ticks()
SOA=2000
n=0
for i in stims.split():
n=n+1
while time.get_ticks()-start > n*SOA:
time.delay(10)
print "playing %s" % i
if i:
play(i)
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- From: Christoph Lehmann
- References:
- [visionegg] sound and visionegg (e.g. portaudio): demo code available?
- From: Christoph Lehmann
Other related posts:
- » [visionegg] sound and visionegg (e.g. portaudio): demo code available?
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo code available?
available, which you could send me?
====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html
- [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- From: Christoph Lehmann
- [visionegg] sound and visionegg (e.g. portaudio): demo code available?
- From: Christoph Lehmann