Recording input without hear it

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Recording input without hear it

BROKEN CODE
Hi all,
I'm trying to record to HDD the first input and I found myself in trouble
when I tried to transform this:

(
{
        var fade = 1; // record fade in & fade out duration

// allocate a Buffer

~bufferTemp = Buffer.alloc(
        Server.default,
        ~sampleRate * ~recduration, // allocate size
        1);   // single channel

        e = EnvGen.ar(Env([0.0,1.0,1.0,0.0],[fade,~recduration-(fade*2),fade])); //
fade in - fade out

        ~recordingTemp = RecordBuf.ar(SoundIn.ar(0)*e, // first input channel *
envelope
                ~bufferTemp,       // store recording in buffer
                loop: 0,       // do not loop
                doneAction: 2   // free synth when done.
        );
        0.0;
}.play;
)

to a SynthDef with a Routine to start rec, sart Synth, stop rec:

(
// Record audio from the first input channel
SynthDef(\record,{
        var fade = 1; // record fade in & fade out duration

// allocate a Buffer

~bufferTemp = Buffer.alloc(
        Server.default,
        ~sampleRate * ~recduration, // allocate size
        1); // single channel

        e = EnvGen.ar(Env([0.0,1.0,1.0,0.0],[fade,~recduration-(fade*2),fade])); //
fade in - fade out record
        ~recordingTemp = RecordBuf.ar(SoundIn.ar(0)*e, // first input
channel * envelope
                ~bufferTemp,       // store recording in buffer
                loop: 0,       // do not loop
                doneAction: 2   // free synth when done.
        );
        0.0;
        Out.ar(0,SoundIn.ar(0)*e);
}).add;
)

(Routine{var name = "Recordings/out"++~recNum++".wav",cartella, wav;
       
       
        s.record(path: name.resolveRelative); // Start rec
        Synth(\record);
        ~recduration.wait; // Rec duration
        s.stopRecording; // Stop rec
}.play
)

The thing is that this will record the SC *output* and not the input.. I
found only ex with the first case, when the function is evaluated directly,
but what if I want to use a SynthDef?
Thank you in advance and sorry if this question was already asked



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

Josh Parmenter
I think you can just remove the Out.ar line.

Give that a shot and see if it does what you want.

Hope that helps.

Josh


On Jan 3, 2018, at 10:07 AM, [hidden email] wrote:

Hi all,
I'm trying to record to HDD the first input and I found myself in trouble
when I tried to transform this:

(
{
var fade = 1; // record fade in & fade out duration

// allocate a Buffer

~bufferTemp = Buffer.alloc(
Server.default,
~sampleRate * ~recduration, // allocate size
1);   // single channel

e = EnvGen.ar(Env([0.0,1.0,1.0,0.0],[fade,~recduration-(fade*2),fade])); //
fade in - fade out

~recordingTemp = RecordBuf.ar(SoundIn.ar(0)*e, // first input channel *
envelope
~bufferTemp,       // store recording in buffer
loop: 0,        // do not loop
doneAction: 2   // free synth when done.
);
0.0;
}.play;
)

to a SynthDef with a Routine to start rec, sart Synth, stop rec:

(
// Record audio from the first input channel
SynthDef(\record,{
var fade = 1; // record fade in & fade out duration

// allocate a Buffer

~bufferTemp = Buffer.alloc(
Server.default,
~sampleRate * ~recduration, // allocate size
1); // single channel

e = EnvGen.ar(Env([0.0,1.0,1.0,0.0],[fade,~recduration-(fade*2),fade])); //
fade in - fade out record
~recordingTemp = RecordBuf.ar(SoundIn.ar(0)*e, // first input
channel * envelope
~bufferTemp,       // store recording in buffer
loop: 0,        // do not loop
doneAction: 2   // free synth when done.
);
0.0;
Out.ar(0,SoundIn.ar(0)*e);
}).add;
)

(Routine{var name = "Recordings/out"++~recNum++".wav",cartella, wav;


s.record(path: name.resolveRelative); // Start rec
Synth(\record);
~recduration.wait; // Rec duration
s.stopRecording; // Stop rec
}.play
)

The thing is that this will record the SC *output* and not the input.. I
found only ex with the first case, when the function is evaluated directly,
but what if I want to use a SynthDef?
Thank you in advance and sorry if this question was already asked



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

BROKEN CODE
Thank you Josh Parmenter!
I forgot to remove it before posting..
what happens is that with Out.ar I can record to HDD, but I hear the sound
as well.
If I remove it (as I was supposed to do) nothing will be heard, but nothing
will be write on HDD



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

Josh Parmenter
Ah - I think I see the disconnect.

What you want to record is the output of SoundIn, and you set up the RecordBuf to do that. However, you never write the buffer out that RecordBuf writes to - you are using Server:record for that, which records only the audio output of the scsynth process.

When your synth stops, and before you free the buffer, you want to call .write on ~bufferTemp. See the Buffer helpfile for those parameters, and then you can remove the s.record / s.stopRecording calls, replacing them with the writes. Also - make sure you free your buffers!

Hope that helps.
Josh

> On Jan 4, 2018, at 2:21 AM, [hidden email] wrote:
>
> Thank you Josh Parmenter!
> I forgot to remove it before posting..
> what happens is that with Out.ar I can record to HDD, but I hear the sound
> as well.
> If I remove it (as I was supposed to do) nothing will be heard, but nothing
> will be write on HDD
>
>
>
> --
> Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

Josh Parmenter
In reply to this post by BROKEN CODE
Also - don’t allocate the buffer inside the SynthDef - allocate the buffer, then after it is allocated start an instance of your recording SynthDef and pass in the buffer numbers as an argument.

Best,
Josh

> On Jan 4, 2018, at 2:21 AM, [hidden email] wrote:
>
> Thank you Josh Parmenter!
> I forgot to remove it before posting..
> what happens is that with Out.ar I can record to HDD, but I hear the sound
> as well.
> If I remove it (as I was supposed to do) nothing will be heard, but nothing
> will be write on HDD
>
>
>
> --
> Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

BROKEN CODE
Yes! .write solved the case! Questions:

- is it in real-time? I have a 30 sec Buffer, write it to disk with .write
takes 30 sec?
- if it's not real time, is it possible to know when .write is finished?

Thank you again



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

BROKEN CODE
In reply to this post by Josh Parmenter
Oh.. and I have to allocate buffer inside a synthdef because is called later
with a Routine. I have to store as many Buffer as I want, so when I start
the patch I have to instantiate the synthdef and then move to other part :)



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Recording input without hear it

ddw_music
BROKEN CODE wrote
> Oh.. and I have to allocate buffer inside a synthdef because is called
> later
> with a Routine. I have to store as many Buffer as I want, so when I start
> the patch I have to instantiate the synthdef and then move to other part
> :)

SynthDefs may never allocate new Buffers, ever. It simply doesn't work that
way. A buffer gets allocated in the server when the language sends a message
to it, asking for the allocation. Only a client app can send the message.
Synths cannot send this message. The way you wrote it at first is
impossible.

You will have to write your Routine to allocate the buffer (in language
code), "s.sync;" and then run the synth.

hjh



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/