electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Chuck Versus SuperCollider
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 2 [32 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Wed Oct 15, 2008 6:47 am    Post subject: Chuck Versus SuperCollider Reply with quote  Mark this post and the followings unread

Hi Guys,

Are there any advantages/disadvantages of Chuck compared to Supercollider.

I have done a little playing with Chuck on a PC and it seems very inefficient compared to Supercollider with very high cpu load, is this normal?

Cheers

Andy
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Oct 15, 2008 10:17 am    Post subject: Re: Chuck Versus SuperCollider Reply with quote  Mark this post and the followings unread

BobTheDog wrote:

Are there any advantages/disadvantages of Chuck compared to Supercollider.


The main advantage over SC is that you don't have to hang out with SC users. I heard that people who use SC eat babies and support terrorism, don't trust them. ;¬)

(also; we have several topics now that go into this in more detail... more seriously as well)

Quote:

I have done a little playing with Chuck on a PC and it seems very inefficient compared to Supercollider with very high cpu load, is this normal?


Yeah, it's normal. Aside from SC having had the time to place more emphasis on optimisation, the major difference is block processing. Block processing saves LOTS of cpu but the cost is that you can't straightforwardly use a feedback loop and expect it to only give the Z-1 sample in latency. ChucK will always be sample accurate, in fact it's quite a few orders of magnitude more accurate then that for signals that aren't audio signals.

This comes at a price, being a relatively high CPU cost. Ge is working on it; we'll have context-sensitive block processing that intelligently sorts out where to use block processing and where to go "a sample at a time", but this may take a while to get done.

Optimising ChucK code for CPU usage takes a bit of knowledge and experience but it's definitely possible. If you're running into CPU issues on your first few days it's more likely that we need to have a little look at your code... but then again; maybe you are trying additive synthesis, in that case there may be a real problem.

PS; I quite like my friends who use SC and I like to lurk at their list.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Wed Oct 15, 2008 10:42 am    Post subject: Reply with quote  Mark this post and the followings unread

Well I wasn't doing much, a noise oscillator example was using 75% cpu on my little EeePc 1000, maybe it is a problem with Intel Atoms.

I was also using miniAudicle so maybe the issue was there, I will get the command line version and have a look at that.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Oct 15, 2008 10:50 am    Post subject: Reply with quote  Mark this post and the followings unread

EeePc means Linux, right?

Get a Rt kernel if possible, it'll save a lot of CPU for ChucKing, I have no idea exactly why but it'll get you a lot more CPU headroom.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Thu Oct 16, 2008 7:51 am    Post subject: Reply with quote  Mark this post and the followings unread

I gave up on linux and stuck XP on the thing as I wanted to run Max 5.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu Oct 16, 2008 2:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ah, ok.

Well, that's a good reason then; Max won't run on Linux. XP on a EEE is a bit too specific for me to say anything about. XP, IMHO, needs stripping for audio usage but then the EEE is especially appealing for mobile internet usage and so disabling things like fire-walls and so on does seem to defeat the purpose of the device a little.

75% is still a lot, how many MHz are we talking here? Could I take a look at this osc?

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Thu Oct 16, 2008 4:41 pm    Post subject: Re: Chuck Versus SuperCollider Reply with quote  Mark this post and the followings unread

Kassen wrote:
BobTheDog wrote:

Are there any advantages/disadvantages of Chuck compared to Supercollider.


The main advantage over SC is that you don't have to hang out with SC users. I heard that people who use SC eat babies and support terrorism, don't trust them. ;¬)


How did you find out? That's a carefully guarded secret.

Anyway, as a whole SC users are nicer than certain Ruby users...

James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Thu Oct 16, 2008 4:58 pm    Post subject: Re: Chuck Versus SuperCollider Reply with quote  Mark this post and the followings unread

dewdrop_world wrote:

How did you find out? That's a carefully guarded secret.


Oh, I got Nescivi drunk, of course!

Quote:

Anyway, as a whole SC users are nicer than certain Ruby users...


I saw that. I promptly proposed we turn that quote into a Tshirt, added it to the WiKi under "propaganda"... then when nobody else turned out to be as enthusiastic as I was I added it to my MySpace page.

I also wrote to the list that I wondered why we didn't, I mean; ChucK and me have been together for years, we spend many emotionally intimate night together... why not? I concluded that it might've been because I've been so critical of ChucK and how that never goes over well in relationships.

Again nobody shared my enthusiasm for Giles either but I hope he'll write more on this subject.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri Oct 17, 2008 10:26 am    Post subject: Reply with quote  Mark this post and the followings unread

Well I have tried the command line chuck abd the example uses 33% cpu which is better but still not that good!

The code is one of the examples:

// the patch, note pan2 is stereo
Noise n => Pan2 p => dac;
.1 => n.gain;

// variable
0.0 => float t;
// smaller == smoother
10::ms => dur T;

// time loop
while( true )
{
// pan goes from -1 (left) to 1 (right)
Math.sin(t) => p.pan;
// increment t (scaling by T)
T / second * 2.5 +=> t;

// uncomment to print out pan, last left, last right
// <<

>>;

// advancde time
T => now;
}

It is a 1.6Ghz Atom running in full performance mode, I think it may be the audio drivers as most of the cpu is in the kernel.

I will keep investigating

Andy

Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Fri Oct 17, 2008 11:36 am    Post subject: Reply with quote  Mark this post and the followings unread

Maybe if we can replace Math.sin with some other mothods in there, it would improve a lot.
how about using a Sine Wave look-up table?
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Fri Oct 17, 2008 12:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

A lookup table would improve performance I am sure.

I can run 10 of these on my MacBook and it only uses 10% cpu so i think there must be an issue with the EeePc audio drivers, I have been meaning to get a little usb sound adapter maybe now is the time.

Cheers

Andy
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Sat Oct 18, 2008 1:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

