Although a large number of acoustic stimuli can be found on the experimental PC, it is often desirable to design your own. A number of MATLAB routines have been developed to generate single channel wav-files.
In principle, you need to:
These steps are shown in figure 1, and described below.
This figure is created with pa_how2createsounds_example
The following MATLAB routines can be used for the most frequently used stimulus types:
For the hoop / sound localization setup, the sampling rate of the RP2.1 for DA-conversion is set at 48828.125 Hz, so that the inter-sampling distance is 20.48 μsec.
After the generation of a signal, you generally want to filter your signal, either to bandpass your signal:
or to equalize the signal:
To prevent onset distortions, you need to ramp the data
Because of an idiosyncrasy in our set-up, we need to pre- and append 20 milliseconds of zeros to the signal. This is because the second TDT RP2.1 DA-channel is used to control the sound level. Switching this on will also create a sudden onset peak, that needs to be prevented. This is solved by a level-ramp within the RCO. We need to consider this level-ramp by applying:
All steps (generation, filtering, equalizing, and ramping) can be done by TDT, but at present this takes precious time.
And when this is done, we need to save the data, so that it can be used by the TDT system:
You can check whether the stimulus generation has succeeded, with:
Let‟s generate a GWN stimulus. Stimulus 3.0 sec, bandwidth from 0.5 to 20 kHz, with on- and offset envelopes.
In Matlab:
Noise = pa_gengwn(3); % Default envelope (250 pnts) and filter % noise is lp-filtered at 20 kHz % and hp-filtered at 500 Hz psd(Noise);Frequencies below 500 Hz are never useful, and produce distortions on speakers, so they should be filtered out with a highpass-filter. This is already done by default in gengwn.
HP = pa_highpass(Noise); % noise is hp-filtered at 3 kHz psd(HP); LP = pa_lowpass(Noise); % noise is lp-filtered at 3 kHz psd(LP);
You might want to equalize the signal:
Noise = pa_equalizer(Noise); HP = pa_equalizer(HP); LP = pa_equalizer(LP);
Then apply a ramp:
Noise = pa_ramp(Noise); HP = pa_ramp(HP); LP = pa_ramp(LP);
In the FART1-setup, speakers will have on onset ramp produced by the TDT-system to ramp to a voltage on the speakers. You will have to take this into account, by putting zeros in front of the stimuli (of about 20 ms worth 20*48.8828125 978 samples):
Noise = pa_levelramp(Noise); %This "prepends" the zerovector to the Noise HP = pa_levelramp(HP); LP = pa_levelramp(LP);
writewav(Noise,"snd001.wav); writewav(HP,"snd002.wav"); writewav(LP,"snd003.wav");