Author |
Message |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Sun Sep 14, 2008 6:43 am Post subject:
|
 |
|
Code: | // Start the Party!
Step s => dac; float x; while(samp=>now) (now/3::ms)%3-x => x => s.next; |
|
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Sep 14, 2008 2:26 pm Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Sun Sep 14, 2008 4:13 pm Post subject:
|
 |
|
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
|
|
 |
Underwaterbob
Joined: Sep 03, 2008 Posts: 26 Location: Chungju, South Korea
|
Posted: Mon Sep 15, 2008 9:34 am Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Mon Sep 15, 2008 2:52 pm Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Mon Sep 15, 2008 3:07 pm Post subject:
|
 |
|
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
|
|
 |
Underwaterbob
Joined: Sep 03, 2008 Posts: 26 Location: Chungju, South Korea
|
Posted: Tue Sep 16, 2008 6:30 am Post subject:
|
 |
|
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
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Sep 16, 2008 8:08 am Post subject:
|
 |
|
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
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Tue Sep 16, 2008 11:06 am Post subject:
|
 |
|
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
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Sep 16, 2008 11:20 am Post subject:
|
 |
|
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
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Sep 16, 2008 11:22 am Post subject:
|
 |
|
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
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Tue Sep 16, 2008 11:25 am Post subject:
|
 |
|
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
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Sep 16, 2008 12:34 pm Post subject:
|
 |
|
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
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Tue Sep 16, 2008 12:41 pm Post subject:
|
 |
|
Got it;
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
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24391 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Tue Sep 16, 2008 12:48 pm Post subject:
|
 |
|
Why not just write 4.0/x instead of 1/(x/4.0) ? _________________ Jan
also .. could someone please turn down the thermostat a bit.
 |
|
Back to top
|
|
 |
Antimon
Joined: Jan 18, 2005 Posts: 4145 Location: Sweden
Audio files: 371
G2 patch files: 100
|
Posted: Tue Sep 16, 2008 2:02 pm Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Tue Sep 16, 2008 9:23 pm Post subject:
|
 |
|
ho..! Wow Nice.. |
|
Back to top
|
|
 |
Underwaterbob
Joined: Sep 03, 2008 Posts: 26 Location: Chungju, South Korea
|
Posted: Wed Sep 17, 2008 12:01 am Post subject:
|
 |
|
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
|
|
 |
blue hell
Site Admin

Joined: Apr 03, 2004 Posts: 24391 Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320
|
Posted: Wed Sep 17, 2008 6:10 am Post subject:
|
 |
|
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.
 |
|
Back to top
|
|
 |
Underwaterbob
Joined: Sep 03, 2008 Posts: 26 Location: Chungju, South Korea
|
Posted: Thu Sep 18, 2008 10:03 pm Post subject:
|
 |
|
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
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Fri Sep 19, 2008 6:07 pm Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Tue Sep 23, 2008 3:47 pm Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Tue Sep 23, 2008 4:06 pm Post subject:
|
 |
|
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
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 267
|
Posted: Wed Sep 24, 2008 4:55 am Post subject:
|
 |
|
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
|
|
 |
kijjaz

Joined: Sep 20, 2004 Posts: 765 Location: bangkok, thailand
Audio files: 4
|
Posted: Wed Sep 24, 2008 5:15 am Post subject:
|
 |
|
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
|
|
 |
|