diff examples/sound/sampled/modulate.scm @ 0:bf79fb79ee13

Initial Mercurial check in.
author samer
date Tue, 17 Jan 2012 17:50:20 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/sound/sampled/modulate.scm	Tue Jan 17 17:50:20 2012 +0000
@@ -0,0 +1,25 @@
+;;; Modulate noise or sine wave with short-term energy of input audio signal
+
+(load "audio.scm")
+(load "lineout.scm")
+(load "synthesis.scm")
+
+
+(put "regulated" #f)	; main loop will not be regulated, run as fast as possible.
+
+(tasks)	; creates regulator and main loop Task
+
+(define N 256) ; frame size for audio input, output, and hop size
+(lineout (default-linesnk) 
+	(gen->vector N (Product.	; generate N sample vector as product of two 
+;		(NormalisedGaussian.)	; signal generators:
+		(oscillator 0.5)			; a sinusoidal oscillator at 0.5 radians/sample
+		(FunctionOfGenerator. (Sqrt.)	; and the square root of
+			(filter-gen 					; a filtered signal
+				(fir-filter (VVector. "coeffs" 32))	; filter is fir with 32 taps
+				(filter-gen (EnergyOperator.) 		; signal is energy
+					(Wavetable. (linein (default-linesrc) N N)))))))) ; of audio in
+
+(expose)	; shows GUI
+(set "editor.plotter.type" 4)	; vector editors like bar chart rather than line
+(exec (viewable "coeffs") "plotter editor")