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
One-Line ChucK Crazy
Post new topic   Reply to topic Moderators: Kassen
Page 3 of 5 [121 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3, 4, 5 Next
Author Message
kijjaz



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

PostPosted: Sun Sep 14, 2008 6:43 am    Post subject: Reply with quote  Mark this post and the followings unread

Code:
// Start the Party!
Step s => dac; float x; while(samp=>now) (now/3::ms)%3-x => x => s.next;
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: Sun Sep 14, 2008 2:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nice! I'll have to listen to it again for a longer time later.

It seemed to me that you could drop the "x" and use s.last() instead. For the first few minutes that sounded basically the same to me but it *is* feedback (and introduces a samp of delay) so after a longer time it might get radically different?

_________________
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: Sun Sep 14, 2008 4:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh yes Kassen, it should be reduced much more so we can do some other things also.

Yes this system can get a little bit chaotic.
first, each time we spork it, it sounds a little bit or very different..
second, sometimes we can notice a little chaotic adjustment in the beginning.
changing the numbers really help finding new sounds out of this system.
many quickly come to a stop. many stay active for a very long time or just forever.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Underwaterbob



Joined: Sep 03, 2008
Posts: 26
Location: Chungju, South Korea

PostPosted: Mon Sep 15, 2008 9:34 am    Post subject: Reply with quote  Mark this post and the followings unread

Watch out! It starts off unassuming but gets annoying pretty fast:

Code:

Noise a => BPF f => dac; for(1 => int x; x < 360; x++){ f.set((x%7+1)*Std.fabs(2*Math.sin(x%73*x)+1), 20); 200::ms => now; }


Whatever you do don't turn the volume up in the beginning, it takes about 5 or 6 seconds to get going. Messing with the constants gets some similar and interesting things going:

Code:

Noise a => BPF f => dac; for(1 => int x; x < 360000; x++){ f.set((x%7+1)*Std.fabs(2*Math.sin(x%73*x)+1), 20); 2::ms => now; }


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



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

PostPosted: Mon Sep 15, 2008 2:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

some more simple patches

Code:
// robot scan
Step s => Gain g => g => SinOsc x => dac; while(Std.rand2(1, 100)::ms => now) Std.rand2(-1, 1) => s.next;


Code:
// Woo! .. hey anybody? woo woo!
Phasor a => SinOsc b => SinOsc c => SinOsc d => Gain e => SinOsc f => dac; e.gain(800); day => now;


Code:
// Robotic circle of fifth
SinOsc a => dac; while(125::ms => now) a.freq() * -1.5 => a.freq;


Code:
// Rise of the (cute) machine.
SinOsc a => dac; while(20::ms => now) a.freq() * -1.01 => a.freq;


Code:
// a short 3n+1 melody
SinOsc a => dac; while(40::ms => now) if (a.freq()%2==0) a.freq()/2=> a.freq; else a.freq()*3+1=>a.freq;


Code:
// Analysing...
SinOsc a => dac; while(100::ms => now) if (a.freq()%4==0) a.freq()/4=> a.freq; else a.freq()*6+1=>a.freq;
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
kijjaz



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

PostPosted: Mon Sep 15, 2008 3:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

Code:
// Great String!
Mandolin a => SinOsc b => dac; 1 => b.sync; 4 => a.freq; 1000 => a.gain; a.noteOn(1); day => now;


using Sitar instead of Mandolin is nice also. StifKarp <-- very powerful and majestic.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Underwaterbob



Joined: Sep 03, 2008
Posts: 26
Location: Chungju, South Korea

PostPosted: Tue Sep 16, 2008 6:30 am    Post subject: Reply with quote  Mark this post and the followings unread

This crashes on me and I can't figure out why:

Code:

SinOsc s[400]; for(0 => int x; x<400; x++){ (x+1)*10 => s[x].freq; (1/(x/4)) => s[x].gain; s[x] => dac; 100::ms => now; }


If I remove (1/(x/4)) => s[x].gain; it works, but clips like crazy quickly since it's stacking with so many oscillators.

It's not really what I want anyway. I'd rather a polynomial approximation of the equal loudness curve so each frequency could be weighted to have the same perceived volume.
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: Tue Sep 16, 2008 8:08 am    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:
Code:
// Great String!
Mandolin a => SinOsc b => dac; 1 => b.sync; 4 => a.freq; 1000 => a.gain; a.noteOn(1); day => now;



Extended remix!
Code:

Mandolin a => SinOsc b => dac;

3 => b.sync;
4 => a.freq;
1000 => a.gain;

a.noteOn(1);
while(1)
   {
   4 => a.freq;
   while(maybe || maybe) a.freq() +2 => a.freq;
   Std.rand2(30, 42) * 3 => Std.mtof => b.freq;
   if(maybe && maybe)a.noteOn(1);
   1::second => now;
   }

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



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Tue Sep 16, 2008 11:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Underwaterbob wrote:
This crashes on me and I can't figure out why:

Code:

SinOsc s[400]; for(0 => int x; x<400> s[x].freq; (1/(x/4)) => s[x].gain; s[x] => dac; 100::ms => now; }


If I remove (1/(x/4)) => s[x].gain; it works, but clips like crazy quickly since it's stacking with so many oscillators.

It's not really what I want anyway. I'd rather a polynomial approximation of the equal loudness curve so each frequency could be weighted to have the same perceived volume.


Hmm, I figured it was because you divide by zero when x=0, but it doesn't work if I change the starting value for x to 1, 2 or 3 either. 4 and onwards, it works. Bizarre.

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
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 16, 2008 11:20 am    Post subject: Reply with quote  Mark this post and the followings unread

Underwaterbob wrote:
This crashes on me and I can't figure out why:


Here you go;

SinOsc s[400]; for(0 => int x; x<400; x++){ (x+1)*10 => s[x].freq; (1/(x/4.0)) => s[x].gain; s[x] => dac; 100::ms => now; }

The ".0" turns the division into float math instead of integer math, which avoids a divide by zero caused by rounding to a integer.

example;
Code:

<<< 1 / 3>>>; //yields "0, (int)"
<<< 1 / 3.0>>>;// gives "0.333333 (float)"
[/code]
_________________
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: Tue Sep 16, 2008 11:22 am    Post subject: Reply with quote  Mark this post and the followings unread

Antimon wrote:

Hmm, I figured it was because you divide by zero when x=0, but it doesn't work if I change the starting value for x to 1, 2 or 3 either. 4 and onwards, it works. Bizarre.


Not at all; if you round down then x/4 will be 1 for x=4 and 0 for anything smaller.

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



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Tue Sep 16, 2008 11:25 am    Post subject: Reply with quote  Mark this post and the followings unread

Shouldn't you get a division by zero anyway because of the first zero (tried it, you don't)? I know that you can't rely on integers converting to exact floats, but zero should surely always be zero?

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
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 16, 2008 12:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

