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
Kijjaz's Thunder
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [22 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Inventor
Stream Operator


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

PostPosted: Sat Sep 20, 2008 3:15 am    Post subject: Kijjaz's Thunder
Subject description: Make my guitar play a thunderstorm!
Reply with quote  Mark this post and the followings unread

Haha, got your attention with that one kijjaz? Here is a class that you wrote for use in my Guitar Lab (now ChucK Lab) program:

Code:
// An attempt at thunder fro kijjaz, modified by myself somewhat
class kjz_thunder {
    // Main sound source
    Noise s1 => LPF f1 => Gain env1 => SinOsc overdrive1 => LPF f1_1 => NRev rev1 => Gain go;
    f1.set(160, .5);
    f1_1.set(120, .5);
    3 => env1.op;
    1 => overdrive1.sync;
    .1 => rev1.mix;
    .3 => rev1.gain;
   
    // Amp envelope
    Impulse i2 => Gain g2_1 => Gain g2_1_fb => g2_1 => Gain g2_2 => Gain g2_2_fb => g2_2 => LPF f2 => env1;
    f2.set(3, 1);
    .992 => g2_1_fb.gain => g2_2_fb.gain;
    80 => f2.gain;
}



I am posting because I have been having an awesome time creating ChucK programs that perform guitar effects. Not just any effects, but effects that work in response to the accelerometer-based guitar motion sensor that I'm helping to develop.

So long story short, I'd like to find a way to combine the guitar's signal sent on the line-in jack (adc input in ChucK) with the motion sensor (joystick HID input in ChucK) such that it produces a thunderstorm effect.

This could involve assigning the X, Y, and Z axes of the sensor to three parameters of kijjaz's thunder and then sending the guitar signal into the thunder, or some other mind-blowing fantasia like that.

So I'm asking for ideas, especially from the thunderstorm feedback master himself, kijjaz, about how to do this. Probably I should not be so dang lazy and get off my butt and study how kijjaz's thunder actually works, too, shouldn't I? OK, I will go do that as well.

Ideas and suggestions are welcome from all, thanks.

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


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

PostPosted: Sat Sep 20, 2008 5:17 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, I studied it in detail and here is a ChucKian block diagram of Kijjaz'a Thunder:


kjz_thunder.jpg
 Description:
Kijjaz's Thunder
 Filesize:  41.78 KB
 Viewed:  170 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

kjz_thunder.jpg



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


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

PostPosted: Sat Sep 20, 2008 10:32 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, I've figured out from the diagram that the filtered noise source on the upper left is the actual thunder sound reference, the impulse on the lower left is what actually triggers the thunder, and the two feedback loops on the bottom chain somehow shape the envelope of the thunder. Further, the SinOsc handles large multiplication results of the env1 Gain stage and the NRev makes the thunder echo and roll.

What I haven't figured out is how to make the thing respond to a guitar waveform. I suppose the first thing to try might be to inject the guitar into the two feedback blocks in place of the impulse source. Then perhaps I can modulate the feedback gains with the accelerometer data. I dunno, just thinking out loud and hoping for suggestions. Maybe I should just try it, eh?

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


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

PostPosted: Sat Sep 20, 2008 10:58 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, I tried it and it works very well. The attached mp3 file is a sample of me playing my guitar into the patch. First I play an E chord, then some of the Major C scale in the key of G, then finally an open chord. I put the accelerometer control into the mix parameter of the NRev and on that last open chord I wiggled the guitar a bit, creating a rolling thunder sound.

Oh, and I used 10::ms delays in the feedback loops.

What do you think of the audio sample?

Now I think I need some rain!


GMS_thunder1.mp3
 Description:
Stratocaster Thunder, wow it works! (38 seconds)

Download
 Filename:  GMS_thunder1.mp3
 Filesize:  586.94 KB
 Downloaded:  370 Time(s)


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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sat Sep 20, 2008 12:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

That is pretty awesome. Kijjaz seems pretty good at creating crazy sounds from networked UGens.
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: Sat Sep 20, 2008 1:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

rogan wrote:
That is pretty awesome. Kijjaz seems pretty good at creating crazy sounds from networked UGens.


Thanks rogan. Yeah, I'm impressed with kijjaz's abilities. I also enjoy seeing the various accomplishments of other ChucKists. Different programmers show their abilities in different ways.

I added wppk's binaural rain and put in some filters to shape the sound, plus I played around with various patch paramters and also added an X^2 function to the thunder input. The result is pretty good, audio file and source code attached.


GMS_thunder2.mp3
 Description:
Better Thunder Plus Rain

Download
 Filename:  GMS_thunder2.mp3
 Filesize:  717.55 KB
 Downloaded:  357 Time(s)


Thunder1.ck
 Description:
Thunderstorm source code

Download
 Filename:  Thunder1.ck
 Filesize:  4.74 KB
 Downloaded:  146 Time(s)


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

thank you all for developing more. i'm very happy to see all our ideas combined.
this is real community power.
and let me say it again: "let's make noise for peace"

hmm.. i'm no master, but there are already many masters around here.
i'm just... crazy -_-

Inventor, i'm very interested in applying the accelerometer.
how does it sense and transmit into ChucK?
are they treated as analog signal fed into the audio interface?

i haven't seen the thunder idea quite a long time ago.
the two Gain feedback system there is interesting.
it produces some kind of a rise-then-fall something-exponential value.
i hope that'd be a nice envelope.

i'll have to build intruments to perform very soon.
(hopefully by combining outside input / control and working with ChucK or maybe PureData)
this thread is inspiring.
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: Sat Sep 20, 2008 4:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

to celebrate (before going to bed)
i've made this patch for fun after reading this thread,
so i guess i'll have to give it to this thread heheeh.

Code:
/*
    chuck code: kijjaz - Electric Pump and a hot Frying Pan
     This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    see: http://www.gnu.org/licenses/
*/
SinOsc s1 => ZeroX s_zx => Gain g => Gain g_fb => g => Gain master => dac;
SinOsc s2 => s_zx;
Noise n => s_zx;
55.1 => s2.freq;
.05 => n.gain;
1.0 - 3000/(second/samp) => g_fb.gain;
.8 => master.gain;
day => now;
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 Sep 20, 2008 4:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:
and let me say it again: "let's make noise for peace"


Word.

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


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

PostPosted: Sat Sep 20, 2008 5:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:
Inventor, i'm very interested in applying the accelerometer.
how does it sense and transmit into ChucK?
are they treated as analog signal fed into the audio interface?


Hi kijjaz, glad you like the thread. I've been wanting to play a thunderstorm on my guitar for a long time and now I can!

The sensor is currently entering production and should be available soon at a reasonable price from www.ultimarc.com. It looks just like a joystick except that the three axis readings are acceleration values instead of stick position values. If you take a look at the previously posted code you will see how easy it is to interface to it.

The miniature circuit board also contains an expansion interface header for attaching buttons, switches, or potentiometers. You can also do analog or digital input at slow rates.

What happened was that I wanted to create a guitar motion sensor so I designed one and it occurred to me that the company providing the USB interface was optimally positioned to add such a device to their product line. I sent an email to them suggesting that they consider creating the product and much to my surprise they were excited about the idea. So I've been working with Ultimarc for about six weeks now and the product is almost ready for sale. You can read all about the project and it's history on my Guitar Motion Sensor web page which is here:

http://www.freedomodds.com/music/gms.html

The sensor will be sold as a computer gaming controller, but it can be used on any musical instrument or just by itself, and it plays nice with ChucK. I am so excited about the project that I am planning to do other projects like it in the future, either with Ultimarc or by myself or possibly in collaboration with other electro-music.com members.

I'm having a good time with this stuff. Thanks for the thunder!

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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sat Sep 20, 2008 5:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

Kassen wrote:
Quote:

kijjaz wrote:
Quote:
and let me say it again: "let's make noise for peace"

Word.


I'll third that.

...

I really liked the sound of the "grease" in the "frying pan." Is there any way to isolate it? I've tried throwing a HPF in the works, but it only dims the "Electric Pump."

Code:

SinOsc s1 => ZeroX s_zx => Gain g => Gain g_fb => g => Gain master => HPF hpf => dac;
8000 => hpf.freq;
SinOsc s2 => s_zx;
Noise n => s_zx;
55.1 => s2.freq;
.05 => n.gain;
1.0 - 3000/(second/samp) => g_fb.gain;
.8 => master.gain;
day => now;


Thoughts? I've been trying to find good ways of making nice crackling sounds.
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 Sep 20, 2008 9:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor,
wow! that's exciting.
can't wait to hear the news of the Guitar Motion Sensor.
i'd like to have one soon.

rogan,
Code:
Noise n => LPF f => ZeroX zx => Gain master => dac;
500 => f.freq; // adjust this to adjust grease density
.5 => f.Q; // if this is huge, the pitch of grease will be closer to f.freq()
.5 => master.gain;
day => now;


this is closest to that grease for now -_-.
i'll work more on this.

maybe some envelope can help do something.
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 Sep 20, 2008 9:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

rogan, I tried but got nowhere with the grease.

Attached is another contribution to the thread, based on the theme of guitars and kijjaz's work. It is a modified version of kijjaz's guitar class combined with an efficient coding of my Boolean Sequencer. It generates a new set of random logic terms every time the binary counter rolls over. I used bitwise operators to generate and evaluate the logic expression which resulted in a very simple coding of the sequencer.

With this technique, every song is different yet the songs sound pretty good for randomly generated music. There appears to be some kind of musical quality to the Boolean Sequenced logic expressions even when they are randomly generated.


strat1.ck
 Description:
Guitar Song Generator

Download
 Filename:  strat1.ck
 Filesize:  1.53 KB
 Downloaded:  159 Time(s)


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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sat Sep 20, 2008 10:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi Inventor -- no prob. I'll figure out someday how to get the perfect click. Smile For now, I've run Kijjaz's code through some reverb to create a noisy space.

I'm not super happy with my reverb, but it's in the right direction.

My goal is basically to have some sort of nice, random clicking passed through a good reverb to create a noisy space. I want to be able to have events modulate the noisiness. For example, if I were using a drum machine, a bass drum hit would increase the noise floor, and it would gradually decay to the background level, so that the drum hit causes a shower of noise.

Hmm. I'm having trouble recording this correctly, so I think it's my bedtime. Maybe I'll post an mp3 later?


Allpass.ck
 Description:
Allpass class

Download
 Filename:  Allpass.ck
 Filesize:  1.19 KB
 Downloaded:  127 Time(s)


Gardner_LargeRoom.ck
 Description:
"large" reverb space

Download
 Filename:  Gardner_LargeRoom.ck
 Filesize:  1.96 KB
 Downloaded:  177 Time(s)


Gardner_MediumRoom.ck
 Description:
"medium" reverb space

Download
 Filename:  Gardner_MediumRoom.ck
 Filesize:  1.93 KB
 Downloaded:  148 Time(s)


Kijjaz Clicks through My Reverb.ck
 Description:
The master code.

Download
 Filename:  Kijjaz Clicks through My Reverb.ck
 Filesize:  1.46 KB
 Downloaded:  168 Time(s)

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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sat Sep 20, 2008 10:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Inventor -- I like this. It's pretty rad. It definitely gives the guitar a huge space.
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: Sun Sep 21, 2008 5:10 am    Post subject: Reply with quote  Mark this post and the followings unread

rogan wrote:
My goal is basically to have some sort of nice, random clicking passed through a good reverb to create a noisy space. I want to be able to have events modulate the noisiness. For example, if I were using a drum machine, a bass drum hit would increase the noise floor, and it would gradually decay to the background level, so that the drum hit causes a shower of noise.


rogan, glad you liked the guitar file. As to the events modulating the noisiness that you would like to create, perhaps kijjaz's thunder model will do the job. If you examine the block diagram and look at the code I posted earlier in this thread (The thunderstorm code), you will see that the basic structure of the thunder works in the same way.

The inputs are noise and impulse for thunder itself. I modified the feedback loops to have delays in them and that way they responded to the guitar's analog output signal. In your case you would take my modification and apply your clicks or whatever in place of the noise, then apply the drums or other events to the guitar input.

The way it works is that the delayed feedback sustains and echoes the control input, then the output of that multiplies the desired audio source. I hope that all made sense, anyway study it and you'll get the idea.

Also, I looked at your files, my compliments on writing such well structured OOP code. It is cleaner than my stuff for sure. I would like to hear some mp3 files of the audio. Cheers.

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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sun Sep 21, 2008 8:47 am    Post subject: Reply with quote  Mark this post and the followings unread

I have a little question about feedback. If you look at this patch,

Code:

Impulse i2 => Gain g2_1 => Gain g2_1_fb => g2_1 => Gain g2_2 => Gain g2_2_fb => g2_2 => LPF f2 => env1;


, you see that g_21 and g_22 are being fed back into themselves.

What is the actual response of such a system? By default, the Gain ugen sums, so doesn't this actually just add a gain of >1 with no waveform cancellation?

edit

For example, look at the series
Code:

Gain g => Gain g_fb => g.

To me, the final gain on any input signal should be

(g.gain * g_fb.gain) * g.gain, or (g.gain)^2 * g_fb.gain

assuming that each ugen just gets one evaluation per entry in the series.
Back to top
View user's profile Send private message
kijjaz



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

PostPosted: Sun Sep 21, 2008 10:08 am    Post subject: Reply with quote  Mark this post and the followings unread

Is this kind of feedback in ChucK,
the result that is fed as feedback into a UGen is delayed by 1 sample.

let's look at a simplest example:
Gain g => g;
this means "add g's result to g for the next sample"

so let's try this
Code:
Gain g => g; // connect Gain g to g
g => blackhole; // force g to calculate

// in this condition, g will always stay 0
Impulse i => g; // prepare to feed impulse into g
Report();
1 => i.next; // this will cause i to be 1 for only 1 sample

samp => now;
Report();
.5 => i.next;
samp => now;
Report();
-2 => i.next;
samp => now;
Report();

ms => now;
Report();

fun void Report()
{       
    <<< "i.last() = ", i.last() >>>;
    <<< "g.last() = ", g.last() >>>;
}


so with this simplest form, g=>g adds anything to its system.
and the value stays if nothing is fed into it.

let's look at one way to put this to a good use: using this as a summation tool
(everything fed into g will be summed)

Code:
Gain g => g => blackhole;

SinOsc s => g;
.5 => s.freq;

second => now;

<<< "g.last() = ", g.last() >>>;
<<< "g.last() / sample rate = ", g.last() / (second/samp) >>>;

after 1 second, for each sample, s's result will be added to g
so if we divide it with sample rate, you'll have an integrator.
- - -

but if we set this up instead:
Gain g => Gain g_fb => g;

and we set g_fb 's gain, g value can grow or decay with g_fb's rate:

Code:
Impulse i => Gain g => Gain g_fb => g => blackhole;
.5 => g_fb.gain;

64 => i.next;
samp => now;

Report();

second => now; // make it decay till almost 0
<<< "- - -", "" >>>;

2 => g_fb.gain;
1 => i.next;
samp => now;

Report();

<<< "- - -", "" >>>;

0 => g_fb.gain; // make g falls to 0
samp => now;

-1 => g_fb.gain;
1 => i.next;
samp => now;

Report();

fun void Report()
{
        for(int i; i < 10; i++)
    {
        <<< "i = ", i, " g.last() = ", g.last() >>>;
        samp => now;
    }
}
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: Sun Sep 21, 2008 10:11 am    Post subject: Reply with quote  Mark this post and the followings unread

rogan, In this case there is a subtle difference: the time delay. Each gain block delays by one sample if I understand it correctly. The input is an impulse which has a duration of one sample, then two samples later it gets reapplied with a gain of less than one, and so on creating an exponential decay.

For use with the guitar's input signal which is not an impulse, I used an actual delay line inside of each feedback loop. That is what you would need to do for use with drum input or whatever. Well, that or use a ZeroX at the input.

Note also that my feedback loops are chained together in series while kijjaz's are tapped at the input node, a subtle difference.

Although I could easily be dazed and confused, I believe all of the above is correct. Enjoy!

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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Sun Sep 21, 2008 11:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Ah, that's some cool stuff. Thanks, guys!
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 Sep 22, 2008 2:50 am    Post subject: Reply with quote  Mark this post and the followings unread

This is me jamming with the Thunder2.ck file and my Strat. My guitar playing may suck, but when ChucK-enhanced it's not too bad. Jam on it!


GMS_thunder3.mp3
 Description:
Thunder Jam

Download
 Filename:  GMS_thunder3.mp3
 Filesize:  862.45 KB
 Downloaded:  367 Time(s)


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



Joined: Dec 16, 2007
Posts: 83
Location: Urbana, IL
Audio files: 5

PostPosted: Mon Sep 22, 2008 10:25 am    Post subject: Reply with quote  Mark this post and the followings unread

I like the effects. It sounds a lot like King Tubby kicking his spring-loaded reverb kit.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [22 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
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