필터 지우기
필터 지우기

sound delivered at randome interval

조회 수: 1 (최근 30일)
Salvatore Lacava
Salvatore Lacava 2018년 6월 4일
댓글: Walter Roberson 2018년 6월 5일
Hi I would like to deliver a sound after a pause of 10-20 seconds. This is the code for the sound I created in matlab:
amp=100
fs=20500 % sampling frequency
duration=0.04
freq=16000
values=0:1/fs:duration;
startle_sound=amp*sin(2*pi* freq*values)
sound(startle_sound)
Is it possible to do it without using a specific toolbox (like PsychToolBox)?

채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 4일
You can always pause() before doing the sound(), or set up a timer. If you only have a few different sounds you can create audioplayer objects for each of them, and play() the appropriate object when it comes time.
However, you mention PsychToolbox, and tagged with "Neuroscience". That hints that you might want to have fine-grained control over exactly when the sound starts being audible, and that you might want to be wanting to measure reaction time.
For fine-grained control over exactly when sound starts becoming audible, you would probably be better to use the Audio System Toolbox to stream audio, instead of using the variable-time java-based sound() and audioplayer(). Audio System Toolbox can use PortAudio drivers to deliver sounds with low latency. I am not sure you can reliably get better than 10 ms latency though.
Recording response time accurately is not easy without dedicated hardware.
  댓글 수: 2
Salvatore Lacava
Salvatore Lacava 2018년 6월 5일
Thanks for your answer! Can you please give me an example on how to deliver sounds at random intervals using PsychToolbox?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Installation and Operational Settings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by