Erm, you are right!

So we now have a issue where we think the VM *should* crash, yet it doesn't! That's a new sort of thing for ChucK! Ok, this is really weird, let me try some stuff.

_________________
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: Tue Sep 16, 2008 12:41 pm    Post subject: Reply with quote  Mark this post and the followings unread

Got it;
Code:

<<<1.0 / 0.0>>>;


divide by zero in integer math crashes yet in floating point math it's "inf".

I'd say that would explain the clipping :¬)

Here is a version of the whole thing, reformatted for readability and with debugging print commands, I also turned down the amount of oscillators as we don't need that many for debugging;

Code:
SinOsc s[4];

for(0 => int x; x<4; x++)
   {
   (x+1)*10 => s[x].freq;
   <<<"x is", x>>>;
   <<<"(x/4.0) is", (x/4.0)>>>;
   <<<"(1/(x/4.0)) is", (1/(x/4.0))>>>;
   (1/(x/4.0)) => s[x].gain;
   s[x] => dac;
   100::ms => now;
   }

_________________
Kassen
Back to top
View user's profile Send private message Send e-mail Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Tue Sep 16, 2008 12:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Why not just write 4.0/x instead of 1/(x/4.0) ?
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Tue Sep 16, 2008 2:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ah yes, the IEEE standard allows for those mysterious numbers in floats. Another case solved!

Here's another one-liner:

Code:
0.0 => float x; x/x => float y; <<< "y=",y>>>;


That produces "y= nan" (not a number).

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
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 16, 2008 9:23 pm    Post subject: Reply with quote  Mark this post and the followings unread

ho..! Wow Nice..
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Underwaterbob



Joined: Sep 03, 2008
Posts: 26
Location: Chungju, South Korea

