tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function fr=getsingleaif(varargin) tomwalters@0: % usage: fr=getsingleaif(varargin) tomwalters@0: % produces only one frame from the (static) sound "soundfile" tomwalters@0: % This frame is taken as with the makeaimmovie with the framesperseconds-parameter tomwalters@0: % set to longer than the stimulus. Therefore the frame at the end of the signal duration is taken tomwalters@0: tomwalters@0: temp_sound_file_name='temp.wav'; tomwalters@0: tomwalters@0: if nargin<2 % only one parameter -> read file tomwalters@0: if size(varargin)==1 tomwalters@0: makefilename=varargin{1}; tomwalters@0: else tomwalters@0: makefilename='lastrun.genmovie'; tomwalters@0: end tomwalters@0: % fprintf('movie is produced from file %s from aifffile "makemovie_temp.aif"\n!',makefilename); tomwalters@0: fprintf('aiff-file is produced according to file ''%s''\n',makefilename); tomwalters@0: else tomwalters@0: makefilename='lastrun.genmovie'; tomwalters@0: generateparameterfile(makefilename,varargin); tomwalters@0: end tomwalters@0: tomwalters@0: arguments=readparameterfile(makefilename); tomwalters@0: tomwalters@0: str_model=getargument(arguments,'modelfile'); tomwalters@0: str_soundcommand=getargument(arguments,'soundfile'); tomwalters@0: str_movie_duration=getargument(arguments,'movie_duration'); tomwalters@0: str_movie_start_time=getargument(arguments,'movie_start_time'); tomwalters@0: str_output_normalization=getargument(arguments,'output_normalization'); tomwalters@0: str_sound_sample_rate=getargument(arguments,'sound_sample_rate'); tomwalters@0: str_sound_endian=getargument(arguments,'sound_endian'); tomwalters@0: str_echo=getargument(arguments,'echo'); tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: % read the sound command and transfere the data to the buffer tomwalters@0: if ~isempty(str_movie_duration) % default frames per second tomwalters@0: eval(sprintf('movie_duration=%s;',str_movie_duration)); tomwalters@0: eval(sprintf('movie_start_time=%s;',str_movie_start_time)); tomwalters@0: [sounddata,samplerate,bits,endian]=producesounddata(str_soundcommand,temp_sound_file_name,str_sound_sample_rate,str_sound_endian,movie_start_time,movie_duration); tomwalters@0: else tomwalters@0: movie_start_time=0; tomwalters@0: [sounddata,samplerate,bits,endian]=producesounddata(str_soundcommand,temp_sound_file_name,str_sound_sample_rate,str_sound_endian); tomwalters@0: movie_duration=length(sounddata)/samplerate; tomwalters@0: end tomwalters@0: tomwalters@0: videolength=size(sounddata,1)/samplerate; tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tomwalters@0: % frames per second tomwalters@0: framespersecond=1/videolength; % tomwalters@0: framespersecond=framespersecond*1.001; tomwalters@0: tomwalters@0: aiffs=getaiffs('modelfile',str_model,... tomwalters@0: 'soundfile',str_soundcommand,... tomwalters@0: 'framespersecond',sprintf('%f',framespersecond),... tomwalters@0: 'output_normalization',str_output_normalization,... tomwalters@0: 'movie_duration',movie_duration,... tomwalters@0: 'movie_start_time',movie_start_time,... tomwalters@0: 'echo',str_echo); tomwalters@0: % aiffs=getaiffs('modelfile',str_model,... tomwalters@0: % 'soundfile',temp_sound_file_name,... tomwalters@0: % 'framespersecond',sprintf('%f',framespersecond),... tomwalters@0: % 'output_normalization',str_output_normalization,... tomwalters@0: % 'movie_duration',movie_duration,... tomwalters@0: % 'movie_start_time',movie_start_time,... tomwalters@0: % 'echo',str_echo); tomwalters@0: tomwalters@0: fr=aiffs(1); % this is the one and only tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: