Weird behavior with Instr

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

Weird behavior with Instr

Henricus J. Holtman
I am using 3.9dev. I have crucial-library and cxaudio loaded. I observe
this weird behavior with Instr:

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
     {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

c = Instr("cymbals.tonal").play; // this plays: continuous beats
// control-.
d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // plays a semirandom series of 'cymbal' hits
     d.name,
     \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
     \trig, 1,
     \freqScale, Pwhite(0.1, 4.0),
     \freqOffset, Pwhite(-4000, 300),
).play;

// however...

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
     {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // NO AUDIO!
     d.name,
     \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
     \trig, 1,
     \freqScale, Pwhite(0.1, 4.0),
     \freqOffset, Pwhite(-4000, 300),
).play;

What's the hang here?

           Thank You for Your Attention

--
Time is an imaginary number. Entropy always wins.


_______________________________________________
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: Weird behavior with Instr

crucialfelix

Actually I fixed Instr.loadAll the other day, so update crucial-library

I'm not sure but I think what you want is:

def = Instr("cymbals.tonal").asSynthDef;

PmonoArtic(
...

The synth def name is not the same as the instr name.



On Sat, Jan 6, 2018 at 7:42 AM, <[hidden email]> wrote:
I am using 3.9dev. I have crucial-library and cxaudio loaded. I observe
this weird behavior with Instr:

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
    {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

c = Instr("cymbals.tonal").play; // this plays: continuous beats
// control-.
d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // plays a semirandom series of 'cymbal' hits
    d.name,
    \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
    \trig, 1,
    \freqScale, Pwhite(0.1, 4.0),
    \freqOffset, Pwhite(-4000, 300),
).play;

// however...

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
    {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // NO AUDIO!
    d.name,
    \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
    \trig, 1,
    \freqScale, Pwhite(0.1, 4.0),
    \freqOffset, Pwhite(-4000, 300),
).play;

What's the hang here?

          Thank You for Your Attention

--
Time is an imaginary number. Entropy always wins.


_______________________________________________
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: Weird behavior with Instr

Henricus J. Holtman
I noticed that you had updated Instr.loadAll, I was waiting until
3.9.0 gets released to update my home system. It seems

d = Instr("cymbals.tonal").asSynthDef;
...
PmonoArtic(
    d.name
...

is equivalent to

def = Instr("cymbals.tonal").asSynthDef;
...
PmonoArtic(
    def.name
...

I added the d.add because of uncertainity about whether the PmonoArtic would
'see' it.

However that is not the 'mystery'. It seems it requires something like:

c = Instr("cymbals.tonal").play;

beforehand otherwise no audio. That seems to be the only difference between
the two 'experiments'. Why would this be?

On 01/06/2018 12:00 AM, [hidden email] wrote:

Actually I fixed Instr.loadAll the other day, so update crucial-library

I'm not sure but I think what you want is:

def = Instr("cymbals.tonal").asSynthDef;

PmonoArtic(
...

The synth def name is not the same as the instr name.



On Sat, Jan 6, 2018 at 7:42 AM, <[hidden email]> wrote:
I am using 3.9dev. I have crucial-library and cxaudio loaded. I observe
this weird behavior with Instr:

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
    {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

c = Instr("cymbals.tonal").play; // this plays: continuous beats
// control-.
d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // plays a semirandom series of 'cymbal' hits
    d.name,
    \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
    \trig, 1,
    \freqScale, Pwhite(0.1, 4.0),
    \freqOffset, Pwhite(-4000, 300),
).play;

// however...

// boot interpreter
// boot server
// Instr.loadAll is broken, so I have to use the following
(

l = {
Instr.prLoadDir(Instr.dir);
LanguageConfig.includePaths.select(_.contains("quarks")).do
    {|quark| Instr.prLoadDir(quark ++ "/Instr") };
};

l.value;

)

d = Instr("cymbals.tonal").asSynthDef;
d.add;

PmonoArtic( // NO AUDIO!
    d.name,
    \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
    \trig, 1,
    \freqScale, Pwhite(0.1, 4.0),
    \freqOffset, Pwhite(-4000, 300),
).play;

What's the hang here?

          Thank You for Your Attention

--
Time is an imaginary number. Entropy always wins.


_______________________________________________
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/


-- 
Time is an imaginary number. Entropy always wins.
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior with Instr

ddw_music
Henricus J. Holtman wrote
> However that is not the 'mystery'. It seems it requires something like:
>
> c = Instr("cymbals.tonal").play;
>
> beforehand otherwise no audio.

Check the controls to make sure there's a real trigger control being
generated... SynthDescLib.at(d.name.asSymbol) I think.

Dump server OSC messages (command in server status menu) to see the actual
messages being sent while you play the pattern, and post a few sample
messages.

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/
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior with Instr

ddw_music
In reply to this post by Henricus J. Holtman
Henricus J. Holtman wrote

> d = Instr("cymbals.tonal").asSynthDef;
> d.add;
>
> PmonoArtic( // NO AUDIO!
>      d.name,
>      \dur, Pseq([1, 2, 2, 1, 3, 2], inf),
>      \trig, 1,
>      \freqScale, Pwhite(0.1, 4.0),
>      \freqOffset, Pwhite(-4000, 300),
> ).play;

FWIW I've just tried your code, and I do get audio. So I have no idea what's
happening on your machine. You will have to do some tracing for yourself.
Or, upgrade to 3.9-rc2 now. ("RC" = Release Candidate which means, basically
ready for release. There's no reason to be afraid of an RC version just
because it hasn't "officially" been declared to be the final release yet.)

Here's one of my tricks for debugging synth problems: automatically trace
every new synth.

// Turn on tracing
o = OSCFunc({ |msg| s.sendMsg(\n_trace, msg[1]) }, '/n_go', s.addr);

// Turn it off
o.free;

But there are a couple of subtle problems.

     \freqOffset, Pwhite(-4000, 300),

In the Instr definition, which you can access by
Instr("cymbals.tonal").openFile, the base frequencies for the
modal-resonance filters are all between 1000 and 1600 Hz. If you offset
these by a large negative number, then you will have negative frequencies
for the ringing filters.

I would expect the result to be either a filter blow up (which you didn't
report), or silence (which you did).

Further: The Instr uses Klank. Klank's filter parameters are set at the
beginning of the synth's lifetime. If you play this def using Pmono, you'll
get only one synth and its timbre can never change. It *happens* that your
PmonoArtic is using the default legato = 0.9, so it's re-articulating on
every note.

Next problem: The envelope. The pattern system generally assumes that synths
will free themselves, under control of an envelope (doneAction). This Instr
assumes that it will keep running and be triggered repeatedly. So there's a
fundamental incompatibility between the Instr and the normal pattern system.
You should expect trouble here.

PmonoArtic assumes that there is a "gate" argument, and that it can set
\gate to 0 to release. This synth doesn't have a gate. You're "kind of sort
of" getting away with it because, if there's no gate, PmonoArtic uses
/n_free to stop the old synth. But it means, if the rhythm gets fast enough,
/n_free will brutally cut off the notes before they've finished ringing --
not musically useful.

Probably you should be using one of the crucial-library Player objects for
triggering, but I don't know which one. I think you will not get useful
behavior from Pbind or PmonoArtic unless you modify the Instr definition to
match the pattern system's assumptions.

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/
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior with Instr

ddw_music
ddw_music wrote
> Next problem: The envelope. The pattern system generally assumes that
> synths will free themselves, under control of an envelope (doneAction).
> This Instr assumes that it will keep running and be triggered repeatedly.

I should also say, there are 3 or 4 ways to structure note control in a
synth, and they aren't necessarily compatible -- so, while you might like to
think somebody could publish a library of synthesis functions and they would
all work seamlessly, everywhere you want them to, in fact, that isn't really
possible. At some point, it's necessary to know which style the synth
function (SynthDef, Instr, NodeProxy, whatever) is using and which style the
player expects.

So my comments shouldn't be taken to mean that cxaudio is "the problem" or
some such... just that it's a common programming problem: when you take a
bit of code outside of its original context, it may or may not work without
tweaking it. (One problem in SC is that we don't have abstractions to help
make these various coding styles work together.)

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/
Reply | Threaded
Open this post in threaded view
|

Re: Weird behavior with Instr

Henricus J. Holtman
In reply to this post by ddw_music


On 01/06/2018 05:51 PM, [hidden email] wrote:

> ...
> But there are a couple of subtle problems.
>
>       \freqOffset, Pwhite(-4000, 300),
>
> In the Instr definition, which you can access by
> Instr("cymbals.tonal").openFile, the base frequencies for the
> modal-resonance filters are all between 1000 and 1600 Hz. If you offset
> these by a large negative number, then you will have negative frequencies
> for the ringing filters.
>
> I would expect the result to be either a filter blow up (which you didn't
> report), or silence (which you did).
>
> ...
I derived these constructs from reading the specs for "cymbals.tonal".
It seemed to indicate that the args expected
were in the range -4000 - 300 and they were linear, so Pwhite seemed to
fit. Why the discrepancy to what you seem
to indicate would be more reasonable numbers?


                             Thank You for Your Attention

--
Time is an imaginary number. Entropy always wins.


_______________________________________________
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: Weird behavior with Instr

ddw_music
Henricus J. Holtman wrote
> I derived these constructs from reading the specs for "cymbals.tonal". It
> seemed to indicate that the args expected
> were in the range -4000 - 300 and they were linear, so Pwhite seemed to
> fit. Why the discrepancy to what you seem to indicate would be more
> reasonable numbers?

Maybe it's just a mistake -- just because it's in a public library doesn't
mean it's guaranteed to be correct.

With those specs, you will sometimes get negative frequencies for the
filters. That may or may not be ok, depending on the filter implementation
-- I haven't tested Klank specifically for it -- but if it were me, I would
avoid it.

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/