[visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- From: Christoph Lehmann <lehmann@xxxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Wed, 12 Nov 2003 15:39:38 +0100
many thanks, christophe
I will look at it, as soon as I have some time here in the lab...
did you ever use visionegg for your fMRI experiments?
cheers
christoph
On Wed, 2003-11-12 at 15:20, Christophe Pallier wrote:
> 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
--
Christoph Lehmann <lehmann@xxxxxxxxxxxx>
University Hospital of Clinical Psychiatry
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- References:
- [visionegg] sound and visionegg (e.g. portaudio): demo code available?
- From: Christoph Lehmann
- [visionegg] Re: sound and visionegg (e.g. portaudio): demo code available?
- From: Christophe Pallier
Other related posts:
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- » [visionegg] Re: sound and visionegg (e.g. portaudio): demo codeavailable?
- [visionegg] sound and visionegg (e.g. portaudio): demo code available?
- From: Christoph Lehmann
- [visionegg] Re: sound and visionegg (e.g. portaudio): demo code available?
- From: Christophe Pallier