[chuck-users] Jack Server shuts down ChucK client ...

Julien Saint-Martin julien.saintmartin at googlemail.com
Wed Apr 1 10:21:36 EDT 2015


Hi Niklas,

Just a general remark about Jack and the error:
(JACK) the JACK server is shutting down this client...
     ... stream stopped and closed!

I don't know why but if you are using Jack 1 this should occur often.
I (and some others) recommend to use Jack 2 instead. It is more stable.

Julien


On 01/04/2015 12:32, Niklas Reppel wrote:
> Oh, ok, makes sense, i'll try that !
>
> Thanks!
>
> Though i still wonder why it's Jack that's complaining, and not ChucK 
> itself ... weird ..
>
> On 01.04.2015 04:00, Joel Matthys wrote:
>> Hello Niklas. Your class idea is good, and your old code is very 
>> close to working.
>>
>> The problem is scope-related. In our OSC receiving method, you create 
>> an instance of MyBuzzer, then spork a method from it. But your object 
>> "buzzer" gets freed at the end of that code block, so the object your 
>> sporked thread references to no longer exists!
>>
>> You need to instantiate MyBuzzer in the sporked thread, not the main 
>> thread. This modified version worked for me:
>>
>> class MyBuzzer {
>>     SawOsc saw => LPF lp => ADSR e => Dyno dyn => dac;
>>     ADSR filt => Gain fg => blackhole;
>>     10 => fg.gain;
>>     Step s;
>>     s => filt;
>>     1 => s.next;
>>
>>     // one-shot sine spork
>>     fun void buzz(float freq, float gain, int a, int d, int sus, int 
>> r) {
>>         a + d + sus + r => int overall;
>>         freq => saw.freq;
>>         e.set( a::ms, d::ms, gain, r::ms );
>>         filt.set( a::ms, (sus - r)::ms, gain, r::ms );
>>         dyn.limit;
>>         gain / 4 => dyn.thresh;
>>         if(d == 0) {
>>             0 => e.decayRate;
>>             0 => filt.decayRate;
>>         }
>>
>>         now + overall::ms => time then;
>>
>>         spork ~ filteradsr(then, freq);
>>
>>         e.keyOn();
>>         filt.keyOn();
>>         sus::ms => now;
>>         e.keyOff();
>>         filt.keyOff();
>>         r::ms => now;
>>
>>         // I removed the connect and disconnect code because it 
>> wasn't the problem
>>     }
>>
>>     fun void filteradsr (time then, float freq) {
>>         while (now < then) {
>>             float currfilt;
>>             filt.last() * 800 + 100 => currfilt;
>>             currfilt => lp.freq;
>>             1::ms => now;
>>         }
>>     }
>> }
>>
>> // this will get sporked
>> fun void sporkedBuzzer(float freq, float gain, int a, int d, int s, 
>> int r )
>> {
>>     MyBuzzer buzzer;
>>     buzzer.buzz(freq, gain, a, d, s, r);
>> }
>>
>> // create our OSC receiver
>> OscRecv recv;
>> // use port 6449 (or whatever)
>> 6449 => recv.port;
>> // start listening (launch thread)
>> recv.listen();
>>
>> // create an address in the receiver, store in new variable
>> recv.event( "/buzz, f f i i i i" ) @=> OscEvent @ oe;
>>
>> // infinite event loop
>> while( true ) {
>>     // wait for event to arrive
>>     oe => now;
>>     // grab the next message from the queue.
>>     while( oe.nextMsg() ) {
>>         oe.getFloat() => float freq;
>>         oe.getFloat() => float gain;
>>         oe.getInt() => int a;
>>         oe.getInt() => int d;
>>         oe.getInt() => int s;
>>         oe.getInt() => int r;
>>         spork ~ sporkedBuzzer(freq, gain, a, d, s, r);
>>     }
>> }
>>
>>
>> On 03/31/2015 12:26 PM, Niklas Reppel wrote:
>>> Hmm i'm using this a lot elsewhere, so i don't think so ...
>>>
>>> Strange thing is, if i don't use a class, but two plain methods, the 
>>> problem doesn't occur any longer ...
>>>
>>> I can live with that, though i'd say using a class would b eslightly 
>>> more intuitive here ...
>>>
>>> NEW VERSION: 
>>> https://github.com/the-drunk-coder/graa/blob/master/shreds/buzz.ck
>>>
>>>
>>> OLD VERSION:
>>>
>>> class MyBuzzer {
>>>     SawOsc saw => LPF lp => ADSR e => Dyno dyn;
>>>     ADSR filt => Gain fg => blackhole;
>>>     10 => fg.gain;
>>>
>>>     Step s;
>>>     s => filt;
>>>     1 => s.next;
>>>
>>>     // one-shot sine spork
>>>
>>>     fun void buzz(float freq, float gain, int a, int d, int sus, int 
>>> r) {
>>>
>>>         a + d + sus + r => int overall;
>>>
>>>         freq => saw.freq;
>>>
>>>         e.set( a::ms, d::ms, gain, r::ms );
>>>
>>>         filt.set( a::ms, (sus - r)::ms, gain, r::ms );
>>>
>>>         dyn.limit;
>>>
>>>         gain / 4 => dyn.thresh;
>>>
>>>         if(d == 0){
>>>
>>>             0 => e.decayRate;
>>>
>>>             0 => filt.decayRate;
>>>
>>>         }
>>>
>>>         now + overall::ms => time then;
>>>
>>>         spork ~ filteradsr(then, freq);
>>>
>>>         e.keyOn();
>>>
>>>         filt.keyOn();
>>>
>>>         sus::ms => now;
>>>
>>>         e.keyOff();
>>>
>>>         filt.keyOff();
>>>
>>>         r::ms => now;
>>>
>>>         // disconnecting doesn't really help here ...
>>>         dyn !=> dac;
>>>
>>>     }
>>>
>>>     fun void filteradsr (time then, float freq){
>>>
>>>         while (now < then){
>>>
>>>             float currfilt;
>>>
>>>             filt.last() * 800 + 100 => currfilt;
>>>
>>>             currfilt => lp.freq;
>>>
>>>             1::ms => now;
>>>
>>>         }
>>>
>>>     }
>>>
>>>     fun void connect(UGen ugen){
>>>
>>>         dyn => ugen;
>>>
>>>     }
>>>
>>> }
>>>
>>> // create our OSC receiver
>>>
>>> OscRecv recv;
>>>
>>> // use port 6449 (or whatever)
>>>
>>> 6449 => recv.port;
>>>
>>> // start listening (launch thread)
>>>
>>> recv.listen();
>>>
>>> // create an address in the receiver, store in new variable
>>>
>>> recv.event( "/buzz, f f i i i i" ) @=> OscEvent @ oe;
>>>
>>> // infinite event loop
>>>
>>> while( true )
>>>
>>> {
>>>
>>> // wait for event to arrive
>>>
>>> oe => now;
>>>
>>> // grab the next message from the queue.
>>>
>>> while( oe.nextMsg() )
>>>
>>> {
>>>
>>> oe.getFloat() => float freq;
>>>
>>> oe.getFloat() => float gain;
>>>
>>> oe.getInt() => int a;
>>>
>>> oe.getInt() => int d;
>>>
>>> oe.getInt() => int s;
>>>
>>> oe.getInt() => int r;
>>>
>>> MyBuzzer buzzer;
>>>
>>> buzzer.connect(dac);
>>>
>>> spork ~ buzzer.buzz(freq, gain, a, d, s, r);
>>>
>>> }
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>> On 31.03.2015 19:14, Robert Poor wrote:
>>>> Is there any chance that oe.nextMsg() is returning false, as in:
>>>>
>>>> while( oe.nextMsg() )
>>>>      { ...
>>>>      }
>>>>
>>>> ?
>>>>
>>>>
>>>> On Tue, Mar 31, 2015 at 9:52 AM, Niklas Reppel 
>>>> <nik at parkellipsen.de> wrote:
>>>>> So, i'm trying to write a simple SawOsc-Synth with Polyphony, 
>>>>> triggered by
>>>>> OSC messages ...
>>>>>
>>>>> You can check it out here:
>>>>> https://github.com/the-drunk-coder/graa/blob/master/shreds/buzz.ck
>>>>>
>>>>> As i want to use a filter with adsr, i can't just spork a single 
>>>>> method
>>>>> right ?
>>>>>
>>>>> But, with the current version, the Jack-Server (i'm on Linux) 
>>>>> shuts the
>>>>> client down,
>>>>> with the following message:
>>>>>
>>>>> (JACK) the JACK server is shutting down this client...
>>>>>      ... stream stopped and closed!
>>>>>
>>>>> Anyone's got an idea why ?
>>>>>
>>>>> Regards,
>>>>> Nik
>>>>> _______________________________________________
>>>>> chuck-users mailing list
>>>>> chuck-users at lists.cs.princeton.edu
>>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>> _______________________________________________
>>>> chuck-users mailing list
>>>> chuck-users at lists.cs.princeton.edu
>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list