[chuck-users] SinOsc UGen

Mario Buoninfante mario.buoninfante at gmail.com
Wed Oct 24 05:21:01 EDT 2018


Hi,

I tried using SndBuf instead of SinOsc (both on Rasp Pi and a MacBookPro),
but SinOsc seems to offer better performances.
On the Mac (2.7 GHz Intel Core i5, 16 GB 1867 MHz DDR3, MacOS Sierra
10.12.6), running the code you'll find below, I've got this CPU usage (I
used top from terminal to check the CPU usage):

SndBuf x 50 - CPU usage 24.0%
SinOsc x 50 - CPU usage 16.4%

the same seems to happen on Rasp Pi 3, despite I had to use 25 oscillators
to avoid glitches.

here's my code
------------SinOsc Version------------
SinOsc s[50];

for(0 => int c; c<s.size(); c++)
{
    s[c].gain( (1/( s.size()) $ float) * 0.25);
    s[c] => dac;
}

while(true)
{
    for(0=>int c; c<s.size(); c++)
    {
        Math.random2f(300, 500) => s[c].freq;
    }

    200::ms => now;
}

------------SndBuf Version------------
SndBuf s[50];

for(0 => int c; c<s.size(); c++)
{
    s[c].read(me.dir() + "/sine_1024.wav");
    s[c].pos(0);
    s[c].loop(1);
    s[c].gain( (1/( s.size()) $ float) * 0.25);
    s[c] => dac;
}

while(true)
{
    for(0=>int c; c<s.size(); c++)
    {
        Math.random2f(300, 500) => s[c].freq;
    }

    200::ms => now;
}

-------------------

cheers,
Mario
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20181024/4dc115e2/attachment.html>


More information about the chuck-users mailing list