| Author |
Message |
yoshima

Joined: Nov 28, 2009 Posts: 15 Location: UK
|
Posted: Sat Nov 28, 2009 7:42 pm Post subject:
Basic Questions Subject description: MAUI elements and FM synthesis |
 |
|
Hello,
I'm new to chuck, only been trying to use it for the past couple of days so please excuse me if these are stupid questions.
I'm trying to create FM synthesis type signals using the MAUI interface to control the carrier and modulating signal. I've tried using the code found in the ChucK examples folder but I seem to have hit a dead end.
All that happens is the carrier signal remains constant and the modulating signal sounds weird. At least the gain works.
This is what I got so far....
| Code: | MAUI_View control_view;
control_view.size( 200, 200 );
"FM Synthesiser" => control_view.name;
// Carrier
MAUI_Slider freq1changer;
"Osc A Carrier" => freq1changer.name;
freq1changer.range( 30.0, 1000.0 );
100 => freq1changer.value;
freq1changer.size( 200, freq1changer.height() );
freq1changer.position( 0, 0 );
control_view.addElement( freq1changer );
// Gain
MAUI_Slider gainchanger1;
"Gain A" => gainchanger1.name;
gainchanger1.range( 0.0, 1.0 );
0.7 => gainchanger1.value;
gainchanger1.size( 200, gainchanger1.height() );
gainchanger1.position( 0, 100 );
control_view.addElement( gainchanger1 );
// Modulator
MAUI_Slider modchanger1;
"Osc A Modulation" => modchanger1.name;
modchanger1.range(0,8000);
0 => modchanger1.value;
modchanger1.size (200, modchanger1.height());
modchanger1.position(0,50);
control_view.addElement(modchanger1);
control_view.display();
SinOsc s1 => dac;
SinOsc m1 => blackhole;
freq1changer.value() => float sf;
modchanger1.value() => float mf => m1.freq;
300=> float index;
while(true){
freq1changer.value() => s1.freq;
gainchanger1.value() => s1.gain;
modchanger1.value() => m1.freq;
sf + (index * m1.last()) => s1.freq;
1::samp => now;
} |
It all seems to go wrong at the end somewhere....
Any help would be much appreciated.
Also i'm struggling with the concept of what "float" means. I've read through the manual but I can't find an explanation I understand. Any help with this would also be really great.
Thankyou. |
|
|
Back to top
|
|
 |
Inventor
Stream Operator

Joined: Oct 13, 2007 Posts: 6221 Location: near Austin, Tx, USA
Audio files: 270
|
Posted: Sat Nov 28, 2009 9:30 pm Post subject:
|
 |
|
I don't know for sure, but I think part of the problem may be that you are adjusting the MAUI slider values every sample. It's dangerous to spin on a sample like that as it gives ChucK way too much work to do.
Better to spork a shred watching each slider. In your shred function, first update the parameter with the default value, then loop forever with while (true) {}. Inside that while loop ChucK the control to now, then adjust the value. Here's an example (untested):
| Code: | fun void watch_freq() {
freq.value() => osc.freq;
while (true) {
freq => now;
freq.value() => osc.freq;
}
}
spork ~ watch_freq(); |
Try that for all three sliders, and spin on second => now, that should help.
Les
p.s. a float is just a floating point number _________________ "Let's make noise for peace." - Kijjaz |
|
|
Back to top
|
|
 |
yoshima

Joined: Nov 28, 2009 Posts: 15 Location: UK
|
Posted: Tue Dec 01, 2009 8:04 pm Post subject:
|
 |
|
I couldn't get it to work yet... I think I have to go back to the manual and brush up on the basics a bit more...
Thanks for the help.  |
|
|
Back to top
|
|
 |
|