[linux-audio-user] VAR/VOR audio recording

Frank Barknecht fbar at footils.org
Tue Aug 2 19:28:45 EDT 2005


Hallo,
lucas hat gesagt: // lucas wrote:

> i would like a linux daemon that is always running and always listening 
> to the microphone input of the soundcard and create a new file and 
> record into that audio file when there is sound coming through the 
> input.  and say after a certain number of minutes of silence or so, it 
> will end the recording and keep listening.  then when sound comes across 
> again, it will begin recording in a new file.

Attached Pd patch does this with recording to ogg. You need the
oggwrite~ external for this or change the patch to record to .wav
files as hinted inside the patch. Of course you need Pd (Pure Data)
installed but it's part of every decent distribution. 

The idea is as follows: The level of the audio input (adc~) is watched
all the time using an envelope follower (env~). This normally goes
from about 0 to 100. As soon as it goes over a trigger level of 50, a
new ogg file is opened having a name like 1217-everything.ogg, where
1217 is the time in seconds passed since you opened the patch. As soon
as the level goes below 50 recording is stopped and a new file is
opened. 

The patch is just an example to maybe get you started, it could be
improved in various ways, for example by using a delay buffer like in
Steve's timemachine to also record the past, or by using a better
trigger detection.

Ciao
-- 
 Frank Barknecht                               _ ______footils.org__
             
          _ __latest track: "plak" @ http://footils.org/cms/show/44
-------------- next part --------------
#N canvas 316 203 760 545 10;
#X obj 270 128 timer;
#X obj 299 87 t b b;
#X msg 260 86 bang;
#X floatatom 315 219 10 0 0 0 - - -;
#X msg 270 246 open \$1-everything.ogg;
#X obj 270 165 / 1000;
#X obj 270 195 int;
#X msg 300 273 stop;
#X obj 270 221 t f b;
#X obj 45 37 adc~;
#X obj 70 168 env~;
#N canvas 0 0 450 300 graph1 0;
#X array scope 100 float 3;
#A 0 0.176773 0.15142 0.159738 0.182642 0.148965 0.171874 0.153733
0.155015 0.179024 0.149643 0.164235 0.159848 0.152635 0.17603 0.150171
0.161542 0.164668 0.150264 0.170672 0.153374 0.157136 0.178124 0.149249
0.168872 0.159272 0.154433 0.17644 0.150154 0.163182 0.164699 0.149047
0.174173 0.153846 0.158485 0.178723 0.148336 0.169403 0.152214 0.177214
0.148651 0.163269 0.184314 0.151343 0.175816 0.154697 0.16134 0.181295
0.147578 0.170882 0.156274 0.15285 0.177947 0.147476 0.165839 0.160594
0.150425 0.175332 0.150738 0.160138 0.17901 0.150221 0.171267 0.154037
0.156932 0.18006 0.150187 0.169343 0.157459 0.151823 0.174426 0.151276
0.16221 0.18187 0.149791 0.172427 0.153739 0.159636 0.1766 0.148806
0.168168 0.156033 0.155131 0.178937 0.149719 0.164973 0.162789 0.148181
0.176203 0.153229 0.159834 0.181892 0.14798 0.169776 0.1572 0.153626
0.176154 0.148818 0.163075 0.160147 0.150606;
#X coords 0 1 99 -1 200 140 1;
#X restore 522 93 graph;
#X obj 163 160 tgl 24 1 empty empty ON/OFF 0 -6 0 12 -258699 -1 -1
1 1;
#X obj 270 297 t a;
#X obj 270 373 oggwrite~;
#X obj 272 417 writesf~;
#N canvas 0 0 450 300 input-level 0;
#X obj 67 223 tabwrite scope;
#X obj 130 92 metro 100;
#X obj 160 196 f;
#X obj 196 196 + 1;
#X obj 228 196 mod 100;
#X obj 130 115 t b b;
#X obj 67 173 f;
#X obj 67 198 / 100;
#X obj 83 102 inlet;
#X obj 130 67 inlet;
#X obj 14 198 outlet;
#X connect 1 0 5 0;
#X connect 2 0 3 0;
#X connect 2 0 0 1;
#X connect 3 0 4 0;
#X connect 4 0 2 1;
#X connect 5 0 6 0;
#X connect 5 1 2 0;
#X connect 6 0 7 0;
#X connect 6 0 10 0;
#X connect 7 0 0 0;
#X connect 8 0 6 1;
#X connect 9 0 1 0;
#X restore 70 193 pd input-level;
#X obj 70 248 > 50;
#X obj 299 327 catch~ left;
#X obj 328 349 catch~ right;
#X obj 45 120 throw~ left;
#X obj 82 95 throw~ right;
#X obj 100 301 select 0 1;
#X msg 100 348 stop;
#X msg 166 346 start;
#X text 340 416 Try this for wave-recording \, but first check help-file
(Right-click -> Help);
#X obj 166 325 t b b;
#X obj 70 271 change;
#X obj 65 432 loadbang;
#X msg 65 457 \; pd dsp 1;
#X msg 299 59 reset;
#X obj 96 228 hsl 128 15 0 127 0 0 empty empty trigger_level -2 -6
0 8 -258699 -1 -1 2700 1;
#X floatatom 107 247 5 0 0 0 - - -;
#X connect 0 0 5 0;
#X connect 1 0 0 0;
#X connect 1 1 0 1;
#X connect 2 0 0 1;
#X connect 4 0 13 0;
#X connect 5 0 6 0;
#X connect 6 0 8 0;
#X connect 6 0 3 0;
#X connect 7 0 13 0;
#X connect 8 0 4 0;
#X connect 8 1 7 0;
#X connect 9 0 10 0;
#X connect 9 0 20 0;
#X connect 9 1 10 0;
#X connect 9 1 21 0;
#X connect 10 0 16 0;
#X connect 12 0 16 1;
#X connect 13 0 14 0;
#X connect 16 0 17 0;
#X connect 17 0 27 0;
#X connect 18 0 14 0;
#X connect 19 0 14 1;
#X connect 22 0 23 0;
#X connect 22 1 26 0;
#X connect 23 0 14 0;
#X connect 24 0 14 0;
#X connect 26 0 24 0;
#X connect 26 1 2 0;
#X connect 27 0 22 0;
#X connect 28 0 29 0;
#X connect 30 0 1 0;
#X connect 31 0 17 1;
#X connect 31 0 32 0;


More information about the Linux-audio-user mailing list