function attacked_sig = aerial_attack(stego_sig);

%  attacked_sig = aerial_attack(stego_sig);
%  
%  Simulation of aerial sound propagation.
%    requires `imp_spk_room_mic.txt' impulse response file.
%             hoth.m : generates an extended Hoth noise

if exist('OCTAVE_VERSION')
  matlab = 0;
  wfile = [tempname, 'w.wav'];
  rfile = [tempname, 'r.wav'];
else
  matlab = 1;
end

impfile = 'imp_spk_room_mic.txt';

[len, ch] = size(stego_sig);

if ch > 1
  error('Aerial attack requires a monoral signal');
end

fid = fopen(impfile, 'r');
imp = fscanf(fid, '%f');
fclose(fid);

sf = 44100;
rsig = conv(stego_sig, imp);

maxamp = max(abs(rsig))
rsig = rsig/maxamp*0.9;

hsig = hoth(sf, length(rsig));
nlev = 10*log10(mean(hsig.^2));
rlev = 10*log10(mean(rsig.^2));

sig = rsig + hsig*10^((rlev-nlev-36)/20);

if matlab
  attacked_sig = resample(sig, sf, round(sf*0.999), 128);
else
  wavwrite(sig, sf, rfile);
  system(sprintf('ResampAudio -s %d %s %s >& /dev/null', round(sf/0.999), rfile, wfile));
  attacked_sig = wavread(wfile);
  system(['rm ', wfile, ' ', rfile]);
end




