我正在尝试在Matlab中合成一个长期增强(LTP)代码,我可以将其转换为声音文件。我已经能够合成代码,但是我需要帮助来解析代码,然后将其转换为声音文件。
这是我当前的脚本:
fs_Hz = 48000; % sampling rate
ntrains = 3; % number of trains
npulses = 20; % number of pulses
pulsefreq_Hz = 100;
iti_s = 1.5; % inter-interval train
amp_V = 10; % Amplitude in volts
pulsedur_s = 100e-6; % pulse duration in seconds.
dur_s = iti_s * ntrains;
nsamps = ceil(dur_s * fs_Hz);
tt = [1:nsamps] / fs_Hz;
yy = zeros(nsamps, 1);
for tr = 1:ntrains
t0 = (tr - 1) + iti_s/2;
for pu = 1:npulses
t1 = t0 + (pu-1)/pulsefreq_Hz;
istart = round(t1 * fs_Hz);
iend = istart + round(pulsedur_s * fs_Hz);
yy(istart:iend) = amp_V;
end
end