Question!!!


Hi
My problem is that the I need the code to take care of two processes concurrently:
1. create beeps sounds in different frequency
2. saving subject responses (key board presses)

So far i tried pulling the subject responses using kbcheck,
but kbcheck response is longer then the gap between two beeps....

%%%%%%%%%

while (k <= NumBeeps)

PsychPortAudio('Start', pahandle,1,0,0);

beepList = [beepList (GetSecs - start)];

CycleStart = GetSecs;

while ((GetSecs - CycleStart) < Period)

[keyIsDown,secs,keyCode] = KbCheck;

while ((GetSecs - CycleStart) < Period)

if keyIsDown

RT = [RT (GetSecs - start)];

while KbCheck && ((GetSecs - CycleStart) < Period) ; end %%% this part lasts too long, and each key press recorder more then once....

end

end

end

k = k +1;

end


%%%%%%%%%%%
and even if ill maximize this, i don't thing it is the ideal way of running concordant processes.
I was thinking of using a callback/ interrupt mechanism .

but i cant find a way to create an on screen/ window object.
do you have any idea how can I do that?

Thank you so much
--
Lilac Adato
cell: 734-604-1248
I would suggest using
beep1=MakeBeep(frequency1,exposureTime1);
beep2=MakeBeep(frequency2,exposureTime2);

Then you can insert
Snd('Play',beep1)
Snd('Play',beep2)

anywhere you want in the code and then go on with other parts of the code without needing to run a loop.

As for the recording more than once, the demos were very helpful. The code from them looks something along the lines of:
wait=1;
while wait
[keyIsDown, timeSecs, keyCode] = KbCheck;
if keyIsDown
result = keyCode(keyYouTest);
% Wait until all keys on keyboard are released:
while KbCheck; WaitSecs(0.1); end;
wait=0;
end
end
which of course can be amended to include recording of response time as well.

--- In psychtoolbox@yahoogroups.com, lilac Adato <lilacadato@...> wrote:
>
> Hi
> My problem is that the I need the code to take care of two processes
> concurrently:
> 1. create beeps sounds in different frequency
> 2. saving subject responses (key board presses)
>
> So far i tried pulling the subject responses using kbcheck,
> but kbcheck response is longer then the gap between two beeps....
>
> %%%%%%%%%
>
> while (k <= NumBeeps)
>
> PsychPortAudio('Start', pahandle,1,0,0);
>
> beepList = [beepList (GetSecs - start)];
>
> CycleStart = GetSecs;
>
> while ((GetSecs - CycleStart) < Period)
>
> [keyIsDown,secs,keyCode] = KbCheck;
>
>
>
> while ((GetSecs - CycleStart) < Period)
>
> if keyIsDown
>
> RT = [RT (GetSecs - start)];
>
> while KbCheck && ((GetSecs - CycleStart) < Period)
> ; end %%% this part lasts too long, and each key press recorder more then
> once....
>
> end
>
> end
>
> end
>
> k = k +1;
>
> end
>
>
>
> %%%%%%%%%%%
> and even if ill maximize this, i don't thing it is the ideal way of running
> concordant processes.
> I was thinking of using a callback/ interrupt mechanism .
>
> but i cant find a way to create an on screen/ window object.
> do you have any idea how can I do that?
>
> Thank you so much
> --
> Lilac Adato
> cell: 734-604-1248
>