Add morph.lib to architecture and four morpho examples.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / capture.dsp
1 declare name "capture";
2 declare version "1.0";
3 declare author "Grame";
4 declare license "BSD";
5 declare copyright "(c)GRAME 2006";
6
7 //-------------------------------------------------
8 // Capture : record up to 8s of sound and
9 // playback the recorded sound in loop
10 //-------------------------------------------------
11
12 import("music.lib");
13
14 B = button("Capture"); // Capture sound while pressed
15 I = int(B); // convert button signal from float to integer
16 R = (I-I') <= 0; // Reset capture when button is pressed
17 D = (+(I):*(R))~_; // Compute capture duration while button is pressed: 0..NNNN0..MMM
18
19
20 capture = *(B) : (+ : delay(8*65536, D-1)) ~ *(1.0-B) ;
21
22
23 smooth(c) = *(1-c) : +~*(c);
24 level = hslider("level (db)", 0, -96, 4, 0.1) : db2linear : smooth(0.999);
25
26 process = vgroup( "Audio Capture", capture : *(level) ) ;
27