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
Codes doesn't work: object scoping / no sound plays
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [1 Post]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
makeitgofaster



Joined: Today
Posts: 1
Location: Saint Paul, MN

PostPosted: Today, at 5:21 am    Post subject: Codes doesn't work: object scoping / no sound plays Reply with quote  Mark this post and the followings unread

Hiya!

I'm new here and trying to figure out how to get going on this CHucK stuff.
I have the code below, which does not play any sound. Essentially, I'm trying to build a class to represent an arbitrary listing of notes to be played as a chord.
Two questions:
1) In test_play, I'm throwing an oscillator declared in the while loop to DAC. When I wait outside the loop, those are still "thrown to DAC" and don't magically disappear because I'm out of scope of the loop, right?
2) Other code examples I can run are making sound... why isn't this working?

Code:
public class ratiochord
{
 10 => int rcl;
 float chordarray[rcl];
 1 => chordarray[0];
 for( 1 => int i; i <rcl> chordarray[i];
 
 fun void addnote (float note)
 {
     for( 0 => int i; i <rcl> chordarray[i];   
                 break;
             }
     }
 }
 
 fun void addnotes(float note[])
 {
     for(0 => int i; i <note> int i;
     while(i <rcl> dac;
      chordarray[i] => s.sfreq;

      <<<"adding " + chordarray[i]>>>;
      i++;   
     }
     notedur => now;
     <<<"done">>>;
 }
 
}

ratiochord rc;
rc.addnote(1.5);
rc.test_play(2::second);

//[chuck](VM): sporking incoming shred: 1 (ratiochord)...
//"adding 1.0000" : (string)
//"adding 1.5000" : (string)
//"done" : (string)

ratiochord rc2;
rc2.addnotes([1.5,1.75]);
rc2.test_play(2::second);

// outputs:
//"adding 1.0000" : (string)
//"adding 1.5000" : (string)
//"adding 1.7500" : (string)
//"done" : (string)

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 [1 Post]
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