PostPosted: Wed Sep 17, 2008 12:01 am    Post subject: Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
Why not just write 4.0/x instead of 1/(x/4.0) ?


It was the way I approached it. Initially it was just 1/x but I thought the gain would scale down too quickly, so I slowed down the rate of change by dividing x by 4. I didn't even realize until now that that will also make the first value greater than 1... I'm out of math practice.

I'm not surprised I missed dividing by zero.
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24079
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Sep 17, 2008 6:10 am    Post subject: Reply with quote  Mark this post and the followings unread

Underwaterbob wrote:
It was the way I approached it.


Ok, a good optimizing compiler would optimize it out for you probably - don't know if ChucK has an optimizer though.

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Underwaterbob



Joined: Sep 03, 2008
Posts: 26
Location: Chungju, South Korea

PostPosted: Thu Sep 18, 2008 10:03 pm    Post subject: Reply with quote  Mark this post and the followings unread

Macro FM synthesis:

Code:
SqrOsc s => dac; 0 => int x; while(200::ms => now){ 500+(440*Math.sin(x*3*Math.sin(x/4.0))) => s.freq; x++; }


Almost sounds like a melody sometimes.
Back to top
View user's profile Send private message
Inventor
Stream Operator


Joined: Oct 13, 2007
Posts: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Fri Sep 19, 2008 6:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

ChucK studies Shakespeare...

Code:
// to be or not to be, that is the computation
for (int B; B < 2; B++) if (2*B | !(2*B) == true) <<<"to be">>>; else <<<"not to be">>>;


It doesn't make any sound, but optimistically, the answer is "to be" for all values of B. Hmmmm!

_________________
"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: Tue Sep 23, 2008 3:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

new mini-projects:
(1) creating a drum set. each drum piece are constructed with only one line patch
(only the way to generate sound, doesn't need to trigger)

(2) creative a whole drum set with only one line patch..

ahh is this (2) possible -_-" ??
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
kijjaz



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

PostPosted: Tue Sep 23, 2008 4:06 pm    Post subject: Reply with quote  Mark this post and the followings unread

easy electro set:

// bass drum (use velocity number => trig.next to trigger)
Impulse trig => LPF tone => SinOsc drive => dac; tone.set(50, 30); 1 => drive.sync;

// same family:
// clave
Impulse trig => HPF tone => SinOsc drive => dac; tone.set(2000, 100); 1 => drive.sync;
// cleaner clave
Impulse trig => BPF tone => SinOsc drive => dac; tone.set(2000, 100); 1 => drive.sync;
// tom tom (set frequency at tone.set(freq, Q)
Impulse trig => LPF tone => SinOsc drive => dac; tone.set(140, 30); 1 => drive.sync;

// cute rim-shot
Impulse trig => LPF tone => TriOsc drive => dac; tone.set(600, 3); 1 => drive.sync;
// crude rim-shot
Impulse trig => LPF tone => SawOsc drive => dac; tone.set(600, 5); 1 => drive.sync;

// GM High-Q-like sound, not nice
Impulse trig => Gain g => g => Gain freq => SinOsc drum => dac; .99 => g.gain; 100 => freq.gain;
// longer High-Q
Impulse trig => Gain g => g => Gain freq => SinOsc drum => dac; .999 => g.gain; 100 => freq.gain;

// electro bass drum, not nice
Impulse trig => Gain g => g => Gain freq => TriOsc drum => dac; .9995 => g.gain; 1 => freq.gain;

// industrial china
Impulse trig => LPF f => NRev rev => SinOsc drive => dac; f.set(6000, 2); 1 => drive.sync;
- - -

now i'm too sleepy. gonna create some more and hopefully advanced sounds tomorrow.
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: 6221
Location: near Austin, Tx, USA
Audio files: 267

PostPosted: Wed Sep 24, 2008 4:55 am    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz, these drum kit one-liners look really cool but they don't run. Can you make a master file that plays them or at least make them work? The code lacks the impulse stim and the time delay. I forgot how to stim an impulse and I'm feeling lazy today, haha. I like the idea of the drum kit a lot!
_________________
"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: Wed Sep 24, 2008 5:15 am    Post subject: Reply with quote  Mark this post and the followings unread

oh just send a number to trig.next;

for example 50 => trig.next; to make it plays.
adjusting the number is like adjusting hit velocity.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 3 of 5 [121 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3, 4, 5 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


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