electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
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 

click on image to sign up

 Forum index » DIY Hardware and Software » ChucK programming language
Basic Questions
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
yoshima



Joined: Nov 28, 2009
Posts: 15
Location: UK

PostPosted: Sat Nov 28, 2009 7:42 pm    Post subject: Basic Questions
Subject description: MAUI elements and FM synthesis
Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Inventor
Stream Operator


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

PostPosted: Sat Nov 28, 2009 9:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail
yoshima



Joined: Nov 28, 2009
Posts: 15
Location: UK

PostPosted: Tue Dec 01, 2009 8:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

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. thumleft
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 [3 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
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org