[comp.sys.next] using the mic jack for data acquisition

pts@mendel.acc.Virginia.EDU (Paul T. Shannon) (08/03/90)

We run auditory experiments (psycho-acoustics and -linguistics), and we've
just started using the NeXT.  Collecting timed responses is an important
part of many of our experiments:  some auditory stimulus is played, and we
measure, in milliseconds, the time that passes before the subject responds.
Sometimes the elapsed time is measured from the end of the stimulus (say,
after a sentence or phrase is complete); sometimes we want to measure time
from the beginning of the stimulus.

It's occurred to me that the codec microphone jack, and all the NeXT software
that records from it are ideal for these simple data acquisition tasks.  As
a test, I used ScorePlayer to play the BachFugue with the DSP, and
simultaneously recorded the music on the codec microphone.  I was pleased to
see that, when playing back the codec recording, all of the music seemed to
be there -- the fidelity was much diminished, but I couldn't detect any 
music that go lost due to competition between the DSP and the codec a/d
converter.  

If I built an appropriate button box, with 2-4 buttons, which produced
a few distinct voltages in the right range, and plugged it into the codec
jack, it ought to be very easy to collect timed responses from our subjects.
I have some questions though that I don't know how to answer:

     1.  How can I get the codec to start recording at the right times?
         Is there some way, for example, to send a message to the 
         codec recording software so that it starts just as the DSP
         starts (or ends)?  How close to instantaneous can this 
         messaging be?  How might I collect real measurements of this
         delay, so that at least I'd know the average?

     2. Is it possible to set the sampling rate on the codec a/d
        converter so that it runs at 1000 Hz, rather than ~8000?
        Millisecond timing is all the accuracy we need.

I'll be grateful for any tips, advice, speculation, or (!) sample code.
Thanks.

  - Paul Shannon
    pts@virginia.edu