| Hmm, thanks James, restructured completely. I'm using a backup buffer. Seems to work, sometimes the reset seems not to operate, works better with shorter buffers Best -a- EventRecPlayer { var <>ana ; var <>on, <>off ; var <>sy ; var <>rec ; var <>buf, <>buf2 ; var <>num ; var <>bus ; *new { arg ana ; ^super.new.initERP(ana) } initERP { arg anAna; ana = anAna ; bus = Bus.audio(Server.local, 1) ; buf = Buffer.alloc(Server.local, Server.local.sampleRate * 1.0) ; // alloc the bus buf2 = Buffer.alloc(Server.local, Server.local.sampleRate * 1.0) ; // alloc the bus num = 0 ; // this will record to the buf rec = SynthDef(\recout, { arg bufnum, bus, offset = 0; RecordBuf.ar(SoundIn.ar(0), bufnum, offset) }) .play(Server.local, [\bufnum, buf.bufnum, \bus, buf], \addToTail); // a lock on = false ; {PlayBuf.ar(1, buf, loop:-1)}.play } update { arg theChanged, theChanger, more ; case { more[0] == \onset } { if (on == false){ num.postln ; buf.zero ; // from the beginning rec.set(\offset, 0) ; // go rec.run ; // update lock on = true ; "start".postln;} } { more[0] == \silence && on == true } { "pause".postln ; // pause rec.run(false) ; // rec to a progressive filename buf.copyData(buf2) ; buf2.write ("/test/"++num.asString++".aiff".standardizePath, "aiff", "int16") ; on = false ; num = num+1 ; } } } On Jul 21, 2009, at 2:40 PM, James Harkins wrote:
-------------------------------------------------- Andrea Valle -------------------------------------------------- CIRMA - DAMS Università degli Studi di Torino -------------------------------------------------- " This is a very complicated case, Maude. You know, a lotta ins, a lotta outs, a lotta what-have-yous." (Jeffrey 'The Dude' Lebowski) |