audio files and delays

Michiel Spape Michiel.Spape at nottingham.ac.uk
Thu Aug 27 13:12:33 UTC 2009


Hi Conrad et al.,
	I've worked quite a bit with audio files, and pre-buffering in the style of Peter is usually the way to go for me (never used the .add and some differences but this looked very neat). However, I do not think this (problem) should be happening in the first place, unless you use a sort of manual loop (or jump-label, for instance). Do you have these 2500 repeats in a loop, or using many sequences? The thing is that E-Prime should always pre-buffer sound-files if used in a slide (in e-basic help: "E-Studio automatically generates calls to SoundBuffer.Load for the buffer identified as SoundOut.ActiveBuffer for each SoundOut object in the experiment"), and although I have never believed E-Prime can do what NO professional music programme, to my knowledge, can (i.e. play sound with 0 latency) even with sub-quality soundcards (e.g. those with ASIO drivers) and directx engine, the latency should not be... growing. This typically suggests a memory or processing 'leak', such as when you leave response collections unfinished, etc. I therefore suggest rather than looking at the sound, to take a look at your design and programming (of the rest). 
	To give you some indication: I'm currently doing a tapping tasks which should involve about 1200 taps that are to be made in sync with tone (i.e. subject hears tones at about 1 Hz and responds with the spacebar or whatever at similar Hz, trying to minimise tap-to-response asynchrony). So I do just about what Peter suggested (i.e. preload with script, play with script). I find that the onset of the playing is pretty accurate, certainly not shifting, but sometimes, my 50 ms stimuli are cut off (easily detectable as they have a fade-in and out, so that you hear a tick if the fade-in is not played correctly. I've recreated this design in several ways (such as described, or doing buffer.load once, long before the sound is played, etc), more importantly also using normal sound-objects (in or not in slide-objects), but the cut-offs as described above is always present. Anyway, the quality of the sound is not crucial to my experiment, nor is the timing as such as long as these errors are equally distributed over conditions, but just a (sorry) long-winded story to say that I'm sure that buffering errors occur... but they should not be as you describe (growing).

	Should you find no problematic issue with the rest of your design, I have one remaining tip: make 1 audio file with silences and samples pre-mixed, instead of
> > >Slide 1: 350 ms with audio clip (1 of 12 audio files)
> > >Slide 2: 50 ms of black screen buffer
> > >Slide 3: 600 ms with audio clip (same audio file every time); collect
> > >response
> > >Slide 4: 100 ms

1. make soundbuffer etc as Peter described, make it at least 1101 ms
2. fill the buffer with one file: 350 ms of audio clip, followed by 50 ms of silence, followed by 600 ms of audio clip, followed by 100 ms of silence, load and
3. play the file (it will keep playing following this command) 
4. show slides 1 -4 with whatever you want.

Sometimes this method takes quite a bit of time and is, granted, extremely inflexible. But, download a trial version of CoolEdit (these days called adobe audition), and you will be able to get your silences and sounds beyond millisecond accurate: if your system plays at 44.1 Khz, timing accuracy should be correct at about 0.02 ms level. 

Cheers,
Mich


Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology


-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of Conrad
Sent: 24 August 2009 17:13
To: E-Prime
Subject: Re: audio files and delays


I have not figured out how to cache.  Getting the sample script from E-
Prime is taking longer than I hoped.  Does anybody have it?

So this issue is unresolved.  Any other thoughts?

Thanks again.
Conrad



On Aug 21, 11:22 am, Conrad <cmwar... at gmail.com> wrote:
> I am running XP.  I see from other discussions streaming is the way to
> go.
>
> I've tried changing the SoundDeviceOutput properties but that didn't
> help.
>
> I have changed the duration of the slide to multiples of the refresh
> rate and that helped a little.
>
> Next up for my game plan is to cache these audio files, if I can
> figure out how to do that.
>
> Thanks for the help!
>
> On Aug 20, 1:48 pm, David McFarlane <mcfar... at msu.edu> wrote:
>
> > Conrad,
>
> > Since you mention streaming mode, you must be using EP2, which
> > answers the first question.  Next question, are you running this
> > under Windows XP, or Vista?
>
> > -- David McFarlane, Professional Faultfinder
>
> > >Hi all,
>
> > >I am developing a task which includes audio files.  My samples loop
> > >pretty fast.  This is how it looks.
> > >Slide 1: 350 ms with audio clip (1 of 12 audio files)
> > >Slide 2: 50 ms of black screen buffer
> > >Slide 3: 600 ms with audio clip (same audio file every time); collect
> > >response
> > >Slide 4: 100 ms of black screen buffer.
> > >Repeat 2500 times.
>
> > >I have noticed that i get a pretty significant delay 150 ms with each
> > >audio file.  This delay seems to grow quite a bit by the end of the
> > >task to 500 ms.
>
> > >I've played around with the pre-release, audio buffer time, and
> > >streaming vs. buffered audio files and I haven't found a combination
> > >where the audio file will completely play and I don't have a massive
> > >delay.
>
> > >Anybody have any thoughts or suggestions?
>
> > >Thanks,
> > >Conrad
> > >Madison, WI


This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en
-~----------~----~----~----~------~----~------~--~---



More information about the Eprime mailing list