#!/bin/env python2.4 # @(#)newrec.py # Time-stamp: <2005-08-28 10:35:09 flp> # (Re)create newrec.ck on the fly for ChucK Dracula release # which does not include rec2.ck due to lack of time/date function. # Copyright 2005 Furlan Primus # Initial Date:2005-08-28 # -*- Mode: Python -*- from time import gmtime, strftime filename = ''.join((strftime("chuck-session(%a %b %d %Hh%Mm%S %Y)"), ".wav")) ChucKfile = "newrec.ck" s1 = """ // Time-stamp: <> // chuck this with other shreds to record to file // example> chuck foo.ck bar.ck newrec.ck // pull samples from the dac dac => gain g => WvOut w => blackhole; // this is the output file name """ newfile = ''.join(("\"", filename, "\"", " => w.wavFilename;")) s2 = """ <<<"writing to file: ", w.filename()>>>; // any gain you want for the output .5 => g.gain; // infinite time loop... // ctrl-c will stop it, or modify to desired duration while( true ) 1::second => now; """ f = file(ChucKfile,'w') f.write(s1) f.write(newfile) f.write(s2)