changeset 10:dbefe500e5f4

Make the output filename a parameter
author Chris Cannam
date Fri, 28 Feb 2014 11:14:01 +0000
parents aeb703465220
children 894f57cf9962
files simulateBinauralSignals.m
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/simulateBinauralSignals.m	Mon Nov 25 17:29:43 2013 +0000
+++ b/simulateBinauralSignals.m	Fri Feb 28 11:14:01 2014 +0000
@@ -1,8 +1,6 @@
 function simulateBinauralSignals(inputstruct)
 %Creates .wav file of 2sec long binaural signals for specific board dimensions and gaussian white noise stimulus
 %
-% The .wav is created in the current directory with filename is 'binsimecho.wav'
-%
 % INPUTS:
 % The input must be a structure with fields:
 % .dist (1st input argument) is the distance in meters
@@ -10,10 +8,13 @@
 % are right)
 % .orient (3rd input argument) must be either 'horz' or 'angled' corresponding to flat and angled descriptions in
 % Papadopoulos et al. BSPC 2011.
-% .dirweight (4tht input argument) must be a nonnegative real scalar determining what is the relative weight of the
+% .dirweight (4th input argument) must be a nonnegative real scalar determining what is the relative weight of the
 % emission path to the echo path (i.e. due to directivity focus in the frontal direction of the source, the emission
 % which is directed upwards and backwards in our specific geometry is significantly attenuated, typically by factor in
 % the vicinity of 0.2)
+% .outfile (5th input argument) must be the filename in which the wave file
+% is to be written. It may be an absolute path, or relative to the current
+% directory.
 % 
 
 %% Internal workings description
@@ -109,12 +110,14 @@
 azim = inputstruct.azim;
 orient = inputstruct.orient;
 dirweight = inputstruct.dirweight;
+outfile = inputstruct.outfile;
 
 %% Validate attributes
 validateattributes(dist,{'double'},{'scalar','>',0})
 validateattributes(azim,{'double'},{'scalar','<=',90,'>=',-90})
 validateattributes(orient,{'char'},{'nonempty'})
 validateattributes(dirweight,{'double'},{'scalar','>',0})
+validateattributes(outfile,{'char'},{'nonempty'})
 
 %% Computation parameters (Some fixed, some taken from input arguments)
 params.board_size_x = .55;
@@ -148,7 +151,7 @@
 params.dirweight = dirweight;
 
 params.horz_disamb = 'BSPC2011';
-params.wavfilename = 'binsimecho.wav';
+params.wavfilename = outfile;
 
 %% Compute free field (no head) IRs