electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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
how many blackholes?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [12 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
majutsu



Joined: Jun 18, 2006
Posts: 151
Location: New York
Audio files: 1

PostPosted: Mon Sep 04, 2006 5:12 pm    Post subject: how many blackholes? Reply with quote  Mark this post and the followings unread

in a piece of code, how many blackholes can run at the same time? just one? or, when shredding, how many blackholes can run at the same time, if each shred uses one blackhole?
_________________
All phenomena are atoms in association and dissociation.
Back to top
View user's profile Send private message
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Mon Sep 04, 2006 7:57 pm    Post subject: Re: how many blackholes? Reply with quote  Mark this post and the followings unread

majutsu wrote:
in a piece of code, how many blackholes can run at the same time? just one? or, when shredding, how many blackholes can run at the same time, if each shred uses one blackhole?

There is only one instance of 'blackhole' that's by default rigged to be the 'silent sample sucker'. In that sense, it's very much like the dac. It's shared by all shreds that use it, and you can connect as many ugens to the blackhole as you'd like.
Back to top
View user's profile Send private message Visit poster's website
majutsu



Joined: Jun 18, 2006
Posts: 151
Location: New York
Audio files: 1

PostPosted: Mon Sep 04, 2006 8:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

well, let's say i wanted to modify the frequency of one sine wave with another (fm), the modifier would use blackhole. Let's say then at the same time i want that whole sound to have a vibrato, another sine wave as a pitch lfo uses the blackhole. can they both function at once or do their numbers tangle in the blackhole. in the dac it doesn't matter because everything can play at once without wondering how it got there.
_________________
All phenomena are atoms in association and dissociation.
Back to top
View user's profile Send private message
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Mon Sep 04, 2006 8:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

majutsu wrote:
well, let's say i wanted to modify the frequency of one sine wave with another (fm), the modifier would use blackhole. Let's say then at the same time i want that whole sound to have a vibrato, another sine wave as a pitch lfo uses the blackhole. can they both function at once or do their numbers tangle in the blackhole. in the dac it doesn't matter because everything can play at once without wondering how it got there.

Good question. The blackhole simply sucks and essentially discards the samples. The real work is done in the UGen connected to the blackhole. It's main purpose to drive UGen's which aren't or shouldn't be connected to the dac. So the situation you are describing should work just fine.
Back to top
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


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

PostPosted: Tue Sep 05, 2006 2:58 am    Post subject: Reply with quote  Mark this post and the followings unread

As I understand it it's a matter of execution order and saving cpu by not calculating unused Ugens.

I think that when a Ugen want's to calculate it's next output it first needs the outputs of everthing conected to it so it send "you calculate yourself first" to all Ugens conected to it and once those are done it calculates itself. As long as that chain would start sending it's requests at the end stage (the DAC) everything that gets heard oraffects something that gets heard will be calculate. The exception would be things that don't end up at the DAC yet still get used. For those Blackhole is used.

This means only one Blackhole would be enough; the important thing is only that it knows what's conected to it and that it asks those things to be computed.

Not only does that mean ChucK's calculation order would work roughly like Clavia's G2; It also means you could now trace in what order things get calculated which might be usefull for things like homebrew filters. This is cool because it means no uexpected artefacts from weird calculation order matters like in some systems.

Also; we realy need Blackhole; it wouldn't do to calculate everything the DAC needs every sample, then calculate stuff that normally doesn't get used only as a .last() function gets called. This is because the last sample of a ugen will depend on all that went on before it and so we couldn't save cpu that way; it'd just mean huge spikes in cpu usage every now and then.

To be clear; this is just how I think it works and what some of the reasoning behind it is, I could be wrong

_________________
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: Tue Sep 05, 2006 11:57 am    Post subject: Reply with quote  Mark this post and the followings unread

do i understand correctly?.. in this case..
we can just do:

// ---
// oscilator initializations..
. . .
. . .

// let's say we have 2 lfos
triosc lfo1 => blackhole;
triosc lfo2 => blackhole;

// and let them make love
10::samp => dur controlrate; // just for this example
while(controlrate => now) {
lfo1.last() do something => with oscillator's something;
lfo2.last() do something => with oscillator's another something;
}

right?
see you around soon.

oh and .. how do i multichuck? i can't find a doc that has that example
but i think i've seen it before
is it something like.. triosc lfo1, triosc lfo2 => blackhole; ?

- kijjaz
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: Tue Sep 05, 2006 2:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Right, completely right.
Both lfo's end up at "blackhole", blackhole will make sure they calculate a value every sample and aside from that it doesn't do anything. It's kinda a abstract concept and not something where you have to considder how many blackholes it takes to fill a medium sized dinner plate. Having more then one blackhole might even cause execution order confusion, asuming my guesses above are right.

As for "multi chucking" I'm realy not sure. Ge will know but to me that sort of line sounds needlessly confusing. A while ago we had a small-ish issue with defing multiple Ugens that way (and not even chucking them anywhere), I din't lose any sleep over that bcause I don't realy see any advantage in that style of writing.

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



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Tue Sep 05, 2006 3:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Multi-chucking only works for function invocation:

Code:
std.rand2f(1, 5)

is equivalent to
Code:
(1, 5) => std.rand2f


We'd originally thought about multi-chucking for things in general but as Kassen noted, it seems confusing without clear benefits. We'll keep working on this front. For now, there is no multi-chucking of UGen's to UGen's.
Back to top
View user's profile Send private message Visit poster's website
kijjaz



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

PostPosted: Tue Sep 05, 2006 6:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

yes.. i just can't imagine
someone chucking 2 people
and those 2 people chucking another someone.

A chucking B and B chucking C or
A chucking B chucking C at the same time looks better for me

what the chuck -_-"
- - -

if i've chucked an oscillator or any other kinds of ugen to blackhole..
okay the values are going to be calculated..

but if i unchuck them..
would the value read from those ugens stopped also?
(i'll try to figure this out myself also) ..

- - - i'm back again

i've got this code to test:
Code:
sinosc s1; sinosc s2;
s1 => blackhole; s2 => blackhole;

(8 => s1.freq) * 2 => s2.freq;

for(0 => int i; i < 10; i++)
        { <<< s1.last(), s2.last() >>>, 10::ms => now; }
s1 =< blackhole;

for(0 => int i; i < 10; i++)
        { <<< s1.last(), s2.last() >>>, 10::ms => now; }

it runs well..
but the program halt afterthat.. i have to wait for a bit..
0.000000 0.000000
0.481754 0.844328
0.844328 0.904827
0.998027 0.125333
0.904827 -0.770513
0.587785 -0.951057
0.125333 -0.248690
-0.368125 0.684547
-0.770513 0.982287
-0.982287 0.368125
-0.951057 -0.587785
-0.951057 -0.998027
-0.951057 -0.481754
-0.951057 0.481754
-0.951057 0.998027
-0.951057 0.587785
-0.951057 -0.368125
-0.951057 -0.982287
-0.951057 -0.684547
-0.951057 0.248690


and then it says:
terminate called after throwing an instance of 'RtError'
Aborted


i see the answer to the question i asked now..
but how can RtError occur there?

Last edited by kijjaz on Wed Sep 06, 2006 1:33 am; edited 2 times in total
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: Wed Sep 06, 2006 12:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Never mind, we have a bug on the board with representing code, I'm sure that last paragraph was right but the board mucks it up, something to do with triniangular brackets. I'm going to report this to Mosc.

This realy sucks.

_________________
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: Wed Sep 06, 2006 1:35 am    Post subject: Reply with quote  Mark this post and the followings unread

ahh.. sorry i didn't checked it yesterday.
i've corrected the code.
i just forgot to check [ ] Disable HTML in this post
sometimes < > in the code make it confused with html tags.
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: Wed Sep 06, 2006 2:47 am    Post subject: Reply with quote  Mark this post and the followings unread

Wait! That's it!

I thought the [] was to *enable* HTML. My bad.

Ok, I'll post this to the intro post and switch it in my settings.

thanks!

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [12 Posts]
View unread posts
View new posts in the last week
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


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