function [InFileMat] = Ton12write


%	Ton12write.m

%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.  



NewPath=('HD4:IAPS.II:IAPSTon:Ton');

%*********************************************	
LR=zeros(14700,2);

for i=1:50
	LR(i,1)=.999;
end

for i=1:50
	LR(i,2)=.999;
end
%*********************************************	
%*********************************************	
L=zeros(14700,2);

for i=1:50
	L(i,1)=.999;
end
%*********************************************	
%*********************************************	
R=zeros(14700,2);

for i=1:50
	R(i,2)=.999;
end
%*********************************************	
				Toncount=0
				for ReadNo = 1:386
						Toncount=Toncount+1;
						No=num2str(Toncount)
						if Toncount <= 9
							NewFile=strcat(NewPath,'00',No,'.wav');	
						elseif Toncount >=  9 & Toncount <=  99
							NewFile=strcat(NewPath,'0',No,'.wav');	
						elseif Toncount >=  100 
							NewFile=strcat(NewPath,No,'.wav');
						end
						writesnd(R,44100,16,NewFile);

						Toncount=Toncount+1;
						No=num2str(Toncount)
						if Toncount <= 9
							NewFile=strcat(NewPath,'00',No,'.wav');	
						elseif Toncount >=  9 & Toncount <=  99
							NewFile=strcat(NewPath,'0',No,'.wav');	
						elseif Toncount >=  100 
							NewFile=strcat(NewPath,No,'.wav');
						end
						writesnd(L,44100,16,NewFile);
				end
return;
