Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRT in lang.interpret #80

Open
VictorKolb opened this issue Mar 31, 2020 · 9 comments
Open

NRT in lang.interpret #80

VictorKolb opened this issue Mar 31, 2020 · 9 comments

Comments

@VictorKolb
Copy link

VictorKolb commented Mar 31, 2020

Hello! Are there plans to implement NRT in lang.interpret? I try to do something like this:

const sc = require("supercolliderjs");

sc.lang.boot({debug: true, echo: true, stdin: true, stdout: true}).then(async function (lang) {
    try {
        const res = await lang.interpret(`
SynthDef(\\pad, {
    arg freq = 440, dur = 1, amp = 1, feedback = 1, out = 0;
    var sig, local, env;
    sig = SinOsc.ar(freq);
    env = EnvGen.kr(
        Env.new([0, 1, 1, 0], [0, dur / 2, dur + 5], 'sin'),
        doneAction: 2
    );
    sig = sig * env;
    
    
    Out.ar(out, Pan2.ar(sig, SinOsc.kr([1, 2, 0.2, 0.5].choose, 0, [1, 0.5, 0.7].choose)));
}).store;


a = Scale.minorPentatonic;

p = Pbind(
    \\instrument, \\bass,
    \\ctranspose, 0,
    \\dur, Prand([1,2,4,8], inf),
    \\sustain, 1,
    \\degree, Pxrand(a.degrees, inf),
    \\out, 0
).asScore(duration: 8);


p.recordNRT(
    outputFilePath: "~/Desktop/111/test.wav".asAbsolutePath,
    headerFormat: "WAV",
    duration: 8
);

`);

        console.log(res)
    } catch (e) {
        console.log(e)
    }

    await lang.quit();
});

But i get test.wav with 44 bytes length. :(

@crucialfelix
Copy link
Owner

Anything you run in sclang like that should be the exact same as running it from the SC IDE..

Do you need to boot the scsynth server? (I don't think so)
Do you have another scsynth server already running that conflicts with the one sclang is trying to use?

@crucialfelix
Copy link
Owner

btw.

// ...
} catch (e) {
        console.log(e)
} finally {
    await lang.quit();
}

@VictorKolb
Copy link
Author

@crucialfelix no one scsynth server is running. Same code in SC IDE will write file correct.

@crucialfelix
Copy link
Owner

crucialfelix commented Mar 31, 2020 via email

@VictorKolb
Copy link
Author

@crucialfelix thank for answer! I'll try to do something with this)

@VictorKolb
Copy link
Author

@crucialfelix hello again! After few attempt I not finding in documentation info about messaging system :( Or you mean is "need to create it"?

@crucialfelix
Copy link
Owner

crucialfelix commented Apr 12, 2020 via email

@Catsvilles
Copy link

@VictorKolb Hey, did you had any success with this? I'm looking for a way to fully compose SC's score with JS

@VictorKolb
Copy link
Author

@Catsvilles hey! I setting interval and every second looking at file size with fs.statSync if the file size is didn't changed for 3 times I conclude which rendering is has been done. This tactic good works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants