diff dsp/synth/poly2snd.m @ 34:c75bb62b90a9

Imported audio synthesis tools.
author samer
date Sun, 20 Jan 2013 19:05:05 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/synth/poly2snd.m	Sun Jan 20 19:05:05 2013 +0000
@@ -0,0 +1,18 @@
+function X=poly2snd(A,u)
+% POLY2SND  - Convert array of filter polynomial coeffs to one long sound by filtering noise
+% Filter state is preserved as the function processes a number of filters
+%
+% poly2snd :: 
+% 	(A:array 1..N of Poly, signal~'noise to filter')
+%	->signal~'N concatentated sounds'
+%
+% Each ROW of A contains coefficients for one filter
+
+Z=[];
+for k=1:size(A,1)
+	[x,Z]=filter(1,A(k,:),u,Z);
+	if any(isnan(Z)), Z=[]; end;
+	X(:,k)=0.999*x/max(abs(x));
+end
+
+