playing SoundIn audio within the same trial

Alon Hafri ahafri at gmail.com
Thu Jul 14 15:59:56 UTC 2011


Hi all,

I just experimented with using the SoundIn object for the first time
yesterday in order to play a captured image description within the
same trial. I want to note the difficulties I had, how I got it to
work, and then some questions about how it could have been done
easier, perhaps.

My experiment is a production task, where viewers are eyetracked as
they describe an image aloud, and their description is recorded via a
SlideIn object. For demonstration purposes I give the option of
playing back viewer eyegaze concurrently with the audio of their
description within the same trial -- which is where I ran into
difficulty! By examining the compiled script, I see that the SlideIn
audio is stored in a SoundCaptureBuffer object, but this is not saved
to a wav file until the end of the procedure, where it is
automatically saved by a call to a "SaveToFile" method (e.g.
Sound1SoundCaptureBuffer.SaveToFile). So ordinarily the recorded sound
is not accessible until the end of trial, which is not what I want.

I could not figure out a way to play the SoundCaptureBuffer itself (I
tried a call to SoundOut1SoundCaptureBuffer.Play, but that method
doesn't exist), so I got around this by calling the SaveToFile method
early on in an InLine. I then used a later SoundOut object to play
this newly created audio file. The SlideIn object had "@Auto" as the
filename, which means it automatically created a unique wav file name
to save to, and so I created an attribute "ProductionFilename", saved
the SoundCaptureBuffer filename to this attribute, and then the
SoundOut object called this attribute as its filename.

The biggest difficulty I had was the automatic SaveToFile that
occurred at the end of the procedure -- since the file had already
been created with my earlier SaveToFile in the InLine, I got an error
"Writing captured audio to file failed". I got around this by changing
the SoundCaptureBuffer filename after calling SaveToFile, to
"temp.wav". For some reason, even though it was overwriting the
"temp.wav" file every trial, no error was produced, whereas before
when it was trying to write over the newly created file (@Auto, e.g.
"Trial1-SoundIn1-1.wav") it failed.

So here's the setup I have now that works (simplified, with irrelevant
objects removed):
SoundIn1 object (duration = 0, stopafter = no, filename = @Auto) -->
start capturing sound and immediately advance to test picture
TestPicture image object (wait for Spacebar) --> picture to be
described
InLine:
	SoundIn1SoundCaptureBuffer.SaveToFile 'save sound file early
	c.SetAttrib "ProductionFilename", SoundIn1SoundCaptureBuffer.Filename
'set a ProductionFilename attribute so the later SoundOut object can
play the saved sound file
	SoundIn1SoundCaptureBuffer.Filename = "temp.wav" 'for some reason
this prevents an error...
SoundOut1 object (duration = 0, stopafter = no, filename =
[ProductionFilename]) --> plays the recorded sound file and
immediately advances to the gaze replay
TETGazeReplay (the eyegaze replay package call) --> replays the viewer
eyegaze overtop the test picture (while the audio from the SoundOut
object is still playing)
...
end of procedure: there is an additional
SoundIn1SoundCaptureBuffer.SaveToFile call that I imagine is not
preventable (you can see it in the compiled Full script)


My questions are:
1) Why when I change the sound capture filename to "temp.wav" is the
script successful (even though the SaveToFile method is called at the
end of the procedure again so is overwriting the temp.wav file),
whereas without changing the filename, I get an error?

2) Was there an easier way to do this?

3) Is there documentation on the properties of the SoundIn object
available in E-basic? I couldn't find any in the E-Basic help, so had
to figure it out by looking at the compiled script. For example, it
would be nice to know if there is a way to play the SoundCaptureBuffer
before it is saved to file (I tried a SoundIn1SoundCaptureBuffer.Play
method but it didn't work).

4) A separate and minor question, but can you specify the filename for
the SoundOUT object at runtime (so I don't have to do it by way of an
attribute)?

I hope everything was clear in the above. Thanks in advance for your
help!
Alon

-- 
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