electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks GalleryGallery 
 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 can i keep this from clipping?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
wppk



Joined: Jan 25, 2008
Posts: 31
Location: Los Angeles

PostPosted: Tue Mar 18, 2008 12:33 pm    Post subject: How can i keep this from clipping? Reply with quote  Mark this post and the followings unread

Crying or Very sad it seems that everytime 1000::ms passes it sums the new pass to the old and therefore it eventually clips. Any idea how to prevent this?

[code]fun void solarwind() {

while(true){
BPF b => HalfRect r => LPF l2 => JCRev rev => Dyno limiter => dac;
Noise n2 => b;
//tried overall gain
1.0 => dac.gain;
n2.gain(.1);
//tried limiter but not sure exactly how to set this one
limiter.gain(.95);
//what argument type is used for .limit
limiter.limit();
rev.mix(.1);
b.Q(10);
b.freq(5000);
l2.freq(Std.rand2(500,100));
l2.Q(Std.rand2(50,1000));
1000::ms => now;
}
}

spork ~ solarwind();
while(true){100::ms => now;}
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 452
Location: bangkok, thailand
Audio files: 2

PostPosted: Tue Mar 18, 2008 6:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

I've tried messing around with the patch..
but I suspected that the thing that causes this clipping character..
are those Qs in BPF and LPF -_-"

How about trying other kinds of more basic filters and see?
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
wppk



Joined: Jan 25, 2008
Posts: 31
Location: Los Angeles

PostPosted: Tue Mar 18, 2008 9:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

I'm not so sure. it seems that even without the Qs the loop just keeps getting louder every time 1000::ms passes. It's kind of like feedback. I'm baffled.
Thanks for having a look Kijjaz. By the way, what type of argument does the .limit member take? doesn't seem to like float or int.
Back to top
View user's profile Send private message
kijjaz



Joined: Sep 20, 2004
Posts: 452
Location: bangkok, thailand
Audio files: 2

PostPosted: Tue Mar 18, 2008 9:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

liimt() is just a function to load a preset.
it sets various values.. see http://chuck.cs.princeton.edu/doc/program/ugen_full.html#Dyno

HEY...! ..

I thought HalfRect is always absolute, and the value of l2 might be building up..
hmmm.. but it didn't.

ok let me see more...

ahh...

OH!
HEY...
Hahhahahha oooohhhhh oh..... I know -_-"

You see the BPF b => HalfRect r => LPF l2 => JCRev rev => Dyno limiter => dac; and also the Noise?
that's in the while loop..
so every time it run in there,
there's a brand new instant of that whole row of UGens.
So those all adds up to DAC.
also all the values of the limiters are added to dac, so the values are added up.

here's a fix i made:

Code:
fun void solarwind() {
Noise n2 => BPF b => HalfRect r => LPF l2 => JCRev rev => Dyno limiter => dac;   
    //tried overall gain
    1.0 => dac.gain;
    n2.gain(.1);
    //tried limiter but not sure exactly how to set this one
    limiter.gain(.95);
    //what argument type is used for .limit
    limiter.limit();
    rev.mix(0.5);
    b.Q(10);
    b.freq(5000);

while(true){
   
    l2.freq(Std.rand2(500,100));
    l2.Q(Std.rand2(50,1000));
    1000::ms => now;
    }
}

spork ~ solarwind();
while(true){100::ms => now;}


Another example: (very psychedelic indeed)

Code:
Dyno limiter => dac;
limiter.limit();
limiter.thresh(.8);
limiter.ratio(10000);

while(true)
{
    // new SinOsc instants will build up in memory each time this is run.
    SinOsc s => limiter;
    .2 => s.gain;
    Std.rand2f(0, 127) => Std.mtof => s.freq;
    500::ms => now;
}


warning!! not good for memory! hahahh -_-
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: 6247
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Mar 19, 2008 2:46 am    Post subject: Reply with quote  Mark this post and the followings unread

I think you may need it move the definitions of the Ugens out of the "while" loop (so above it). I think that right now it keeps re-defining Ugens.
_________________
while(!machine.crash() ) <<<"all is well">>>;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 929
Location: Sweden
Audio files: 6
G2 patch files: 48

PostPosted: Wed Mar 19, 2008 9:26 am    Post subject: Reply with quote  Mark this post and the followings unread

Wait a minute! That means that code like this:

Code:
1 => int tjohej;
while (tjohej) {
        SinOsc s => dac;
        1::second => now;
        0 => tjohej;
}
while(true) {
        1::second => now;
}


will leave a tone ringing with no possibility to turn it off, right? Hmm...

/Stefan

_________________
You are Wendy Mackaye, first girl on the red planet.
Back to top
View user's profile Send private message Visit poster's website
wppk



Joined: Jan 25, 2008
Posts: 31
Location: Los Angeles

PostPosted: Thu Mar 20, 2008 9:23 am    Post subject: Reply with quote  Mark this post and the followings unread

Right. Duh. Thanks Guys.
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


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

PostPosted: Fri Mar 21, 2008 5:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:
Wait a minute! That means that code like this:

will leave a tone ringing with no possibility to turn it off, right? Hmm...


Kinda.

If you feel the urgent need you can in fact shoot yourself in the foot.

Still, I think the tone will stop if you exit the shred so I don't think it's a really big deal.

_________________
while(!machine.crash() ) <<<"all is well">>>;
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 [8 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

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, 2004, 2005, 2006 and 2007 by electro-music.com