annotate examples/sound/sampled/modulate.scm @ 0:bf79fb79ee13
Initial Mercurial check in.
author |
samer |
date |
Tue, 17 Jan 2012 17:50:20 +0000 |
parents |
|
children |
|
rev |
line source |
samer@0
|
1 ;;; Modulate noise or sine wave with short-term energy of input audio signal
|
samer@0
|
2
|
samer@0
|
3 (load "audio.scm")
|
samer@0
|
4 (load "lineout.scm")
|
samer@0
|
5 (load "synthesis.scm")
|
samer@0
|
6
|
samer@0
|
7
|
samer@0
|
8 (put "regulated" #f) ; main loop will not be regulated, run as fast as possible.
|
samer@0
|
9
|
samer@0
|
10 (tasks) ; creates regulator and main loop Task
|
samer@0
|
11
|
samer@0
|
12 (define N 256) ; frame size for audio input, output, and hop size
|
samer@0
|
13 (lineout (default-linesnk)
|
samer@0
|
14 (gen->vector N (Product. ; generate N sample vector as product of two
|
samer@0
|
15 ; (NormalisedGaussian.) ; signal generators:
|
samer@0
|
16 (oscillator 0.5) ; a sinusoidal oscillator at 0.5 radians/sample
|
samer@0
|
17 (FunctionOfGenerator. (Sqrt.) ; and the square root of
|
samer@0
|
18 (filter-gen ; a filtered signal
|
samer@0
|
19 (fir-filter (VVector. "coeffs" 32)) ; filter is fir with 32 taps
|
samer@0
|
20 (filter-gen (EnergyOperator.) ; signal is energy
|
samer@0
|
21 (Wavetable. (linein (default-linesrc) N N)))))))) ; of audio in
|
samer@0
|
22
|
samer@0
|
23 (expose) ; shows GUI
|
samer@0
|
24 (set "editor.plotter.type" 4) ; vector editors like bar chart rather than line
|
samer@0
|
25 (exec (viewable "coeffs") "plotter editor")
|