I'm very new to Supercollider now and I try to spend my free time before going to bed
(sometimes till 7am -_-'.. not good)
practicing Supercollider.
But it's like learning new language and adjusting my thinking style also.

It's my first time programming in very object-oriented and functional language.
I kinda like what I can do with data structures (array, list, set, ... and their methods)
It's also one thing I want to see more in ChucK also.

But I still can't think smoothly in SC.
I just need more time.
and I might be able to try what I have done in ChucK with SC.

Now I still feel that ChucK and SC are still quite different that..
learning both language is nice.
After many languages I have tried,
ChucK really changed how I think about audio programming.
It feels straight-forward for me.
But still, I'd like to combine that with features from other languages also.

Cheers to all.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat Oct 18, 2008 2:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

BobTheDog wrote:
A lookup table would improve performance I am sure.


Are you sure? I'm not sure this is true any more on modern systems, especially as the table would be in RAM, not cache. A problem here is that benchmarking ChucK is quite hard as ChucK doesn't keep track of the time spend doing stuff. There are great reasons for that, and generally speaking it's a big strength but benchmarking is hard. You can do the same thing a million times and use a stopwatch, but that seems quite crude.

Still, it's indeed the sin() that looks most likely to be the issue to me in this code here.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sat Oct 18, 2008 4:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:
I'm very new to Supercollider now and I try to spend my free time before going to bed
(sometimes till 7am -_-'.. not good)
practicing Supercollider.
But it's like learning new language and adjusting my thinking style also.


Kijjaz, could you keep us up to date here or perhaps point us to a blog feed or something? I'm interested in your project here and would like to hear more about it if/when you have news.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Sat Oct 18, 2008 8:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hmm... yes. I should use my blog to collect some of my experiences while starting SC as a newbie.
will come and post again.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Sat Oct 18, 2008 9:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz, you always have interesting things to say, keep us posted on your SuperCollider adventures if you like.

Andy, why not use a SinOsc oscillator and access it with .last()? Something like this (untested code):

Code:
SinOsc osc => blackhole;
1 => osc.freq;
while (true) {
    osc.last() => p.pan;
    10::ms => now;
}


Whenever you can code something with UGens it tends to be more efficient.

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
BobTheDog



Joined: Feb 28, 2005
Posts: 3861
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Sun Oct 19, 2008 2:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Well the code is just one of the examples that comes with the Chuck installation so I have not coded it up.

Just sending a sin osc to the output uses loads of cpu.

I tested supercollider on the EeePc and it runs with very low cpu, also Max 5 and Reaktor seem to run fine, very strange.


Andy
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Oct 19, 2008 4:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, that's strange. ChucK simply *is* hard on the CPU (and what looks like a partial solution is in the pipeline) but this does sound like a bit much to me.

The examples, BTW, typically aren't optimised for efficiency. That dir is a great resource but here and there there are some bits that I frown on a bit. Some give errors, some leak memory, some have constructs that I'd call just plain weird. I think this is partially to blame on many of the examples being quite old. I wouldn't be surprised if this one was older then the .last() function which in this case is indeed preferable.

Maybe we should set up a small task-force and give the examples a good tuning up.

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
fabb



Joined: Dec 13, 2008
Posts: 7
Location: a small village in austria

PostPosted: Fri Feb 20, 2009 5:29 am    Post subject: Re: Chuck Versus SuperCollider Reply with quote  Mark this post and the followings unread

dewdrop_world wrote:
Anyway, as a whole SC users are nicer than certain Ruby users...

haha! i laughed even more when i saw which t-shirt he wore on one of his presentations: http://rubyhoedown2008.confreaks.com/12-giles-bowkett-archaeopteryx-a-ruby-midi-generator.html
Back to top
View user's profile Send private message
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Sun Feb 22, 2009 8:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for bumping this thread. I had wanted to take a look at Giles's "revolutionary" talk and see what all the fuss was about, but never got around to it. I'll give him credit for style. Not sure how revolutionary it really is, although I'm generally sympathetic to the bottom-up model of entrepreneurship he advocates.

He's still a self-important twit Smile some of which attitude might be there to cover up the potentially embarrassing fact that a good chunk of Archaeopteryx could be written in supercollider with a fraction of the code. "Probability matrix" sounds fancy, but with pattern-style lazy evaluation in SC, the probabilities can be rendered in just a couple of lines of code.

Code:
p = Pbind(
   \probability, Pseq(probability_matrix_row_here, inf),
   \freq, Pif(Pwhite(0.0, 1.0, inf) < Pkey(\probability), 1, \rest),
   \delta, 0.25,
   ... other parameters
).play;


And he's awfully proud of using lambdas for everything, but... get this... in SC, every Function is a lambda! I guess one of the perks of using Ruby for this is that he can go into a room full of people who don't know anything about computer music, and they think he's a genius or something. But kudos to him if he can sell it to DJs...

And I found here that James McCartney (author of supercollider) already took him down *LOL*:

Quote:
fnoise 3 points 4 months ago[-]
The probability matrix algorithm he talks about is very old hat. He is apparently ignorant of what has been done in the field of computer music and live coding, and when it is brought to his attention he is an asshole about it.
"The people who wrote ChucK got academic funding to work on a music software project. They didn't do it on their own dime, like me." Who fucking cares. I wrote SuperCollider on my own dime. It is available for free. Puredata is available for free. So is ChucK. So is Csound. So is Impromptu, etc..
Other people have done it first, and done it better. He's a noob.


James

_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Sun Feb 22, 2009 10:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

wahahahaha
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
fabb



Joined: Dec 13, 2008
Posts: 7
Location: a small village in austria

PostPosted: Mon Feb 23, 2009 1:29 am    Post subject: Reply with quote  Mark this post and the followings unread

anniway, i'm now getting interested into supercollider as well. i just played around in chuck a bit, but i sometimes miss the graphics overview from reactor-similar approaches (currently playing with synthmaker, which has a quite cool way of generating graphics interfaces modularly - but many limitations otherwise).

currently reading "microsound" from curtis roads where he stated he likes supercollider as it has graphical envelopes. is there a way to do that in chuck too? just code makes me wanna jump out of the window...

both chuck's and supercollider's code looks quite clean, i found this comparison wiki: http://wiki.cs.princeton.edu/forums.html/Parallel_code_examples_in_SuperCollider_and_ChucK
still can't decide which one to prefer.
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 5978
Location: San Antonio, Tx, USA
Audio files: 258

PostPosted: Mon Feb 23, 2009 3:23 am    Post subject: Reply with quote  Mark this post and the followings unread

fabb, welcome to electro-music.com. There are some very limited ways to do graphics with ChucK. Currently only on Macs, ChucK has some GUI tools which include sliders, buttons, and LEDs. These are promised to become cross-platform to PC and Linux in the next release.

Using these GUI objects I have been able to create arrays of LEDs for crude oscilloscopes, spectrum analyzers, and music games. You can also make sliders move around in real time and I once even made a pong game by moving buttons around on the screen (this is not a supported use of the GUI but it kind of works).

One other approach that I tried successfully was to make ChucK send out text to the console monitor which was actually POV-Ray source code for creating animations. I then copied and pasted the console monitor into POV-Ray's editor and let it chew on the animation for a while, creating a .mov file. then I united the ChucK audio output from a .wav file with the .mov file using Apple's iMovie software. You can see these movies on my web page by clicking on the www link below.

There is also OSC, or Open Sound Control, which allows messaging between applications. I do not know much about OSC but you might be able to use it to link ChucK with some real-time graphics application.

Oh, you can also use Jack or Soundflower or a Y cable to route audio from ChucK to some software that listens to music such as a visualizer or a software oscilloscope.

So those are some possibilites, each with their own limitations. Gluck, which is Graphical ChucK will eventually become available or so they say, but it may be quite some time before that happens. Good luck and have fun.

_________________
"Let's make noise for peace." - Kijjaz
Back to top
View user's profile Send private message Send e-mail
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Mon Feb 23, 2009 6:32 am    Post subject: Reply with quote  Mark this post and the followings unread

I'd like to see a modular GUI application that can link with ChucK easily through OSC.
Something that we can code in chuck fast and interact quickly on an interface. Maybe with some basic graphical tools.. hmm Sliders, Knobs, Toggles, Bang switches, Text areas, Patch cords, Output Text boxes, Plots.

Maybe with this we can develop many more ways we can interact with ChucK especially though network. Anyone working in this field already? I have the idea but still don't know how to develop this kind of thing. Maybe in Java or Processing or just GTK. lol.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
dewdrop_world



Joined: Aug 28, 2006
Posts: 858
Location: Guangzhou, China
Audio files: 4

PostPosted: Mon Feb 23, 2009 7:12 am    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:
I'd like to see a modular GUI application that can link with ChucK easily through OSC.


http://www.sciss.de/swingOSC/ - supports buttons, sliders, 2d sliders, multislider arrays, list boxes, popup menus, user-definable views, drag-n-drop views, scrolling containers, and (with Java Media Framework) a movie view. It is seriously dope. Attached are a couple of graphics - one with the SC class browser in Cocoa and the other, the same thing in Swing. Functionally identical.

You just need the ChucK classes to implement the OSC interfaces. That's a lot of work but would be well worth it - it would do more than MAUI and work on any Java-ready platform.

James


cocoa-class-browser.png
 Description:
 Filesize:  239.52 KB
 Viewed:  116 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

cocoa-class-browser.png



swing-class-browser.png
 Description:
 Filesize:  79.85 KB
 Viewed:  114 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

swing-class-browser.png



_________________
ddw online: http://www.dewdrop-world.net
sc3 online: http://supercollider.sourceforge.net
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 2 [32 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use