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
genX and coeffs array
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
jirko



Joined: Dec 15, 2009
Posts: 59

PostPosted: Thu Apr 22, 2010 2:36 am    Post subject: genX and coeffs array Reply with quote  Mark this post and the followings unread

I'm experimenting a little bit with the sinusoidal lookup table and I'm trying to move a position in the array by a random function.

the array:

g10.coefs( [1., 100., 10., 1., 5.5, .3, .2,0.5,0.99,55.0] );

and I'm using:

Std.rand2f(0.1,1.0)=>g10.coefs[1];

to randomize the first position of the array..

but I get this error in the monitor:

array subscripts (1) exceeds defined dimension (0)

any suggestion?

thanks!
Back to top
View user's profile Send private message
vrachnasormora



Joined: Mar 22, 2007
Posts: 42
Location: Preveza,Greece

PostPosted: Thu Apr 22, 2010 5:08 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi jirko, the Gen10.coefs method seems to expect an array as its argument while in the randomization line you treat like one.So you can do it this way:

Code:
Phasor drive => Gen10 g10 => dac;

drive.freq(440.);

[1., 100., 10., 1., 5.5, .3, .2,0.5,0.99,55.0] @=> float my_coefs[];

while ( true )
{
    Std.rand2f( 0.1, 1.0 ) => my_coefs[0];
    g10.coefs( my_coefs );
   
    100::ms => now; //or your update rate here
}
Back to top
View user's profile Send private message
jirko



Joined: Dec 15, 2009
Posts: 59

PostPosted: Thu Apr 22, 2010 5:25 am    Post subject: Reply with quote  Mark this post and the followings unread

OK I get it.
Thanks a lot!
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
Niio1

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