Commit 77688e90 authored by Joanna Luberadzka's avatar Joanna Luberadzka

resampling hrirs insead of upsampling signals, distance of hrirs changed to 3 m

parent 6383bb57
...@@ -64,7 +64,7 @@ def.savefcn = 'default'; % function which writes results to disk ...@@ -64,7 +64,7 @@ def.savefcn = 'default'; % function which writes results to disk
% samplerate and sound output % samplerate and sound output
def.samplerate = 48000; % sampling rate in Hz def.samplerate = 48000; % sampling rate in Hz
def.intervallen = 22050; % length of each signal-presentation interval in samples (might be overloaded in 'expname_set') def.intervallen = 53234; % length of each signal-presentation interval in samples (might be overloaded in 'expname_set')
def.pauselen = 22050; % length of pauses between signal-presentation intervals in samples (might be overloaded in 'expname_set') def.pauselen = 22050; % length of pauses between signal-presentation intervals in samples (might be overloaded in 'expname_set')
def.presiglen = 100; % length of signal leading the first presentation interval in samples (might be overloaded in 'expname_set') def.presiglen = 100; % length of signal leading the first presentation interval in samples (might be overloaded in 'expname_set')
def.postsiglen = 100; % length of signal following the last presentation interval in samples (might be overloaded in 'expname_set') def.postsiglen = 100; % length of signal following the last presentation interval in samples (might be overloaded in 'expname_set')
......
...@@ -80,10 +80,10 @@ if iscell(def.exppar1);def.exppar1=cell2mat(def.exppar1);end ...@@ -80,10 +80,10 @@ if iscell(def.exppar1);def.exppar1=cell2mat(def.exppar1);end
setup.HRIRs=cell(length(def.exppar1),1); % [0 45 90]; setup.HRIRs=cell(length(def.exppar1),1); % [0 45 90];
for k=1:length(setup.HRIRs) for k=1:length(setup.HRIRs)
%load the hrir for the reference angle %load the hrir for the reference angle
setup.HRIRs{k}.hrir_ref=loadHRIR('Anechoic', 80, 0, def.exppar1(k),'in-ear') setup.HRIRs{k}.hrir_ref=loadHRIR('Anechoic', 300, 0, def.exppar1(k),'in-ear')
%load the hrirs for the angle 5° away from the reference angle %load the hrirs for the angle 5° away from the reference angle
setup.HRIRs{k}.hrir_refplus=loadHRIR('Anechoic', 80, 0, def.exppar1(k)+setup.degdiff,'in-ear') setup.HRIRs{k}.hrir_refplus=loadHRIR('Anechoic', 300, 0, def.exppar1(k)+setup.degdiff,'in-ear')
setup.HRIRs{k}.hrir_refminus=loadHRIR('Anechoic', 80, 0, def.exppar1(k)-setup.degdiff,'in-ear') setup.HRIRs{k}.hrir_refminus=loadHRIR('Anechoic', 300, 0, def.exppar1(k)-setup.degdiff,'in-ear')
end end
% eof % eof
\ No newline at end of file
...@@ -52,9 +52,16 @@ fileToPlay = randi(numberOfFiles, 1); ...@@ -52,9 +52,16 @@ fileToPlay = randi(numberOfFiles, 1);
baseWavFileName = setup.waveFiles(fileToPlay).name; baseWavFileName = setup.waveFiles(fileToPlay).name;
fullWavFileName = fullfile([setup.filedir, baseWavFileName]); fullWavFileName = fullfile([setup.filedir, baseWavFileName]);
[sig, fssig]=audioread(fullWavFileName); [sig, fssig]=audioread(fullWavFileName);
% resample the signal % resample the signal
[P,Q] = rat(def.samplerate/fssig); % [P,Q] = rat(def.samplerate/fssig);
sig=resample(sig,P,Q); % sig=resample(sig,P,Q);
% resample the impulse response
[P,Q] = rat(fssig/def.samplerate);
hrir_ref=resample(hrir_ref,P,Q);
hrir_targ=resample(hrir_targ,P,Q);
% convolve signals with IRs % convolve signals with IRs
sig_ref(:,1)=conv(sig,hrir_ref(:,1)); sig_ref(:,1)=conv(sig,hrir_ref(:,1));
sig_ref(:,2)=conv(sig,hrir_ref(:,2)); sig_ref(:,2)=conv(sig,hrir_ref(:,2));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment