1 declare name "capture";
3 declare author "Grame";
5 declare copyright "(c)GRAME 2006";
7 //-------------------------------------------------
8 // Capture : record up to 8s of sound and
9 // playback the recorded sound in loop
10 //-------------------------------------------------
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
20 capture = *(B) : (+ : delay(8*65536, D-1)) ~ *(1.0-B) ;
23 smooth(c) = *(1-c) : +~*(c);
24 level = hslider("level (db)", 0, -96, 4, 0.1) : db2linear : smooth(0.999);
26 process = vgroup( "Audio Capture", capture : *(level) ) ;