Write the sound in a variable on the server This function send the wav file to a variable on the URBI server
0001 function urbiSendWav(con, wavFile, variableName) 0002 % Write the sound in a variable on the server 0003 % This function send the wav file to a variable on the URBI server 0004 0005 if (nargin ~=3) 0006 error ('Wrong number of arguments'); 0007 end 0008 0009 fid = fopen(wavFile,'r'); 0010 if fid==-1 0011 error (sprintf('Unable to open %s', wavFile)); 0012 end; 0013 0014 bin_datas = fread(fid); 0015 bin_datas = char(bin_datas'); 0016 fclose(fid); 0017 urbiSend(con, sprintf ('%s = BIN %d wav;', variableName, size(bin_datas, 2))); 0018 pnet(con, 'write', bin_datas, 'char');