<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-10264719</id><updated>2011-07-14T14:28:41.901-07:00</updated><title type='text'>Beginning ChucK</title><subtitle type='html'>ChucK is a music programming language (and compiler/synthesizer) written by a professor (Perry Cook) and his students at Princeton University. I'm learning how to use it; I thought that writing about how to use it would help...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://b-chuck.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-10264719.post-113223594243101664</id><published>2005-11-17T05:52:00.000-08:00</published><updated>2005-11-17T06:08:46.120-08:00</updated><title type='text'>No More Comments, Sorry, Too Much Spam</title><content type='html'>Apparently the spammers have effective robots, I've been getting twenty or more spam letters/comments a day...so I've turned commnents off. Sorry, but I'm getting overwhelmed with noise mail...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-113223594243101664?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/113223594243101664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/113223594243101664'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/11/no-more-comments-sorry-too-much-spam.html' title='No More Comments, Sorry, Too Much Spam'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112991868773114074</id><published>2005-10-21T10:30:00.000-07:00</published><updated>2005-10-21T11:18:07.750-07:00</updated><title type='text'>Found a free web space for mp3's</title><content type='html'>Thanks to a link on &lt;i&gt;Penny Arcade&lt;/i&gt;, today I found a site that offers free disk space for mp3's:&lt;br /&gt;&lt;center&gt;&lt;a href="http://putfile.com" target=putfile&gt;&lt;img src=http://putfile.com/images/putfilesmall.gif&gt;&lt;/a&gt;&lt;/center&gt;&lt;br /&gt;The mp3 links (on the right over there) or &lt;a href="http://www.putfile.com/gwms451" target=putfilepage&gt;this page (http://www.putfile.com/gwms451)&lt;/a&gt; let you listen to recordings for some of our chuck examples...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112991868773114074?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112991868773114074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112991868773114074'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/10/found-free-web-space-for-mp3s.html' title='Found a free web space for mp3&apos;s'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112990463072539093</id><published>2005-10-21T07:20:00.000-07:00</published><updated>2005-10-21T07:23:50.733-07:00</updated><title type='text'>[chuck] version 1.2.0.3 released</title><content type='html'>[chuck] version 1.2.0.3 released&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;Dear All,&lt;br /&gt; &lt;br /&gt;chuck-1.2.0.3 (dracula) is now available.&lt;br /&gt; &lt;br /&gt;Once again, we have made some small (but potentially critical) language&lt;br /&gt;and API changes (very sorry).  The experimental 'loop' keyword has been&lt;br /&gt;renamed to 'repeat', std.abs() now deals with int (instead of float)&lt;br /&gt;and std.fabs() uses floats.  Additionally, a sizable bug in&lt;br /&gt;instantiating arrays of null object references have been fixed (we&lt;br /&gt;hope), and /* block comments */ are now supported.  See below for more&lt;br /&gt;details.&lt;br /&gt; &lt;br /&gt;     &lt;a href="http://chuck.cs.princeton.edu/release/" target=chuckreleasse&gt;http://chuck.cs.princeton.edu/release/&lt;/a&gt;&lt;br /&gt;     (may need to reload page to see update)&lt;br /&gt; &lt;br /&gt;Please let us know of any issues, and as always, HappY ChucKing!&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;chuck team&lt;br /&gt; &lt;br /&gt;---&lt;br /&gt;1.2.0.3&lt;br /&gt;   (API changes again)&lt;br /&gt;   (syntax change - 'loop' -&gt; 'repeat')&lt;br /&gt;   - loop( ... ) construct (see 1.2.0.2) changed to repeat( ... )&lt;br /&gt;     - usage and semantics same as before&lt;br /&gt;     - this is also an experimental language feature&lt;br /&gt;       (let us know if it's good or bad)&lt;br /&gt;   - float std.abs( float ) changed -&gt; int std.abs( int )&lt;br /&gt;   - use std.fabs( ... ) for floating point absolute value&lt;br /&gt; &lt;br /&gt;   - (added) \/\* block comments \*\/&lt;br /&gt;     - no nesting allowed&lt;br /&gt;     - closing '\*\/' not necessary if commenting out rest of the file&lt;br /&gt;   - (fixed) arrays of null object references correctly allocated&lt;br /&gt;       : Event @ events[128];&lt;br /&gt;   - (fixed) DEFAULT sndbuf rate now set correctly to interpolate&lt;br /&gt;       for files outside of chuck sample rate (no longer have to&lt;br /&gt;       explicit do 1 =&gt; buf.rate)&lt;br /&gt;   - (fixed) examples/midi/polyfony*.ck no longer creates 128&lt;br /&gt;       unnecessary events...&lt;br /&gt;   - (changed) examples/stk/wurley.ck -&gt; examples/stk/wurley2.ck&lt;br /&gt;   - (changed) examples/stk/wurley.ck (wacky version)&lt;br /&gt; &lt;br /&gt;_______________________________________________&lt;br /&gt;chuck mailing list&lt;br /&gt;chuck@lists.cs.princeton.edu&lt;br /&gt;https://lists.cs.princeton.edu/mailman/listinfo/chuck&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112990463072539093?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112990463072539093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112990463072539093'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/10/chuck-version-1203-released.html' title='[chuck] version 1.2.0.3 released'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112958461331509430</id><published>2005-10-17T14:26:00.000-07:00</published><updated>2005-10-17T14:30:13.326-07:00</updated><title type='text'>[chuck] version 1.2.0.2 released</title><content type='html'>[chuck] version 1.2.0.2 released&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;Dear All,&lt;br /&gt; &lt;br /&gt;chuck-1.2.0.2 (dracula) is now available.  Changes include class and&lt;br /&gt;member functions renaming for OSC objects (see below), stability and&lt;br /&gt;performance improvements for OSC, ability to open multiple OscRecv&lt;br /&gt;objects on a single port, experimental control construct 'loop', events&lt;br /&gt;fire with 0-sample delay instead of 1-sample, new/updated examples, and&lt;br /&gt;many various bug fixes (hopefully).&lt;br /&gt; &lt;br /&gt;     &lt;a href="http://chuck.cs.princeton.edu/release/" target=release&gt;http://chuck.cs.princeton.edu/release/&lt;/a&gt;&lt;br /&gt;     (may need to reload page to see update)&lt;br /&gt; &lt;br /&gt;Please let us know of any issues.&lt;br /&gt; &lt;br /&gt;HappY ChucKing!&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;chuck team&lt;br /&gt; &lt;br /&gt;---&lt;br /&gt;1.2.0.2&lt;blockquote&gt;&lt;br /&gt;   (sorry for the API changes)&lt;br /&gt;   - (API change) OSC_Send class name changed to 'OscSend'&lt;br /&gt;       (also): .startMesg(...) name changed to startMsg(...)&lt;br /&gt;   - (API change) OSC_Recv class name changed to 'OscRecv'&lt;br /&gt;   - (API change) OSC_Addr class name changed to 'OscEvent'&lt;br /&gt;       (also): .hasMesg() name changed to .hasMsg()&lt;br /&gt;       (also): .nextMesg() name changed to .nextMsg()&lt;br /&gt;   - (API change) STK Shakers.freq now expect Hz instead of MIDI number&lt;br /&gt; &lt;br /&gt;   - (moved) examples/event/opensound*.ck moved to examples/osc/OSC*.ck&lt;br /&gt;       (see OSC_send.ck and OSC_recv.ck for examples on OpenSoundControl)&lt;br /&gt;   - (moved) examples/event/polyfony*.ck to examples/midi/&lt;br /&gt; &lt;br /&gt;   - (added) 'loop(...){ }' control structure :&lt;br /&gt;       example: loop( 8 ) { ... } // executes body 8 times&lt;br /&gt;       example: loop( foo ) { ... } // executes body foo times&lt;br /&gt;       (foo is evaluated exactly once entering the loop, the&lt;br /&gt;       value at that time is used as a constant to control&lt;br /&gt;       loop iteration - even if foo is changed in the loop&lt;br /&gt;       body.)&lt;br /&gt;       - supports break and continue&lt;br /&gt;       - important: one fundamantal difference between the loop&lt;br /&gt;         semantic and for/while/until semantic is that the argument&lt;br /&gt;         expression 'exp' in loop( exp ) is evaluated exactly once&lt;br /&gt;         when the loop is first entered.&lt;br /&gt;   - (added) MidiIn and MidiOut member functions:&lt;br /&gt;       .good() : whether the thing is good to go (int)&lt;br /&gt;       .num()  : the device number (int)&lt;br /&gt;       .name() : the device name (string)&lt;br /&gt;       .printerr( int ) : whether to auto print errors (default YES)&lt;br /&gt;   - (added) --version command line flag (Graham)&lt;br /&gt; &lt;br /&gt;   - (changed) chuck --status now prints shreds sorted by id&lt;br /&gt;       (previously it was the current shreduling order + blocked)&lt;br /&gt;   - (changed) a udp port may now be shared by many OSC_Recv (phil)&lt;br /&gt;       : the incoming messages are broadcast to all&lt;br /&gt;   - (changed) address/type string in OSC: comma now optional (phil)&lt;br /&gt; &lt;br /&gt;   - (fixed) events are now 0-sample synchronous (instead of 1)&lt;br /&gt;   - (fixed) startup audio stability for --callback mode&lt;br /&gt;   - (fixed) incorrect 'continue' behavior in for loops&lt;br /&gt;   - (fixed) improved OSC stability (phil)&lt;br /&gt;   - (fixed) OSC shreduling sanity check failed now resolved&lt;br /&gt;   - (fixed) math.round for negative numbers (win32)&lt;br /&gt;   - (fixed) std.mtof and std.ftom now internally double precision&lt;br /&gt;   - (fixed) removed extra console output in STK Flute&lt;br /&gt;   - (fixed) multiple delete/assertion failure on type rollback&lt;br /&gt;   - (fixed) chuck --kill now closes WvOut and MidiRW file handles&lt;br /&gt;   - (added) examples/midi/gomidi.ck : very useful sometimes&lt;br /&gt;   - (added) examples/midi/gomidi2.ck&lt;br /&gt;   - (added) examples/basic/rec-auto.ck (rec2.ck back in action)&lt;br /&gt;   - (added) examples/basic/fmsynth.ck (from v1)&lt;br /&gt;   - (added) examples/sitar.ck&lt;br /&gt;   - (fixed) examples/stk/*-o-matic.ck now uses array&lt;br /&gt; &lt;/blockquote&gt;&lt;br /&gt;_______________________________________________&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112958461331509430?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112958461331509430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112958461331509430'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/10/chuck-version-1202-released.html' title='[chuck] version 1.2.0.2 released'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112787120173635970</id><published>2005-09-27T18:31:00.000-07:00</published><updated>2005-09-27T19:00:30.736-07:00</updated><title type='text'>[chuck] version 1.2.0.1 released</title><content type='html'>&lt;center&gt;&lt;div style="width:550px;text-align:left;padding:5px;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;h2 class=myhead24&gt;[chuck] version 1.2.0.1 released&lt;/h2&gt;Dear All,&lt;br /&gt; &lt;br /&gt;chuck-1.2.0.1 (dracula) is now available, with new callback&lt;br /&gt;functionality for real-time audio (potentially better for linux and os&lt;br /&gt;x), and several bug fixes: crash when using --replace averted, member&lt;br /&gt;resolution in inherited classes corrected, and string comparison is&lt;br /&gt;less broken, among others.  Much thanks to Robin Davies, Manfred&lt;br /&gt;Brockhaus, Leonard "paniq" Ritter, and others for their help.&lt;br /&gt; &lt;br /&gt;     &lt;A HREF="http://chuck.cs.princeton.edu/release/" target=chuck.princeton.edu1.2.0.1&gt;http://chuck.cs.princeton.edu/release/&lt;/A&gt;&lt;br /&gt;     (may need to reload page to see update)&lt;br /&gt; &lt;br /&gt;Please let us know of any issues.&lt;br /&gt; &lt;br /&gt;HappY ChucKing!&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;chuck team&lt;br /&gt; &lt;br /&gt;---&lt;br /&gt;1.2.0.1&lt;br /&gt;   - (added) full callback capability for real-time audio&lt;br /&gt;     - blocking functionality still available&lt;br /&gt;     - select via flags: --blocking and --callback&lt;br /&gt;     - improves latency and stability, especially on linux&lt;br /&gt;     - use --callback (default) for low latency / small buffer size&lt;br /&gt;     - use --blocking for higher throughput (sometimes)&lt;br /&gt;   - (fixed) crash when doing on-the-fly 'replace'&lt;br /&gt;          example: chuck --replace 0 foo.ck&lt;br /&gt;   - (fixed) implicit cast is now correct when sporking&lt;br /&gt;     (thanks to Manfred Brockhaus)&lt;br /&gt;   - (fixed) nested class definitions can have same name as outer class&lt;br /&gt;   - (fixed) nested class bug in scan1 (thanks to Robin Davies)&lt;br /&gt;   - (fixed) variable resolution in parent class now visible&lt;br /&gt;     (thanks to Robin Davies)&lt;br /&gt;   - (fixed) variable resolution ordering&lt;br /&gt;     - local, class, parent, global (thanks to Robin Davies)&lt;br /&gt;   - (fixed) emitter now asserts inheritance instead of equality&lt;br /&gt;     (thanks to Robin Davies)&lt;br /&gt;   - (fixed) string comparison ==, !=&lt;br /&gt;   - (added) string operations &lt;, &lt;=, &gt;, &gt;=&lt;br /&gt;   - (fixed) examples code reformatted, cleaned, and commented&lt;br /&gt;   - (fixed) OSC event function now correctly named ("event")&lt;br /&gt;   - (fixed) removed debug output in OSC&lt;br /&gt; &lt;br /&gt;_______________________________________________&lt;br /&gt;chuck mailing list&lt;br /&gt;&lt;A HREF="mailto:chuck@lists.cs.princeton.edu"&gt;chuck@lists.cs.princeton.edu&lt;/A&gt;&lt;br /&gt;&lt;A HREF="https://lists.cs.princeton.edu/mailman/listinfo/chuck"&gt;https://lists.cs.princeton.edu/mailman/listinfo/chuck&lt;/A&gt;&lt;br /&gt; &lt;/div&gt;&lt;/center&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112787120173635970?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112787120173635970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112787120173635970'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/09/chuck-version-1201-released.html' title='[chuck] version 1.2.0.1 released'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112500649878498880</id><published>2005-08-25T14:45:00.000-07:00</published><updated>2005-08-25T14:52:17.406-07:00</updated><title type='text'>Version 1.2.0.0 (dracula) released</title><content type='html'>&lt;h2 class=myhead24&gt;[chuck] version 1.2.0.0 (dracula) released&lt;/h2&gt;Dear All,&lt;br /&gt; &lt;br /&gt;chuck-1.2.0.0 is released. (Sorry.)  This is the "v2" major release.&lt;br /&gt;Additions include arrays, objects and classes, events, and more.  A&lt;br /&gt;full list of new and updated features can be found at the end of this&lt;br /&gt;email.&lt;br /&gt; &lt;br /&gt;     &lt;A HREF="http://chuck.cs.princeton.edu/" TARGET="chuckatcsprinceton"&gt;http://chuck.cs.princeton.edu/&lt;/A&gt;&lt;br /&gt;&lt;br /&gt;We have also put together a draft of a language specification&lt;br /&gt;(finally).  It is not complete yet and will be improved as (real) time&lt;br /&gt;is advanced:&lt;br /&gt; &lt;br /&gt;     &lt;A HREF="http://chuck.cs.princeton.edu/doc/language/" TARGET="chucklanguage"&gt;http://chuck.cs.princeton.edu/doc/language/&lt;/A&gt;&lt;br /&gt; &lt;br /&gt;We have been testing this release along the way.  However, since this&lt;br /&gt;is the initial release, there is probably a healthy amount of egregious&lt;br /&gt;bugs!  Please let us know if you run into anything fishy (email one of&lt;br /&gt;us directly, post to chuck-dev or the newly created chuck-users list).&lt;br /&gt;Same goes for the documentation.  Actually, any type of feedback would&lt;br /&gt;be greatly appreciated.&lt;br /&gt; &lt;br /&gt;Many thanks to the great people who have contributed ideas, code, and&lt;br /&gt;time to this release!  Thanks to everyone for being so patient with&lt;br /&gt;this release.&lt;br /&gt; &lt;br /&gt;Development shall continue as we fix the bugs, add new features (and&lt;br /&gt;more bugs).&lt;br /&gt; &lt;br /&gt;Please let us know if you run into any problems.  HappY ChucKing!&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;ChucK Team&lt;br /&gt;(Perry, Ananya, Phil, Adam, Ajay, Ge ...)&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size:9pt;"&gt;&lt;br /&gt;---&lt;br /&gt;1.2.0.0&lt;br /&gt; &lt;br /&gt;   SYNTAX and OPERATORS:&lt;br /&gt;   - (added) +=&gt;, operator : 2 +=&gt; i; (also) -=&gt;, *=&gt;, /=&gt;, %=&gt;&lt;br /&gt;   - (added) @=&gt; for explicit assignment&lt;br /&gt;     this is the only way to make object reference assignments&lt;br /&gt;   - (added) implicit int to float casting&lt;br /&gt;   - (changed) cast now look like: 1.1 $ (int) =&gt; int i;&lt;br /&gt;   - (added) function call by chucking :&lt;br /&gt;     // call&lt;br /&gt;     (1,4) =&gt; math.rand2f =&gt; result;&lt;br /&gt;     // same as&lt;br /&gt;     math.rand2f(1,4) =&gt; result;&lt;br /&gt; &lt;br /&gt;   LANGUAGE:&lt;br /&gt;   - (fixed) type system for existing types&lt;br /&gt;   - (added) forward lookup of classes and functions (mutual recursion)&lt;br /&gt;   - (added) stack overflow detection for massive recursion&lt;br /&gt; &lt;br /&gt;   DOCUMENTATION:&lt;br /&gt;   - (added) language specification:&lt;br /&gt;         http://chuck.cs.princeton.edu/doc/language&lt;br /&gt; &lt;br /&gt;   COMMAND-LINE:&lt;br /&gt;   - (added) --probe prints all audio and MIDI devices&lt;br /&gt;   - (added) --log or --verbose logs compiler and virtual machine&lt;br /&gt;   - (added) --logN or --verboseN multi level logging&lt;br /&gt;     1 - least verbose&lt;br /&gt;     10 - most verbose&lt;br /&gt; &lt;br /&gt;   OBJECTS:&lt;br /&gt;   - (added) 'class' definitions : class X { int i; }&lt;br /&gt;   - (added) 'extends' keyword : class Y extends Event { int i; }&lt;br /&gt;   - (added) virtual/polymorphic inheritance&lt;br /&gt;   - (added) added pre-constructors - code at class level&lt;br /&gt;     gets run when object is instantiated&lt;br /&gt;   - (added) function overloading :&lt;br /&gt;     class X { fun void foo() { }  fun void foo( int y ) { } }&lt;br /&gt;   - (added) base classes (can be extended):&lt;br /&gt;     Object, Event, UGen&lt;br /&gt;     see below&lt;br /&gt;   - (added) base classes (cannot be extended):&lt;br /&gt;     array, string&lt;br /&gt;     see below&lt;br /&gt;   - (added) member data&lt;br /&gt;   - (added) static data&lt;br /&gt;   - (added) member functions&lt;br /&gt;   - (added) static functions&lt;br /&gt; &lt;br /&gt;   EVENTS:&lt;br /&gt;   - (added) base Event class : Event e;&lt;br /&gt;     can be used directly&lt;br /&gt;     can be extended to custom events&lt;br /&gt;     (see one_event_many_shreds.ck)&lt;br /&gt;   - (added) waiting on event, chuck to now :&lt;br /&gt;     e =&gt; now; // wait on e&lt;br /&gt;   - (added) e.signal() wakes up 1 shred, if any&lt;br /&gt;   - (added) e.broadcast() wakes up all shreds waiting on e&lt;br /&gt;   - (added) class MidiEvent (see gomidi2.ck)&lt;br /&gt;     alternative to polling.&lt;br /&gt;   - (added) class OSCEvent&lt;br /&gt; &lt;br /&gt;   ARRAYS:&lt;br /&gt;   - (added) arrays : int a[10]; float b[20]; Event e[2];&lt;br /&gt;   - (added) multidimensional arrays : int a[2][2][2];&lt;br /&gt;   - (added) associative arrays : int a[10]; 0 =&gt; a["foo"];&lt;br /&gt;     all arrays are both int-indexed and associative&lt;br /&gt;   - (added) array initialization : [ 1, 2, 3 ] @=&gt; int a[];&lt;br /&gt;   - (added) .cap() for array capacity&lt;br /&gt;   - (added) .find() test if item is associative array&lt;br /&gt;   - (added) .erase() erase item in associative array&lt;br /&gt; &lt;br /&gt;   UGENS:&lt;br /&gt;   - (added) class UGen&lt;br /&gt;     can be extended&lt;br /&gt;   - (changed) all ugen parameters are now also functions:&lt;br /&gt;     // set freq&lt;br /&gt;     440 =&gt; s.freq =&gt; val;&lt;br /&gt;     // same as...&lt;br /&gt;     s.freq( 440 ) =&gt; val;&lt;br /&gt;   - (changed) left-most parameters must now be called as functions&lt;br /&gt;     // no longer valid&lt;br /&gt;     f.freq =&gt; float val;&lt;br /&gt;     // valid&lt;br /&gt;     f.freq() =&gt; float val;&lt;br /&gt;     // still ok&lt;br /&gt;     440 =&gt; s.freq =&gt; float val;&lt;br /&gt; &lt;br /&gt;   SHREDS:&lt;br /&gt;   - (added) class Shred&lt;br /&gt;   - (added) .yield() .id()&lt;br /&gt; &lt;br /&gt;   STRINGS:&lt;br /&gt;   - (added) class string&lt;br /&gt; &lt;br /&gt;   AUDIO:&lt;br /&gt;   - (added) stereo&lt;br /&gt;     all stereo unit generators have .left, .right, .pan functions&lt;br /&gt;   - (changed) stereo ugen: dac (2 in, 2 out)&lt;br /&gt;   - (changed) stereo ugen: adc (0 in, 2 out)&lt;br /&gt;   - (added) stereo ugen: pan2 take mono or stereo input and pans&lt;br /&gt;   - (added) stereo ugen: mix2 mix stereo input into mono&lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2 class=myhead24&gt;[chuck] spork ~ chuck-users ( new mailing_list + more )&lt;/h2&gt;&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;Dear All,&lt;br /&gt; &lt;br /&gt;Along with the new release, we have made a new mailing list&lt;br /&gt;(chuck-users), intended for specific questions and discussions about&lt;br /&gt;using chuck.  This list (chuck) will (soon) become a moderated,&lt;br /&gt;low-traffic mailing list intended for updates, announcements,&lt;br /&gt;tutorials, and low-bandwidth discussions.&lt;br /&gt; &lt;br /&gt;Hopefully the folks that are interested in chuck can remain on (chuck)&lt;br /&gt;without being potentially spammed too much, and those that have&lt;br /&gt;specific questions can fire away on (chuck-users) with a clean&lt;br /&gt;conscience!&lt;br /&gt; &lt;br /&gt;Additionally, we have been graciously given permission to abuse an&lt;br /&gt;entity called 'soup kitchen'.  It is the state-of-the-art in&lt;br /&gt;anti-social networking.  It contains many nice features (all&lt;br /&gt;conversations are by default world-readable, optional email&lt;br /&gt;notification of new replies to topics, and is rather elegant) that may&lt;br /&gt;be to useful as a semi-realtime semi-anonymous forum.  The author,&lt;br /&gt;Visnu Pitiyanuvath, will work with us to further enhance the site to&lt;br /&gt;make it more useful and fun.&lt;br /&gt; &lt;br /&gt;Links to all the lists and soup kitchen can be found here:&lt;br /&gt; &lt;br /&gt;     &lt;A HREF="http://chuck.cs.princeton.edu/community.html" TARGET="chuckcommunity"&gt;http://chuck.cs.princeton.edu/community.html&lt;br /&gt;&lt;/A&gt; &lt;br /&gt;Join, if you like.  Have fun!&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;ChucK Team&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112500649878498880?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112500649878498880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112500649878498880'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/08/version-1200-dracula-released.html' title='Version 1.2.0.0 (dracula) released'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-112024699850350541</id><published>2005-07-01T12:38:00.000-07:00</published><updated>2005-07-01T12:43:18.506-07:00</updated><title type='text'>RBF-soft. [producing] working with chuck (via chuck mailing list)</title><content type='html'>RBF-soft. [producing] working with chuck&lt;br /&gt; &lt;br /&gt;  Hi to everyone!, Hi Chuckit list!&lt;br /&gt;&lt;br /&gt;We're David &amp; Ivan Rodriguez, RBF-soft. [producing], Electronic Artists from barcelona - Spain. We presented our last work VIFE _alpha v.01 at NIME'05 Vancouver - Canada. VIFE _alpha v.01 is a Virtual I nterface to Feel Emotions. The performer user can control 6 three dimensional sonorous forms with an interactive glove (VIFE _glove v.01) &amp; an anlaysing box (R-CUBE IV). The works investigate the idea of Synaesthesia and her enormous possibilities creating new realities, sensations and zones, where the user can find new points of interaction.&lt;br /&gt;&lt;br /&gt;In NIME'05 we knew Ge Wang and Perry Cook. So interesting people ;) :)&lt;br /&gt;&lt;br /&gt;After that we presented this project in SONAR'05 (Barcelona), too.&lt;br /&gt;&lt;br /&gt;For our next project, we're working with Chuck like a sonorous engine. Chuck is so powerfull and don't need any visual interface, only the console. This is very important for our next work, because we need to save resources and energy to use it in other things like, analysis of audio, synthesis, sonorous effects,... This project is about wearable technology, GPS, sensors,... We will use Chuck for this project.&lt;br /&gt;&lt;br /&gt;Best Regards,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rodri_DJ &amp; ivan_VJ&lt;br /&gt;RBF-soft. [producing]&lt;br /&gt;&lt;a href="http://www.rbf-soft.com" target=rbfsoft&gt;http://www.rbf-soft.com&lt;/a&gt;&lt;br /&gt;&lt;a href="mailto:rbf_soft@hotmail.com"&gt;rbf_soft@hotmail.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-112024699850350541?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112024699850350541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/112024699850350541'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/07/rbf-soft-producing-working-with-chuck.html' title='RBF-soft. [producing] working with chuck (via chuck mailing list)'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-111992162743264788</id><published>2005-06-27T18:18:00.000-07:00</published><updated>2005-06-29T14:21:59.660-07:00</updated><title type='text'>Chuck 1.2 - any date yet?</title><content type='html'>Chuck 1.2 - any date yet?&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;Hi Thor and Everyone,&lt;br /&gt; &lt;br /&gt;We have continued development in full since NIME (for the most&lt;br /&gt;part) and are going to do so until the release and beyond.  We are&lt;br /&gt;working on completing the core feature set before releasing 1.2.&lt;br /&gt;We have everything except about 4 showstopper feature/bugs&lt;br /&gt;that we feel needs to be in the release.  (They include finishing&lt;br /&gt;rudimentary garbage collection, stereo (very close), a pre-scanner&lt;br /&gt;for the type system, and static data initialization).  The main&lt;br /&gt;additions (arrays, objects, events, and even basic OSC) are&lt;br /&gt;completed and even tested.&lt;br /&gt; &lt;br /&gt;However, I think it's hard to set a release date, since our earlier&lt;br /&gt;attempts obviously weren't met.  So we will keep going as fast as&lt;br /&gt;we can until the last features/bugs are dealt with.  We are close.&lt;br /&gt; &lt;br /&gt;&gt; I'm pretty eager now as I was thinking of playing with chuck&lt;br /&gt;&gt; in my summer holiday in a cottage up in some Icelandic mountains.&lt;br /&gt; &lt;br /&gt;laptop... $2000&lt;br /&gt;headphones... $100&lt;br /&gt;chuck... $0&lt;br /&gt;summer cottage in Icelandic mountains...  priceless.&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;Ge!&lt;br /&gt; &lt;br /&gt;On Jun 27, 2005, at 11:45 AM, thor wrote:&lt;br /&gt; &lt;br /&gt;&gt; Hi everybody.&lt;br /&gt;&gt;&lt;br /&gt;&gt; Thanks Ge, Perry and the rest of you for a wicked workshop at&lt;br /&gt;&gt; NIME last month.&lt;br /&gt;&gt;&lt;br /&gt;&gt; I've been on my way to do a Chuck session, but have decided&lt;br /&gt;&gt; to wait for the 1.2 release. Any news on when....?&lt;br /&gt;&gt;&lt;br /&gt;&gt; I'm pretty eager now as I was thinking of playing with chuck&lt;br /&gt;&gt; in my summer holiday in a cottage up in some Icelandic mountains.&lt;br /&gt;&gt;&lt;br /&gt;&gt; Cheers&lt;br /&gt;&gt; Thor&lt;br /&gt;&gt;&lt;br /&gt;&gt; _______________________________________________&lt;br /&gt;&gt; chuck mailing list&lt;br /&gt;&gt; chuck@lists.cs.princeton.edu&lt;br /&gt;&gt; https://lists.cs.princeton.edu/mailman/listinfo/chuck&lt;br /&gt; &lt;br /&gt;_______________________________________________&lt;br /&gt;chuck mailing list&lt;br /&gt;chuck@lists.cs.princeton.edu&lt;br /&gt;https://lists.cs.princeton.edu/mailman/listinfo/chuck&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Upddate:&lt;/b&gt; Re: [chuck] Chuck 1.2 - any date yet?&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;On Jun 28, 2005, at 8:32 AM, oliver oli wrote:&lt;br /&gt;&gt; what about multi-channel (&gt; 2 channels)?&lt;br /&gt; &lt;br /&gt;multi-channel is certainly planned for, but probably won't&lt;br /&gt;be in the initial 1.2.0.0 release.  However, it should follow&lt;br /&gt;soon in a subsequent release.  It is a high priority.&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;Ge!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-111992162743264788?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/111992162743264788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/111992162743264788'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/06/chuck-12-any-date-yet.html' title='Chuck 1.2 - any date yet?'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-111350049223074776</id><published>2005-04-14T10:31:00.000-07:00</published><updated>2005-04-14T10:41:32.230-07:00</updated><title type='text'>Welcome, Joe McMahon</title><content type='html'>Blogger's been difficult lately, so sorry for so few new posts.&lt;br /&gt;Got this from the Chuck mailing list, and the wiki:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Joe McMahon&lt;/b&gt; is writing an OS X application using ChucK, Applescript Studio, and Perl to play and record the chimes [1] &lt;a href="http://interglacial.com/d/clock"target=clock&gt;(http://interglacial.com/d/clock)&lt;/a&gt; from the Clock of the Long Now[2] &lt;a href="http://www.g4tv.com/screensavers/features/47159/Can_Brian_Eno_Reinvent_the_Future.html" target=brianenoclock&gt;(http://www.g4tv.com/screensavers/features/47159/Can_Brian_Eno_Reinvent_the_Future.html)&lt;/a&gt;. First version &lt;a href="http://ibiblio.org/emusic-l/LNC.dmg.gz" target=smggz&gt;(http://ibiblio.org/emusic-l/LNC.dmg.gz)(&lt;b&gt;NOTE:&lt;/b&gt; Gzipped DMG file)&lt;/a&gt; is available at the &lt;a href="http://ibiblio.org/emusic-l/" target=emusicl&gt;EMUSIC-L site&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-111350049223074776?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/111350049223074776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/111350049223074776'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/04/welcome-joe-mcmahon.html' title='Welcome, Joe McMahon'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110827330920004209</id><published>2005-02-12T21:37:00.000-08:00</published><updated>2005-02-12T21:41:49.200-08:00</updated><title type='text'>New Release 1.1.5.5 (via ChucK Mailing List)</title><content type='html'>&lt;b&gt;Subject:&lt;/b&gt; [chuck] improved performance patch for OS X + XP&lt;br /&gt; &lt;br /&gt;  &lt;br /&gt;Dear All,&lt;br /&gt; &lt;br /&gt;There is a new incremental version out (1.1.5.5) which:&lt;br /&gt;&lt;blockquote&gt; &lt;br /&gt;     1) fixes a bug under XP where chuck --loop uses 100% cpu&lt;br /&gt;         (now it uses 0-5%)&lt;br /&gt;     2) improves stability under Mac OS X&lt;br /&gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;It is available now:&lt;br /&gt; &lt;br /&gt;     &lt;a href="http://chuck.cs.princeton.edu/release/" target=newrelease&gt;http://chuck.cs.princeton.edu/release/&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;Best,&lt;br /&gt;Ge!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110827330920004209?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110827330920004209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110827330920004209'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/02/new-release-1155-via-chuck-mailing.html' title='New Release 1.1.5.5 (via ChucK Mailing List)'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110672614330334877</id><published>2005-01-25T23:52:00.000-08:00</published><updated>2005-01-25T23:55:43.303-08:00</updated><title type='text'>Multiple DAC's For Multiple Voices</title><content type='html'>I've been noticing that the example files all seem to be single-voiced, so I've been wondering about doing chords...&lt;br /&gt;&lt;br /&gt;So I looked at the definition of the &lt;code&gt;dac&lt;/code&gt; in the programming guide and it didn't seem to prohibit there from being more than one reference.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;[ugen] dac&lt;br /&gt;    * digital/analog converter&lt;br /&gt;    * abstraction for underlying audio output device &lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt; &lt;br /&gt;So I decided to try it out. It works! (Or seems to &amp;mdash; running multiple versions of the multi-voice program does seem to cause some interference.)&lt;br /&gt;&lt;blockquote&gt;chuck bpmulti2.ck bpmulti2.ck bpmulti2.ck rec2.ck&lt;/blockquote&gt;seems to cause some interference...&lt;br /&gt;&lt;br /&gt;I've reworked the bluespenta.ck file to use multiple dac's (and JCRev's and Echo's to give interest to the secondary voices). You can download it &lt;A HREF="http://garywilliams.org/chuck/bpmulti2.ck" target=bpmulti2ck&gt;here (right-click and Save, or click to view in a new window)&lt;/a&gt;. Here's the code:&lt;br /&gt;&lt;br /&gt;&lt;center&gt;&lt;div style="color:black;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;// bpmulti2.ck&lt;br /&gt;// Bluesy R&amp;R*          C  Eb F  G  Bb C  -&lt;br /&gt;&lt;br /&gt;// try out multiple dac's for multiple voices&lt;br /&gt;// and for more interesting voices, multiple effects too&lt;br /&gt;&lt;br /&gt;// scale exercise using TubeBell STK&lt;br /&gt;// added scale run-up run-down to display scale&lt;br /&gt;&lt;br /&gt;// modified from examples/wurley.ck by Gary Williams&lt;br /&gt;// even more music for replicants Wurley changed to TubeBell &lt;br /&gt;&lt;br /&gt;TubeBell voc=&gt; JCRev r =&gt; Echo a =&gt; Echo b =&gt; Echo c =&gt; dac;&lt;br /&gt;&lt;br /&gt;// wonder if this will work (it does)&lt;br /&gt;TubeBell voc1=&gt; JCRev r1 =&gt; Echo a1 =&gt; Echo b1 =&gt; Echo c1 =&gt; dac; &lt;br /&gt;TubeBell voc2=&gt; JCRev r2 =&gt; Echo a2 =&gt; Echo b2 =&gt; Echo c2 =&gt; dac;&lt;br /&gt;&lt;br /&gt;// was 220.0&lt;br /&gt;880.0 =&gt; voc.freq =&gt; voc1.freq =&gt; voc2.freq;&lt;br /&gt;0.95 =&gt; voc.gain =&gt; voc1.gain =&gt; voc2.gain;&lt;br /&gt;.8 =&gt; r.gain =&gt; r1.gain =&gt; r2.gain;&lt;br /&gt;.2 =&gt; r.mix =&gt; r1.mix =&gt; r2.mix;&lt;br /&gt;&lt;br /&gt;1000::ms =&gt; a.max =&gt; b.max =&gt; c.max;&lt;br /&gt;750::ms =&gt; a.delay =&gt; b.delay =&gt; c.delay;&lt;br /&gt;.50 =&gt; a.mix =&gt; b.mix =&gt; c.mix;&lt;br /&gt;&lt;br /&gt;1000::ms =&gt; a1.max =&gt; b1.max =&gt; c1.max;&lt;br /&gt;750::ms =&gt; a1.delay =&gt; b1.delay =&gt; c1.delay;&lt;br /&gt;.50 =&gt; a1.mix =&gt; b1.mix =&gt; c1.mix;&lt;br /&gt;&lt;br /&gt;1000::ms =&gt; a2.max =&gt; b2.max =&gt; c2.max;&lt;br /&gt;750::ms =&gt; a2.delay =&gt; b2.delay =&gt; c2.delay;&lt;br /&gt;.50 =&gt; a2.mix =&gt; b2.mix =&gt; c2.mix;&lt;br /&gt;&lt;br /&gt;// shred to modulate the mix&lt;br /&gt;fun void vecho_shred( )&lt;br /&gt;{&lt;br /&gt;    0.0 =&gt; float decider;&lt;br /&gt;    0.0 =&gt; float mix;&lt;br /&gt;    0.0 =&gt; float old;&lt;br /&gt;    0.0 =&gt; float inc;&lt;br /&gt;    0 =&gt; int n;&lt;br /&gt;&lt;br /&gt;    // time loop&lt;br /&gt;    while( true )&lt;br /&gt;    {&lt;br /&gt;        std.rand2f(0.0,1.0) =&gt; decider;&lt;br /&gt;        if( decider &lt; .3 ) 0.0 =&gt; mix;&lt;br /&gt;        else if( decider &lt; .6 ) .08 =&gt; mix;&lt;br /&gt;        else if( decider &lt; .8 ) .5 =&gt; mix;&lt;br /&gt;        else .15 =&gt; mix;&lt;br /&gt;&lt;br /&gt;        // find the increment&lt;br /&gt;        (mix-old)/1000.0 =&gt; inc;&lt;br /&gt;        1000 =&gt; n;&lt;br /&gt;        while( n-- )&lt;br /&gt;        {&lt;br /&gt;            old + inc =&gt; old;&lt;br /&gt;            old =&gt; a.mix =&gt; b.mix =&gt; c.mix;&lt;br /&gt;            old =&gt; a1.mix =&gt; b1.mix =&gt; c1.mix;&lt;br /&gt;            old =&gt; a2.mix =&gt; b2.mix =&gt; c2.mix;&lt;br /&gt;            1::ms =&gt; now;&lt;br /&gt;        }&lt;br /&gt;        mix =&gt; old;&lt;br /&gt;        std.rand2(2,6)::second =&gt; now;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// let echo shred go&lt;br /&gt;spork ~ vecho_shred();&lt;br /&gt;&lt;br /&gt;// function to set tone duration&lt;br /&gt;function int setnotedur() {&lt;br /&gt;    std.rand2f( 0.6, 0.8 ) =&gt; voc.noteOn;&lt;br /&gt;    std.rand2f( 0.6, 0.8 ) =&gt; voc1.noteOn;&lt;br /&gt;    std.rand2f( 0.6, 0.8 ) =&gt; voc2.noteOn;&lt;br /&gt;&lt;br /&gt;    // duration&lt;br /&gt;    if( std.randf() &gt; 0.7 )&lt;br /&gt;    { 1000::ms =&gt; now; }&lt;br /&gt;    else if( std.randf() &gt; .7 )&lt;br /&gt;    { 500::ms =&gt; now; }&lt;br /&gt;    else if( std.randf() &gt; -0.8 )&lt;br /&gt;    { .250::second =&gt; now; }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        0 =&gt; int i;&lt;br /&gt;        2 * std.rand2( 1, 3 ) =&gt; int pick;&lt;br /&gt;        0 =&gt; int pick_dir;&lt;br /&gt;        0.0 =&gt; float pluck;&lt;br /&gt;&lt;br /&gt;	for( ; i &lt; pick; i++ )&lt;br /&gt;        {&lt;br /&gt;            std.rand2f(.4,.6) + (float)i*.035 =&gt; pluck;&lt;br /&gt;            pluck + 0.03 * (float)(i * pick_dir) =&gt; voc.noteOn;&lt;br /&gt;            std.rand2f(.4,.6) + (float)i*.035 =&gt; pluck;&lt;br /&gt;            pluck + 0.03 * (float)(i * pick_dir) =&gt; voc1.noteOn;&lt;br /&gt;            std.rand2f(.4,.6) + (float)i*.035 =&gt; pluck;&lt;br /&gt;            pluck + 0.03 * (float)(i * pick_dir) =&gt; voc2.noteOn;&lt;br /&gt;            !pick_dir =&gt; pick_dir;&lt;br /&gt;            250::ms =&gt; now;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // report&lt;br /&gt;    // machine.status();&lt;br /&gt;  return( 1 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Bluesy R&amp;R*     C  Eb   E   F   G   A  Bb   C&lt;br /&gt;// Blues Pentatonic C Eb       F   G      Bb   C&lt;br /&gt;//                                              octave&lt;br /&gt;// MIDI            60 63  64  65  67  69  70  72  0&lt;br /&gt;//	             72 75  76  77  79  81  82  84  1&lt;br /&gt;//	             84 87  88  89  91  93  94  96  2&lt;br /&gt;//                 96 99 100 101 103 105 106 107  3	              &lt;br /&gt;// NOTE #           0  1   2   3   4   5   6   7&lt;br /&gt;&lt;br /&gt;// map notes 2 and 5 to 0 and 7&lt;br /&gt;fun float note_to_midi( int note, int octave ) {&lt;br /&gt;	if( note == 0  || note == 2 ){&lt;br /&gt;		if( octave == 0 ) { return(60.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 72.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 84.0 ); }&lt;br /&gt;		else return( 96.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 1 ){&lt;br /&gt;		if( octave == 0 ) { return(63.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 75.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 87.0 ); }&lt;br /&gt;		else return( 99.0 );&lt;br /&gt;	}&lt;br /&gt;//////////	else if( note == 2 ){&lt;br /&gt;//////////		if( octave == 0 ) { return(64.0); }&lt;br /&gt;//////////		else if( octave == 1 ) { return( 75.0 ); }&lt;br /&gt;//////////		else if( octave == 2 ) { return( 88.0 ); }&lt;br /&gt;//////////		else return( 100.0 );&lt;br /&gt;//////////	}&lt;br /&gt;	else if( note == 3 ){&lt;br /&gt;		if( octave == 0 ) { return(65.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 77.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 89.0 ); }&lt;br /&gt;		else return( 101.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 4 ){&lt;br /&gt;		if( octave == 0 ) { return(67.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 79.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 91.0 ); }&lt;br /&gt;		else return( 103.0 );&lt;br /&gt;	}&lt;br /&gt;//////////	else if( note == 5 ){&lt;br /&gt;//////////		if( octave == 0 ) { return(69.0); }&lt;br /&gt;//////////		else if( octave == 1 ) { return( 81.0 ); }&lt;br /&gt;//////////		else if( octave == 2 ) { return( 93.0 ); }&lt;br /&gt;//////////		else return( 105.0 );&lt;br /&gt;//////////	}&lt;br /&gt;	else if( note == 6 ){&lt;br /&gt;		if( octave == 0 ) { return(70.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 82.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 93.0 ); }&lt;br /&gt;		else return( 106.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 7 || note == 5 ){&lt;br /&gt;		if( octave == 0 ) { return(72.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 84.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 96.0 ); }&lt;br /&gt;		else return( 107.0 );&lt;br /&gt;	}&lt;br /&gt;	return( 120.0 ); // error code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// vars&lt;br /&gt;0 =&gt; int i;&lt;br /&gt;0 =&gt; int oct;&lt;br /&gt;0.0 =&gt; float freq;&lt;br /&gt;0.0 =&gt; float f;&lt;br /&gt;&lt;br /&gt;// run up and down scale first, to display scale being featured&lt;br /&gt;"Blues Pentatonic Scale: up" =&gt; stdout;&lt;br /&gt;for( 0 =&gt; oct; oct &lt; 4; ++oct ) {&lt;br /&gt;	for( 0 =&gt; i; i &lt; 8; ++i ) {&lt;br /&gt;		std.mtof( note_to_midi( i++, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc.freq;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;&lt;br /&gt;		std.mtof( note_to_midi( i++, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc1.freq;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;&lt;br /&gt;		std.mtof( note_to_midi( i++, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc2.freq;&lt;br /&gt;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;		setnotedur();&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;"Blues Pentatonic Scale: down" =&gt; stdout;&lt;br /&gt;for( 4 =&gt; oct; oct &gt; -1; --oct ) {&lt;br /&gt;	for( 7 =&gt; i; i &gt; -1; --i ) {&lt;br /&gt;		std.mtof( note_to_midi( i--, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc.freq;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;&lt;br /&gt;		std.mtof( note_to_midi( i--, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc1.freq;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;&lt;br /&gt;		std.mtof( note_to_midi( i--, oct) ) =&gt; f;&lt;br /&gt;		f =&gt; voc2.freq;&lt;br /&gt;		chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; f =&gt; endl;&lt;br /&gt;		setnotedur();&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;"Change To Random Notes" =&gt; stdout;&lt;br /&gt;&lt;br /&gt;// our main loop&lt;br /&gt;while( true )&lt;br /&gt;{&lt;br /&gt;	std.rand2(0, 7) =&gt;  i;&lt;br /&gt;	std.rand2(0, 3) =&gt; int octave;&lt;br /&gt;	std.mtof( note_to_midi( i, octave) ) =&gt; float freq;&lt;br /&gt;	freq =&gt; voc.freq;&lt;br /&gt;	chout =&gt; "i,i1,i2: " =&gt; i; // =&gt; ", " =&gt; freq; // =&gt; endl;&lt;br /&gt;&lt;br /&gt;	std.rand2(0, 7) =&gt;  i;&lt;br /&gt;	std.rand2(0, 3) =&gt; octave;&lt;br /&gt;	std.mtof( note_to_midi( i, octave) ) =&gt; freq;&lt;br /&gt;	freq =&gt; voc1.freq;&lt;br /&gt;	chout =&gt; " " =&gt; i; // =&gt; ", " =&gt; freq; // =&gt; endl;&lt;br /&gt;&lt;br /&gt;	std.rand2(0, 7) =&gt;  i;&lt;br /&gt;	std.rand2(0, 3) =&gt; octave;&lt;br /&gt;	std.mtof( note_to_midi( i, octave) ) =&gt; freq;&lt;br /&gt;	freq =&gt; voc2.freq;&lt;br /&gt;	chout =&gt; " " =&gt; i =&gt; endl; // =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;&lt;br /&gt;	setnotedur();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;I did some MP3's, they sound really pleasant, but my server is full right now so I can't upload it right now. (I'm pursuing some more space, but I'm waiting for the admins to tell me they've upped by disk space...) Look for  bpmulti...mp3 in the recording links for the mp3.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110672614330334877?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110672614330334877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110672614330334877'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/multiple-dacs-for-multiple-voices.html' title='Multiple DAC&apos;s For Multiple Voices'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110652113647209884</id><published>2005-01-23T14:54:00.000-08:00</published><updated>2005-01-23T15:12:22.670-08:00</updated><title type='text'>Recording ChucK Sounds</title><content type='html'>There's a detailed lesson on the ChucK Wiki &lt;A HREF="http://wiki.cs.princeton.edu/index.php/ChucK_Record" target=chuck-record&gt;http://wiki.cs.princeton.edu/index.php/ChucK_Record&lt;/A&gt;. Basically, the key is to add &lt;code&gt;rec.ck&lt;/code&gt; or &lt;code&gt;rec2.ck&lt;/code&gt; to the files being chucked. (That's &lt;A HREF="http://chuck.cs.princeton.edu/doc/examples/rec.ck" target=recck&gt;http://chuck.cs.princeton.edu/doc/examples/rec.ck&lt;/A&gt; and &lt;A HREF="http://chuck.cs.princeton.edu/doc/examples/rec2.ck" target=rec2ck&gt;http://chuck.cs.princeton.edu/doc/examples/rec2.ck&lt;/A&gt;).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rec.ck&lt;/code&gt; writes a file called &lt;i&gt;foo.wav&lt;/i&gt; in the current directory. &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;  D:\CHUCK&gt;chuck hihat.ck snare.ck kick.ck baseloop.ck bluespenta.ck rec.ck &lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rec2.ck&lt;/code&gt; writes a file that's tagged with the current date and time: chuck-session(Sun Jan 23 17h30m58 2005).wav when you run it tagged on the end of the chuck list:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;  D:\CHUCK&gt;chuck SuperLocrianBells.ck rec2.ck &lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;You can either modify &lt;code&gt;rec.ck/rec2.ck&lt;/code&gt; to terminate, or you can just kill all the shreds with &lt;b&gt;&lt;i&gt;CTL-C&lt;/i&gt;&lt;/b&gt; (the close-out routine ChucK uses closes all open files).&lt;br /&gt;&lt;br /&gt;.WAV files are somewhat large, so it's probably worthwhile to go to SourceForge and download the current version of &lt;A HREF="http://audacity.sourceforge.net/" target=audavity&gt;&lt;b&gt;&lt;i&gt;Audacity&lt;/i&gt;&lt;/b&gt; (http://audacity.sourceforge.net/)&lt;/a&gt;. (You'll need to also find and download the LAME mp3 recording library via the SourceForge site to export MP3 files from &lt;b&gt;&lt;i&gt;Audacity.&lt;/i&gt;&lt;/b&gt;)&lt;br /&gt;&lt;br /&gt;Or you can use &lt;b&gt;&lt;i&gt;Audacity&lt;/i&gt;&lt;/b&gt; to export Ogg/Vorbis files...&lt;br /&gt;&lt;br /&gt;You'll notice I've added links to a variety of MP3 files I've recorded from the .CK files we've shown here...as well as Mikael's &lt;b&gt;&lt;i&gt;djembe.mp3&lt;/i&gt;&lt;/b&gt;, which he filed a link to on the ChucK Wiki (I've added links to my files there too...)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110652113647209884?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110652113647209884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110652113647209884'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/recording-chuck-sounds.html' title='Recording ChucK Sounds'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110641746405014884</id><published>2005-01-22T09:39:00.000-08:00</published><updated>2005-01-22T10:22:58.626-08:00</updated><title type='text'>Using A Scale Function -- SuperLocrianBells.ck</title><content type='html'>Michael Johansson's &lt;code&gt;scales.ck&lt;/code&gt; includes an extensive list of comments on various types of scales and modes. I thought it would be useful to illustrate the creation of a scale selecting function that picks out the notes of a specific scale. I picked C Super Locrian (which Michael subtitles Ravel). So I wrote a &lt;code&gt; float note_to_midi( int note, int octave )&lt;/code&gt; function. I used the code from my modification of the &lt;code&gt;wurley.ck&lt;/code&gt; example program, which uses the TubeBell STK FM synthesis module.&lt;br /&gt;&lt;br /&gt;The full program is here: &lt;A HREF="http://garywilliams.org/chuck/SuperLocrianBells.ck" target=superlocrianbells&gt;SuperLocrianBells.ck&lt;/A&gt; (as usual, click to see full code in a new window, or right-click/SAVE to download).&lt;br /&gt;&lt;br /&gt;I've clipped out &lt;b&gt;&lt;i&gt;[SNIP]&lt;/i&gt;&lt;/b&gt; the "standard" stuff from the example and just kept the new function and main driver (and scale comments from &lt;code&gt;scales.ck&lt;/code&gt;). You'll notice that &lt;code&gt;note_to_midi()&lt;/code&gt; contains four complete octaves, duplicating each octave note (&lt;B&gt;C&lt;/b&gt; and &lt;b&gt;C'&lt;/b&gt;). I did it this way because by having complete scales for each octave stresses the root note for the scale. Be picking 0 - 7, you have two chances in each octave to get a root note, focusing the piece on the "key". This may be mathematically illegitimate, but it's my choice because I have the illogical feeling that it makes it more "musical". (Heh &amp;mdash; or jejeje as one of my Spanish friends says).&lt;br /&gt;&lt;br /&gt;Anyway, here's the code:&lt;br /&gt;&lt;br /&gt; &lt;center&gt;&lt;div style="color:black;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// SuperLocrianBells.ck&lt;br /&gt;// scale exercise using TubeBell STK&lt;br /&gt;&lt;br /&gt;// modified from examples/wurley.ck by Gary Williams&lt;br /&gt;// even more music for replicants Wurley changed to TubeBell&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;[SNIP...]&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;0 =&gt; int i;&lt;br /&gt;0.0 =&gt; float freq;&lt;br /&gt;&lt;br /&gt;// Super Locrian   C  Db  Eb   E  Gb  Ab  Bb  C   octave  (Ravel)&lt;br /&gt;// MIDI            60 61  63  64  65  68  70  72  0&lt;br /&gt;//	             72 73  75  76  77  80  82  83  1&lt;br /&gt;//	             84 85  87  88  89  92  93  96  2&lt;br /&gt;//                 96 97  99 100 101 104 106 108  3	              &lt;br /&gt;// NOTE #           0  1   2   3   4   5   6   7&lt;br /&gt;fun float note_to_midi( int note, int octave ) {&lt;br /&gt;	if( note == 0 ){&lt;br /&gt;		if( octave == 0 ) { return(60.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 72.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 84.0 ); }&lt;br /&gt;		else return( 96.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 1 ){&lt;br /&gt;		if( octave == 0 ) { return(61.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 73.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 85.0 ); }&lt;br /&gt;		else return( 97.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 2 ){&lt;br /&gt;		if( octave == 0 ) { return(63.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 75.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 87.0 ); }&lt;br /&gt;		else return( 99.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 3 ){&lt;br /&gt;		if( octave == 0 ) { return(64.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 76.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 88.0 ); }&lt;br /&gt;		else return( 100.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 4 ){&lt;br /&gt;		if( octave == 0 ) { return(65.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 77.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 89.0 ); }&lt;br /&gt;		else return( 101.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 5 ){&lt;br /&gt;		if( octave == 0 ) { return(68.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 80.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 92.0 ); }&lt;br /&gt;		else return( 104.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 6 ){&lt;br /&gt;		if( octave == 0 ) { return(70.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 82.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 93.0 ); }&lt;br /&gt;		else return( 106.0 );&lt;br /&gt;	}&lt;br /&gt;	else if( note == 7 ){&lt;br /&gt;		if( octave == 0 ) { return(72.0); }&lt;br /&gt;		else if( octave == 1 ) { return( 83.0 ); }&lt;br /&gt;		else if( octave == 2 ) { return( 96.0 ); }&lt;br /&gt;		else return( 108.0 );&lt;br /&gt;	}&lt;br /&gt;	return( 120.0 ); // error code&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// our main loop&lt;br /&gt;while( true )&lt;br /&gt;{&lt;br /&gt;	std.rand2(0, 7) =&gt;  i;&lt;br /&gt;	std.rand2(0, 3) =&gt; int octave;&lt;br /&gt;	std.mtof( note_to_midi( i, octave) ) =&gt; float freq;&lt;br /&gt;	freq =&gt; voc.freq;&lt;br /&gt;&lt;br /&gt;	chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;	setnotedur();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Scale references &lt;br /&gt;//             1  2 3 4  5 6  7 8  9 10 11 12 13&lt;br /&gt;// Chromatic   C Db D Eb E F Gb G Ab A  Bb B  C&lt;br /&gt;&lt;br /&gt;// Spanish 8 Tone  C Db Eb E F Gb Ab Bb C&lt;br /&gt;// Flamenco        C Db Eb E F G Ab Bb C&lt;br /&gt;// Symmetrical     C Db Eb E Gb G A Bb C&lt;br /&gt;// Diminished      C D Eb F Gb Ab A B C&lt;br /&gt;// Whole Tone      C D E Gb Ab Bb C&lt;br /&gt;// Augmented       C Eb E G Ab B C&lt;br /&gt;// 3 semitone      C Eb Gb A C&lt;br /&gt;// 4 semitone      C E Ab C&lt;br /&gt;//&lt;br /&gt;// Ultra Locrian   C Db Eb E Gb Ab A C&lt;br /&gt;// Super Locrian   C Db Eb E Gb Ab Bb C                    (Ravel)&lt;br /&gt;// Indian-ish*     C Db Eb E G Ab Bb C&lt;br /&gt;// Locrian         C Db Eb F Gb Ab Bb C&lt;br /&gt;// Phrygian        C Db Eb F G  Ab Bb C&lt;br /&gt;// Neapolitan Min  C Db Eb F G Ab B C&lt;br /&gt;// Javanese        C Db Eb F G A Bb C&lt;br /&gt;// Neapolitan Maj  C Db Eb F G A B C&lt;br /&gt;// Todi (Indian)   C Db Eb Gb G Ab B C&lt;br /&gt;// Persian         C Db E F Gb Ab B C&lt;br /&gt;// Oriental        C Db E F Gb A Bb C&lt;br /&gt;// Maj.Phryg. (Dom)C Db E F G Ab Bb C                      Spanish/ Jewish&lt;br /&gt;// Double Harmonic C Db E F G Ab B C                       Gypsy/ Byzantine/ Ch$&lt;br /&gt;// Marva (Indian)  C Db E Gb G A B C&lt;br /&gt;// Enigmatic       C Db E Gb Ab Bb B C &lt;br /&gt;// &lt;br /&gt;// Locrian Natural 2nd  C D Eb F Gb Ab Bb C&lt;br /&gt;// Minor (natural)      C D Eb F G Ab Bb C                 Aeolian/ Algerian (o$&lt;br /&gt;// Harmonic Minor       C D Eb F G Ab B C                  Mohammedan&lt;br /&gt;// Dorian               C D Eb F G A Bb C&lt;br /&gt;// Melodic Minor (Asc)  C D Eb F G A B C                   Hawaiian&lt;br /&gt;// Hungarian Gypsy      C D Eb Gb G Ab Bb C&lt;br /&gt;// Hungarian Minor      C D Eb Gb G Ab B C                 Algerian (oct1)&lt;br /&gt;// Romanian             C D Eb Gb G A Bb C&lt;br /&gt;// &lt;br /&gt;// Maj. Locrian         C  D  E  F  Gb Ab Bb C  Arabian&lt;br /&gt;// Hindu                C  D  E  F  G  Ab Bb C  -&lt;br /&gt;// Ethiopian            C  D  E  F  G   Ab B  C&lt;br /&gt;// Mixolydian           C  D  E  F  G  A  Bb C  -&lt;br /&gt;// Major                C  D  E  F  G  A  B  C  Ionian&lt;br /&gt;// Mixolydian Aug.      C  D  E  F  Ab A  Bb C  -&lt;br /&gt;// Harmonic Major       C  D  E  F  Ab A  B  C  -&lt;br /&gt;// Lydian Min.          C  D  E  Gb G  Ab Bb C  -&lt;br /&gt;// Lydian Dominant      C  D  E  Gb G  A  Bb C  Overtone&lt;br /&gt;// Lydian               C  D  E  Gb G  A  B  C  -&lt;br /&gt;// Lydian Aug.          C  D  E  Gb Ab A  Bb C  -&lt;br /&gt;// Leading Whole Tone   C  D  E  Gb Ab Bb B  C  -&lt;br /&gt;// Bluesy R&amp;R*          C  Eb E  F  G  A  Bb C  -&lt;br /&gt;// Hungarian Major      C  Eb E  Gb G  A  Bb C  Lydian sharp2nd&lt;br /&gt;// &lt;br /&gt;// "pB"                 C  Db Eb Gb Ab C  -&lt;br /&gt;// Balinechuck@lists.cs.princeton.eduse 1           C  Db Eb G  Ab C  "pE"&lt;br /&gt;// Pelog (Balinese)     C  Db Eb G  Bb C  -&lt;br /&gt;// Iwato (Japanese)     C  Db F  Gb Bb C  -&lt;br /&gt;// Japanese 1           C  Db F  G  Ab C  Kumoi&lt;br /&gt;// Hirajoshi (Japanese) C  D  Eb G  Ab C  "pA"&lt;br /&gt;// "pD"                 C  D  Eb G  A  C  -&lt;br /&gt;// Pentatonic Major     C  D  E  G  A  C  Chinese 1/ Mongolian/ "pFCG"&lt;br /&gt;// Egyptian             C  D  F  G  Bb C  -&lt;br /&gt;// Pentatonic Minor     C  Eb F  G  Bb C  -&lt;br /&gt;// Chinese 2            C  E  Gb G  B  C  -&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Oh, and if you'd like to hear it without running it yourself, here's &lt;a href="http://garywilliams.org/chuck/SuperLocrianBells.mp3" target=superlocrianbellsmp3&gt;SuperLocrianBells.mp3.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110641746405014884?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110641746405014884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110641746405014884'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/using-scale-function.html' title='Using A Scale Function -- SuperLocrianBells.ck'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110641499387850602</id><published>2005-01-22T09:27:00.000-08:00</published><updated>2005-01-22T09:29:53.876-08:00</updated><title type='text'>The Synthesis ToolKit in C   (STK)</title><content type='html'>via &lt;a href="http://ccrma.stanford.edu/software/stk/" target=stkmcgill&gt;The Synthesis ToolKit in C   (STK)&lt;/a&gt;&lt;h3&gt;The Synthesis ToolKit in C   (STK)&lt;/h3&gt;4.2.0&lt;br /&gt;Perry R. Cook &amp; Gary P. Scavone&lt;br /&gt;&lt;br /&gt;The Synthesis ToolKit in C   (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C   programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C   code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 10 years now. STK currently runs with 'realtime' support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C   compiler.&lt;br /&gt;&lt;a href="http://ccrma.stanford.edu/software/stk/" target=stkmcgill&gt;&lt;b&gt;&lt;i&gt;&lt;center&gt;[more]&lt;/center&gt;&lt;/i&gt;&lt;/b&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110641499387850602?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110641499387850602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110641499387850602'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/synthesis-toolkit-in-c-stk.html' title='The Synthesis ToolKit in C   (STK)'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110634551309000309</id><published>2005-01-21T13:37:00.000-08:00</published><updated>2005-01-21T14:47:54.623-08:00</updated><title type='text'>A Chromatic Exercise Using std.mtof()</title><content type='html'>Now that Mikael Johansson pointed the way to the MIDI table, I thought it would be worthwhile to do a simple exercise that runs the full range of MIDI note values.&lt;br /&gt;&lt;br /&gt;So here it is. &lt;a href="http://garywilliams.org/chuck/chromatic.ck"m target=chromaticck&gt;&lt;b&gt;chromatic.ck&lt;/b&gt;&lt;/a&gt; Just using a simple sine oscillator isn't very attractive, so I also did a version using the TubeBell STK function, modeled on the Replicant examples. &lt;a href="http://garywilliams.org/chuck/tubebellChromatic.ck"m target=tubebellchromaticck&gt;&lt;b&gt;tubebellChromatic.ck&lt;/b&gt;&lt;/a&gt; Permanent links are over there on the right, the new section of .CK Example links.&lt;br /&gt;&lt;br /&gt;Here's the code for  &lt;b&gt;chromatic.ck:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt; &lt;center&gt;&lt;div style="color:black;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// chromatic.ck -- run the full range of MIDI values&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// author: Gary Williams (gwms[AT]corninglink{DOT}com)&lt;br /&gt;&lt;br /&gt;0 =&gt; int i;&lt;br /&gt;0.0 =&gt; float freq;&lt;br /&gt;&lt;br /&gt;      // make our patch&lt;br /&gt;      sinosc s =&gt; dac;&lt;br /&gt;&lt;br /&gt;// do a random delay&lt;br /&gt;fun int setdur() {&lt;br /&gt;    if( std.randf() &gt; 0.7 )&lt;br /&gt;    { 1000::ms =&gt; now; }&lt;br /&gt;    else if( std.randf() &gt; .7 )&lt;br /&gt;    { 500::ms =&gt; now; }&lt;br /&gt;    else if( std.randf() &gt; -0.8 )&lt;br /&gt;    { .250::second =&gt; now; }&lt;br /&gt;	else {&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;	}&lt;br /&gt;	return(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// loop through chromatic range 0 - 127 and back down 127 - 0&lt;br /&gt;for(; i &lt; 128; i++) {&lt;br /&gt;	std.mtof( (float)i) =&gt; float freq;&lt;br /&gt;	freq =&gt; s.freq;&lt;br /&gt;	setdur();&lt;br /&gt;	chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// loop back to 0&lt;br /&gt;for(; i &gt; -1; i--) {&lt;br /&gt;	std.mtof( (float)i) =&gt; float freq;&lt;br /&gt;	freq =&gt; s.freq;&lt;br /&gt;	setdur();&lt;br /&gt;	chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// note change to random&lt;br /&gt;"Change To Random" =&gt; stdout;&lt;br /&gt;&lt;br /&gt;// our main loop&lt;br /&gt;while( true )&lt;br /&gt;{&lt;br /&gt;	std.rand2(0, 127) =&gt;  i;&lt;br /&gt;	std.mtof( (float)i) =&gt; float freq;&lt;br /&gt;	freq =&gt; s.freq;&lt;br /&gt;	setdur();&lt;br /&gt;	chout =&gt; "i, freq: " =&gt; i =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;On my system (a Sony VAIO laptop running Windows XP), the tones below 58 are inaudible, and the tones above around 120 are too. So for real use,  the MIDI note range should probably be limited, based on the capability of the output devices.&lt;br /&gt;&lt;br /&gt;Another thing I noticed while doing debug last night, the &lt;code&gt;stdout&lt;/code&gt; print device doesn't seem to allow multiple value displays, but the &lt;b&gt;&lt;i&gt;chout.ck&lt;/i&gt;&lt;/b&gt; example shows the use of &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;code&gt;chout =&gt; "string label" =&gt; v1 =&gt; "string separator" =&gt; v2 =&gt; endl;&lt;/code&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;which is really useful for debugging. I've always found that watching values on the fly is more valuable for fixing a new program than any static view, so having on-the-fly display verbs is helpful.&lt;br /&gt;&lt;br /&gt;In the function programming I was doing yesterday, I did notice something that I hope gets added to the language: we need an &lt;code&gt;exit()&lt;/code&gt; verb. At the end of the &lt;code&gt;note_freq()&lt;/code&gt; function, I needed to handle program errors (where the function gets called with illegal arguments). It's the kind of thing that's pretty common when you start a new program, but it's worth being able to do a quick exit with a message when the parameter tests fail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110634551309000309?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110634551309000309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110634551309000309'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/chromatic-exercise-using-stdmtof.html' title='A Chromatic Exercise Using std.mtof()'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110632773131009467</id><published>2005-01-21T09:09:00.000-08:00</published><updated>2005-01-21T09:15:31.310-08:00</updated><title type='text'>Mikael Johansson Answers My MIDI Question</title><content type='html'>Mikael Johansson answers my question about MIDI numbers (via the ChucK mailing list while I slept last night):&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;A HREF="http://www.harmony-central.com/MIDI/Doc/table2.html"&gt;http://www.harmony-central.com/MIDI/Doc/table2.html&lt;/A&gt; &lt;br /&gt;&lt;br /&gt;Basically, number 60 is middle C, denoted as C4. The number steps one step&lt;br /&gt;for each halftone. So you get which of the tones in the scale by&lt;br /&gt;calculating notenumber%12, and which octave by integer division by 12.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I've copied the table from the MIDI page (and I've added the page link to the links list on the right over there):&lt;br /&gt;&lt;br /&gt;&lt;TABLE BORDER=3 WIDTH=100%&gt;&lt;br /&gt;&lt;TR ALIGN=center&gt;&lt;TD ROWSPAN=2&gt;&lt;B&gt;Octave #&lt;/B&gt;&lt;/TD&gt;&lt;TD COLSPAN=12&gt;&lt;B&gt;Note Numbers&lt;/B&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;C&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;C#&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;D&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt; &lt;B&gt;D#&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;E&lt;/B&gt;&lt;TD&gt;&lt;B&gt;F&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;F#&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;G&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;G#&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;A&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;A#&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;B&lt;/B&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;-1&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt; 0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt; 2&lt;/TD&gt;&lt;TD&gt; 3&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;0&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;16&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;22 &lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;1&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;31&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;2&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;36&lt;/TD&gt;&lt;TD&gt;37&lt;/TD&gt;&lt;TD&gt;38&lt;/TD&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;41&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;TD&gt;43&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;TD&gt;46&lt;/TD&gt;&lt;TD&gt;47&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;3&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;49&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;51&lt;/TD&gt;&lt;TD&gt;52&lt;/TD&gt;&lt;TD&gt;53&lt;/TD&gt;&lt;TD&gt;54&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;TD&gt;56&lt;/TD&gt;&lt;TD&gt;57&lt;/TD&gt;&lt;TD&gt;58&lt;/TD&gt;&lt;TD&gt;59&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;4&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;60&lt;/tD&gt;&lt;TD&gt;61&lt;/td&gt;&lt;TD&gt;62&lt;/TD&gt;&lt;TD&gt;63&lt;/TD&gt;&lt;TD&gt;64&lt;/TD&gt;&lt;TD&gt;65&lt;/TD&gt;&lt;TD&gt;66&lt;/TD&gt;&lt;TD&gt;67&lt;/TD&gt;&lt;TD&gt;68&lt;/td&gt;&lt;TD&gt;69&lt;/tD&gt;&lt;TD&gt;70&lt;/td&gt;&lt;TD&gt;71&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;5&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;72&lt;/TD&gt;&lt;TD&gt;73&lt;/TD&gt;&lt;TD&gt;74&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;76&lt;/tD&gt;&lt;TD&gt;77&lt;/td&gt;&lt;TD&gt;78&lt;/TD&gt;&lt;TD&gt;79&lt;/tD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;81&lt;/td&gt;&lt;TD&gt;82&lt;/TD&gt;&lt;TD&gt;83&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;6&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;84&lt;/td&gt;&lt;TD&gt;85&lt;/TD&gt;&lt;TD&gt;86&lt;/TD&gt;&lt;TD&gt;87&lt;/TD&gt;&lt;TD&gt;88&lt;/TD&gt;&lt;TD&gt;89&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;91&lt;/TD&gt;&lt;TD&gt;92&lt;/TD&gt;&lt;TD&gt;93&lt;/TD&gt;&lt;TD&gt;94&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;7&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;96&lt;/TD&gt;&lt;TD&gt;97&lt;/TD&gt;&lt;TD&gt;98&lt;/TD&gt;&lt;TD&gt;99&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;104&lt;/tD&gt;&lt;TD&gt;105&lt;/TD&gt;&lt;TD&gt;106&lt;/TD&gt;&lt;TD&gt;107&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;8&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;108&lt;/TD&gt;&lt;TD&gt;109&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;112&lt;/TD&gt;&lt;TD&gt;113&lt;/TD&gt;&lt;TD&gt;114&lt;/TD&gt;&lt;TD&gt;115&lt;/TD&gt;&lt;TD&gt;116&lt;/tD&gt;&lt;TD&gt;117&lt;/TD&gt;&lt;TD&gt;118&lt;/TD&gt;&lt;TD&gt;119&lt;/TD&gt;&lt;/TR&gt;&lt;TR ALIGN=center&gt;&lt;TD&gt;&lt;B&gt;9&lt;/B&gt;&lt;/TD&gt;&lt;TD&gt;120&lt;/TD&gt;&lt;TD&gt;121&lt;/TD&gt;&lt;TD&gt;122&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;124&lt;/TD&gt;&lt;TD&gt;125&lt;/TD&gt;&lt;TD&gt;126&lt;/TD&gt;&lt;TD&gt;127&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt; &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110632773131009467?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110632773131009467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110632773131009467'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/mikael-johansson-answers-my-midi.html' title='Mikael Johansson Answers My MIDI Question'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110630032415991861</id><published>2005-01-21T01:14:00.000-08:00</published><updated>2005-01-21T15:11:07.886-08:00</updated><title type='text'>scalefunction.ck — The float note_freq( int note, int  octave ) Chromatic Function</title><content type='html'>Although Mikael Johansson's scale.ck example on the ChucK Wiki is a clear example of variable declarations for 6 octaves of chromatic tempered scale notes, Mikael wrote us yesterday about the &lt;code&gt;float mtof( float );&lt;/code&gt; function for converting MIDI note values to frequency values. Unfortunately, I don't yet understand MIDI (except in physical use via various synthesizers -- I've never read the spec). &lt;br /&gt;&lt;br /&gt;Anyway, I decided it might be useful to convert Mikael's variable declaration code to a function returning frequencies, based on my own (made up) note codes:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;//  A Bb B C Db D Eb E F Gb G  Ab&lt;br /&gt;//  0 1 2  3 4 5  6 7  8 9  10 11   &lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;It's pretty arbitrary, but it should work. I've coded up the file and a test script, which you can download here: &lt;a href="http://garywilliams.org/chuck/scalefunction.ck" target=scalefunc&gt;scalefunction.ck&lt;/a&gt; and &lt;a href="http://garywilliams.org/chuck/test_note_freq.ck" target=testnotefreq&gt;test_note_freq.ck&lt;/A&gt; (right-click and save).&lt;br /&gt;&lt;br /&gt;Here's the code in scalefunction.ck:&lt;br /&gt; &lt;center&gt;&lt;div style="color:black;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// scalefunction.ck   scale function using full 5-octave chromatic values&lt;br /&gt;// code for use in other programs&lt;br /&gt;// author: Gary Williams   (gwms[AT]corninglink[DOT]com)&lt;br /&gt;&lt;br /&gt;// derived from &lt;br /&gt;// scales.ck&lt;br /&gt;// author: Mikael Johansson (mikael/at/johansson.org)&lt;br /&gt;// (we need arrays now!) &lt;br /&gt;&lt;br /&gt;//--------------------------------------------------------------&lt;br /&gt;//  float note_freq( int note, int octave )&lt;br /&gt;//&lt;br /&gt;//  converts note (integer 0 to 12), octave (integer 0 to 5)&lt;br /&gt;//  to return float frequency of corresponding note&lt;br /&gt;//&lt;br /&gt;//  A Bb B C Db D Eb E F Gb G  Ab&lt;br /&gt;//  0 1 2  3 4 5  6 7  8 9  10 11 &lt;br /&gt;//--------------------------------------------------------------&lt;br /&gt;function float note_freq( int note, int octave )&lt;br /&gt;{&lt;br /&gt;    if( note == 0 ) {&lt;br /&gt;	if (octave == 0) return(55.000);  // =&gt;  float A0;&lt;br /&gt;	if (octave == 1) return(110.000);  // =&gt;  float A1; &lt;br /&gt;	if (octave == 2) return(220.000);  // =&gt;  float A2; &lt;br /&gt;	if (octave == 3) return(440.000);  // =&gt;  float A3; &lt;br /&gt;	if (octave == 4) return(880.000);  // =&gt;   float A4;&lt;br /&gt;	if (octave == 5) return(1760.000);  // =&gt;  float A5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 1 ) {&lt;br /&gt;	if (octave == 0) return(58.270);   // =&gt;  float Bb0; &lt;br /&gt;	if (octave == 1) return(116.541);   // =&gt;  float Bb1;&lt;br /&gt;	if (octave == 2) return(233.082);   // =&gt;  float Bb2;&lt;br /&gt;	if (octave == 3) return(466.164);   // =&gt;  float Bb3;&lt;br /&gt;	if (octave == 4) return(932.328);   // =&gt;  float Bb4;&lt;br /&gt;	if (octave == 5) return(1864.655);  // =&gt;  float Bb5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 2 ) {&lt;br /&gt;	if (octave == 0) return(61.735);    // =&gt;  float B0;&lt;br /&gt;	if (octave == 1) return(123.471);  // =&gt;   float B1;&lt;br /&gt;	if (octave == 2) return(246.942);  // =&gt;   float B2;&lt;br /&gt;	if (octave == 3) return(493.883);  // =&gt;   float B3;&lt;br /&gt;	if (octave == 4) return(987.767);  // =&gt;   float B4;&lt;br /&gt;	if (octave == 5) return(1975.533);  // =&gt;  float B5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 3 ) {&lt;br /&gt;	if (octave == 0) return(65.406);   // =&gt;  float C0;  &lt;br /&gt;	if (octave == 1) return(130.813);   // =&gt;  float C1; &lt;br /&gt;	if (octave == 2) return(261.626);   // =&gt;  float C2; &lt;br /&gt;	if (octave == 3) return(523.251);   // =&gt;  float C3; &lt;br /&gt;	if (octave == 4) return(1046.502);   // =&gt;  float C4;&lt;br /&gt;	if (octave == 5) return(2093.005);  // =&gt;  float C5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 4 ) {&lt;br /&gt;	if (octave == 0) return(69.296);   // =&gt;  float Db0;  &lt;br /&gt;	if (octave == 1) return(138.591);   // =&gt;  float Db1; &lt;br /&gt;	if (octave == 2) return(277.183);   // =&gt;  float Db2; &lt;br /&gt;	if (octave == 3) return(554.365);   // =&gt;  float Db3; &lt;br /&gt;	if (octave == 4) return(1108.731);   // =&gt;  float Db4;&lt;br /&gt;	if (octave == 5) return(2217.461);  // =&gt;   float Db5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 5 ) {&lt;br /&gt;	if (octave == 0) return(73.416);   // =&gt;  float D0; &lt;br /&gt;	if (octave == 1) return(146.832);   // =&gt;  float D1;&lt;br /&gt;	if (octave == 2) return(293.665);   // =&gt;  float D2;&lt;br /&gt;	if (octave == 3) return(587.330);   // =&gt;  float D3; &lt;br /&gt;	if (octave == 4) return(1174.659);   // =&gt;  float D4;&lt;br /&gt;	if (octave == 5) return(2349.318);  // =&gt;   float D5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 6 ) {&lt;br /&gt;	if (octave == 0) return(77.782);   // =&gt;  float Eb0; &lt;br /&gt;	if (octave == 1) return(155.563);   // =&gt;  float Eb1;&lt;br /&gt;	if (octave == 2) return(311.127);   // =&gt;  float Eb2;&lt;br /&gt;	if (octave == 3) return(622.254);   // =&gt;  float Eb3; &lt;br /&gt;	if (octave == 4) return(1244.508);   // =&gt;  float Eb4;&lt;br /&gt;	if (octave == 5) return(2489.016);  // =&gt;  float Eb5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 7 ) {&lt;br /&gt;	if (octave == 0) return(82.407);   // =&gt;  float E0;   &lt;br /&gt;	if (octave == 1) return(164.814);   // =&gt;  float E1;  &lt;br /&gt;	if (octave == 2) return(329.628);   // =&gt;  float E2;  &lt;br /&gt;	if (octave == 3) return(659.255);   // =&gt;  float E3;  &lt;br /&gt;	if (octave == 4) return(1318.510);   // =&gt;  float E4; &lt;br /&gt;	if (octave == 5) return(2637.020);  // =&gt;  float E5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 8 ) {&lt;br /&gt;	if (octave == 0) return(87.307);   // =&gt;  float F0; &lt;br /&gt;	if (octave == 1) return(174.614);   // =&gt;  float F1;&lt;br /&gt;	if (octave == 2) return(349.228);   // =&gt;  float F2; &lt;br /&gt;	if (octave == 3) return(698.456);   // =&gt;  float F3; &lt;br /&gt;	if (octave == 4) return(1396.913);   // =&gt;  float F4;&lt;br /&gt;	if (octave == 5) return(2793.826);  // =&gt;  float F5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 9 ) {&lt;br /&gt;	if (octave == 0) return(92.499);   // =&gt;  float Gb0; &lt;br /&gt;	if (octave == 1) return(184.997);   // =&gt;  float Gb1;&lt;br /&gt;	if (octave == 2) return(369.994);   // =&gt;  float Gb2; &lt;br /&gt;	if (octave == 3) return(739.989);   // =&gt;  float Gb3; &lt;br /&gt;	if (octave == 4) return(1479.978);   // =&gt;  float Gb4;&lt;br /&gt;	if (octave == 5) return(2959.955);  // =&gt;  float Gb5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 10 ) {&lt;br /&gt;	if (octave == 0) return(97.999);   // =&gt;  float G0;&lt;br /&gt;	if (octave == 1) return(195.998);   // =&gt;  float G1;&lt;br /&gt;	if (octave == 2) return(391.995);   // =&gt;  float G2;  &lt;br /&gt;	if (octave == 3) return(783.991);   // =&gt;  float G3;  &lt;br /&gt;	if (octave == 4) return(1567.982);   // =&gt;  float G4;&lt;br /&gt;	if (octave == 5) return(3135.963);  // =&gt;  float G5;&lt;br /&gt;    }&lt;br /&gt;    else if( note == 11 ) {&lt;br /&gt;	if (octave == 0) return(103.826);   // =&gt;  float Ab0;&lt;br /&gt;	if (octave == 1) return(207.652);   // =&gt;  float Ab1;&lt;br /&gt;	if (octave == 2) return(415.305);   // =&gt;  float Ab2;&lt;br /&gt;	if (octave == 3) return(830.609);   // =&gt;  float Ab3;&lt;br /&gt;	if (octave == 4) return(1661.219);   // =&gt;  float Ab4;&lt;br /&gt;	if (octave == 5) return(3322.438);  // =&gt;  float Ab5;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    chout =&gt; "Error: note_freq: illegal note or octave value " =&gt; note =&gt; ", " =&gt; octave =&gt; endl;&lt;br /&gt;&lt;br /&gt;   // exit(-1); NOTE: ask for EXIT operator???&lt;br /&gt;}  // end float note_freq()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//--------------------------------------------------------------&lt;br /&gt;//&lt;br /&gt;//	heree's Mikael's variable defs if you want to use those&lt;br /&gt;//&lt;br /&gt;//--------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;// declare the note vars&lt;br /&gt;55.000 =&gt; float A0;&lt;br /&gt;110.000 =&gt; float A1; &lt;br /&gt;220.000 =&gt; float A2; &lt;br /&gt;440.000 =&gt; float A3; &lt;br /&gt;880.000 =&gt;  float A4;&lt;br /&gt;1760.000 =&gt; float A5;&lt;br /&gt;&lt;br /&gt;58.270  =&gt; float Bb0; &lt;br /&gt;116.541  =&gt; float Bb1;&lt;br /&gt;233.082  =&gt; float Bb2;&lt;br /&gt;466.164  =&gt; float Bb3;&lt;br /&gt;932.328  =&gt; float Bb4;&lt;br /&gt;1864.655 =&gt; float Bb5;&lt;br /&gt;&lt;br /&gt;61.735   =&gt; float B0;&lt;br /&gt;123.471 =&gt;  float B1;&lt;br /&gt;246.942 =&gt;  float B2;&lt;br /&gt;493.883 =&gt;  float B3;&lt;br /&gt;987.767 =&gt;  float B4;&lt;br /&gt;1975.533 =&gt; float B5;&lt;br /&gt;&lt;br /&gt;65.406  =&gt; float C0;  &lt;br /&gt;130.813  =&gt; float C1; &lt;br /&gt;261.626  =&gt; float C2; &lt;br /&gt;523.251  =&gt; float C3; &lt;br /&gt;1046.502  =&gt; float C4;&lt;br /&gt;2093.005 =&gt; float C5;&lt;br /&gt;&lt;br /&gt;69.296  =&gt; float Db0;  &lt;br /&gt;138.591  =&gt; float Db1; &lt;br /&gt;277.183  =&gt; float Db2; &lt;br /&gt;554.365  =&gt; float Db3; &lt;br /&gt;1108.731  =&gt; float Db4;&lt;br /&gt;2217.461 =&gt;  float Db5;&lt;br /&gt;&lt;br /&gt;73.416  =&gt; float D0; &lt;br /&gt;146.832  =&gt; float D1;&lt;br /&gt;293.665  =&gt; float D2;&lt;br /&gt;587.330  =&gt; float D3; &lt;br /&gt;1174.659  =&gt; float D4;&lt;br /&gt;2349.318 =&gt;  float D5;&lt;br /&gt;&lt;br /&gt;77.782  =&gt; float Eb0; &lt;br /&gt;155.563  =&gt; float Eb1;&lt;br /&gt;311.127  =&gt; float Eb2;&lt;br /&gt;622.254  =&gt; float Eb3; &lt;br /&gt;1244.508  =&gt; float Eb4;&lt;br /&gt;2489.016 =&gt; float Eb5;&lt;br /&gt;&lt;br /&gt;82.407  =&gt; float E0;   &lt;br /&gt;164.814  =&gt; float E1;  &lt;br /&gt;329.628  =&gt; float E2;  &lt;br /&gt;659.255  =&gt; float E3;  &lt;br /&gt;1318.510  =&gt; float E4; &lt;br /&gt;2637.020 =&gt; float E5;&lt;br /&gt;&lt;br /&gt;87.307  =&gt; float F0; &lt;br /&gt;174.614  =&gt; float F1;&lt;br /&gt;349.228  =&gt; float F2; &lt;br /&gt;698.456  =&gt; float F3; &lt;br /&gt;1396.913  =&gt; float F4;&lt;br /&gt;2793.826 =&gt; float F5;&lt;br /&gt;&lt;br /&gt;92.499  =&gt; float Gb0; &lt;br /&gt;184.997  =&gt; float Gb1;&lt;br /&gt;369.994  =&gt; float Gb2; &lt;br /&gt;739.989  =&gt; float Gb3; &lt;br /&gt;1479.978  =&gt; float Gb4;&lt;br /&gt;2959.955 =&gt; float Gb5;&lt;br /&gt;&lt;br /&gt;97.999  =&gt; float G0;&lt;br /&gt;195.998  =&gt; float G1;&lt;br /&gt;391.995  =&gt; float G2;  &lt;br /&gt;783.991  =&gt; float G3;  &lt;br /&gt;1567.982  =&gt; float G4;&lt;br /&gt;3135.963 =&gt; float G5;&lt;br /&gt;&lt;br /&gt;103.826  =&gt; float Ab0;&lt;br /&gt;207.652  =&gt; float Ab1;&lt;br /&gt;415.305  =&gt; float Ab2;&lt;br /&gt;830.609  =&gt; float Ab3;&lt;br /&gt;1661.219  =&gt; float Ab4;&lt;br /&gt;3322.438 =&gt; float Ab5;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Scale references &lt;br /&gt;//             1  2 3 4  5 6  7 8  9 10 11 12 13&lt;br /&gt;// Chromatic   C Db D Eb E F Gb G Ab A  Bb B  C&lt;br /&gt;&lt;br /&gt;// Spanish 8 Tone  C Db Eb E F Gb Ab Bb C&lt;br /&gt;// Flamenco        C Db Eb E F G Ab Bb C&lt;br /&gt;// Symmetrical     C Db Eb E Gb G A Bb C&lt;br /&gt;// Diminished      C D Eb F Gb Ab A B C&lt;br /&gt;// Whole Tone      C D E Gb Ab Bb C&lt;br /&gt;// Augmented       C Eb E G Ab B C&lt;br /&gt;// 3 semitone      C Eb Gb A C&lt;br /&gt;// 4 semitone      C E Ab C&lt;br /&gt;//&lt;br /&gt;// Ultra Locrian   C Db Eb E Gb Ab A C&lt;br /&gt;// Super Locrian   C Db Eb E Gb Ab Bb C                    (Ravel)&lt;br /&gt;// Indian-ish*     C Db Eb E G Ab Bb C&lt;br /&gt;// Locrian         C Db Eb F Gb Ab Bb C&lt;br /&gt;// Phrygian        C Db Eb F G  Ab Bb C&lt;br /&gt;// Neapolitan Min  C Db Eb F G Ab B C&lt;br /&gt;// Javanese        C Db Eb F G A Bb C&lt;br /&gt;// Neapolitan Maj  C Db Eb F G A B C&lt;br /&gt;// Todi (Indian)   C Db Eb Gb G Ab B C&lt;br /&gt;// Persian         C Db E F Gb Ab B C&lt;br /&gt;// Oriental        C Db E F Gb A Bb C&lt;br /&gt;// Maj.Phryg. (Dom)C Db E F G Ab Bb C                      Spanish/ Jewish&lt;br /&gt;// Double Harmonic C Db E F G Ab B C                       Gypsy/ Byzantine/ Ch$&lt;br /&gt;// Marva (Indian)  C Db E Gb G A B C&lt;br /&gt;// Enigmatic       C Db E Gb Ab Bb B C &lt;br /&gt;// &lt;br /&gt;// Locrian Natural 2nd  C D Eb F Gb Ab Bb C&lt;br /&gt;// Minor (natural)      C D Eb F G Ab Bb C                 Aeolian/ Algerian (o$&lt;br /&gt;// Harmonic Minor       C D Eb F G Ab B C                  Mohammedan&lt;br /&gt;// Dorian               C D Eb F G A Bb C&lt;br /&gt;// Melodic Minor (Asc)  C D Eb F G A B C                   Hawaiian&lt;br /&gt;// Hungarian Gypsy      C D Eb Gb G Ab Bb C&lt;br /&gt;// Hungarian Minor      C D Eb Gb G Ab B C                 Algerian (oct1)&lt;br /&gt;// Romanian             C D Eb Gb G A Bb C&lt;br /&gt;// &lt;br /&gt;// Maj. Locrian         C  D  E  F  Gb Ab Bb C  Arabian&lt;br /&gt;// Hindu                C  D  E  F  G  Ab Bb C  -&lt;br /&gt;// Ethiopian            C  D  E  F  G   Ab B  C&lt;br /&gt;// Mixolydian           C  D  E  F  G  A  Bb C  -&lt;br /&gt;// Major                C  D  E  F  G  A  B  C  Ionian&lt;br /&gt;// Mixolydian Aug.      C  D  E  F  Ab A  Bb C  -&lt;br /&gt;// Harmonic Major       C  D  E  F  Ab A  B  C  -&lt;br /&gt;// Lydian Min.          C  D  E  Gb G  Ab Bb C  -&lt;br /&gt;// Lydian Dominant      C  D  E  Gb G  A  Bb C  Overtone&lt;br /&gt;// Lydian               C  D  E  Gb G  A  B  C  -&lt;br /&gt;// Lydian Aug.          C  D  E  Gb Ab A  Bb C  -&lt;br /&gt;// Leading Whole Tone   C  D  E  Gb Ab Bb B  C  -&lt;br /&gt;// Bluesy R&amp;R*          C  Eb E  F  G  A  Bb C  -&lt;br /&gt;// Hungarian Major      C  Eb E  Gb G  A  Bb C  Lydian sharp2nd&lt;br /&gt;// &lt;br /&gt;// "pB"                 C  Db Eb Gb Ab C  -&lt;br /&gt;// Balinechuck@lists.cs.princeton.eduse 1           C  Db Eb G  Ab C  "pE"&lt;br /&gt;// Pelog (Balinese)     C  Db Eb G  Bb C  -&lt;br /&gt;// Iwato (Japanese)     C  Db F  Gb Bb C  -&lt;br /&gt;// Japanese 1           C  Db F  G  Ab C  Kumoi&lt;br /&gt;// Hirajoshi (Japanese) C  D  Eb G  Ab C  "pA"&lt;br /&gt;// "pD"                 C  D  Eb G  A  C  -&lt;br /&gt;// Pentatonic Major     C  D  E  G  A  C  Chinese 1/ Mongolian/ "pFCG"&lt;br /&gt;// Egyptian             C  D  F  G  Bb C  -&lt;br /&gt;// Pentatonic Minor     C  Eb F  G  Bb C  -&lt;br /&gt;// Chinese 2            C  E  Gb G  B  C  -&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;Naturally, this code needs some test code to drive it, so here's the test driver (with the &lt;code&gt;note_freq()&lt;/code&gt; code copied into the file...&lt;br /&gt;&lt;br /&gt; &lt;center&gt;&lt;div style="color:black;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;      // make our patch&lt;br /&gt;      sinosc s =&gt; dac;&lt;br /&gt;&lt;br /&gt;// now do random notes at 100 ms intervals&lt;br /&gt;	while( true ) {&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		std.rand2(0, 11) =&gt; int note;&lt;br /&gt;		std.rand2(0,5) =&gt; int octave;&lt;br /&gt;&lt;br /&gt;		// set frequency&lt;br /&gt;		note_freq( note, octave ) =&gt; float freq; &lt;br /&gt;		freq =&gt; s.freq;&lt;br /&gt;&lt;br /&gt;		// debug values&lt;br /&gt;		chout =&gt; "note, octave, freq: " =&gt; note =&gt; ", " =&gt; octave =&gt; ", " =&gt; freq =&gt; endl;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;You'll note that in &lt;b&gt;&lt;i&gt;scalefunction.ck&lt;/i&gt;&lt;/b&gt; I've included all of Mikael's variable definitions, so if you want to do your own version without all the function values (maybe you just want to cherry pick one scale...) you can do that.&lt;br /&gt;&lt;br /&gt;I've also added a request to the Wiki asking for include files so we don't have to copy these kind of function files into our scripte...&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110630032415991861?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110630032415991861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110630032415991861'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/scalefunctionck-float-notefreq-int.html' title='scalefunction.ck &amp;mdash; The float note_freq( int note, int  octave ) Chromatic Function'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110624586692120000</id><published>2005-01-20T10:22:00.000-08:00</published><updated>2005-01-20T10:42:40.810-08:00</updated><title type='text'>Mikael's Scales.ck Program</title><content type='html'>I was just looking over new material on the ChucK Wiki and found that Mikael Johansson has uploaded a program more sophisticated than my Ascale.ck: &lt;a href="http://wiki.cs.princeton.edu/index.php/ChucK_Program_Scales" target=mikaelscales&gt;http://wiki.cs.princeton.edu/index.php/ChucK_Program_Scales&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As he correctly notes, it does show the real need for arrays in ChucK!&lt;br /&gt;&lt;br /&gt;I guess my project for the day is to write a function version that can produce the frequency easily on-demand (or learn how to use the MIDI converter Mikael pointed out yesterday &lt;code style="text-size:14pt;"&gt;float std.mtof(float);&lt;/code&gt;).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110624586692120000?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110624586692120000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110624586692120000'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/mikaels-scalesck-program.html' title='Mikael&apos;s Scales.ck Program'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110624313568017415</id><published>2005-01-20T09:32:00.000-08:00</published><updated>2005-01-20T09:45:35.680-08:00</updated><title type='text'>Some Page Format Changes</title><content type='html'>Yesterday, when I set up Beginning ChucK, I just took one of Blogger's templates and pushed to get a couple of articles posted...&lt;br /&gt;&lt;br /&gt;After the A Scale post,  Mikael Johansson was nice enough to send me a note saying that he tried to add a comment suggesting using the &lt;code style="text-size:14pt;"&gt;float std.mtof(float);&lt;/code&gt; function which (undocumented) translates a MIDI number to frequency, thus avoiding the preamble tables I used in Ascale.ck. Since then I've fiddled with the settings here and  (I hope) enabled anonymous comments (so you won't need a blogger ID to post a comment...). Of course, this may cause some comment spamming, which I'll deal with if it comes up.&lt;br /&gt;&lt;br /&gt;Also, I've added some needed links to the Princeton ChucK homepage and other necessary and useful sites over there on the right...&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110624313568017415?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110624313568017415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110624313568017415'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/some-page-format-changes.html' title='Some Page Format Changes'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110618983806180756</id><published>2005-01-19T18:40:00.000-08:00</published><updated>2005-01-19T19:20:06.316-08:00</updated><title type='text'>The Simple A Scale Exercise</title><content type='html'>I know the tutorial material at Princeton is mostly aimed at using ChucK as a programming language (so far), but I wanted to start by doing some note (scale note) programming, so to start I found the article I noted in the early post: &lt;a href="http://tyala.freeyellow.com/t4scales.htm" target=freeyellowscales&gt;http://tyala.freeyellow.com/t4scales.htm,&lt;/a&gt; which gives you a discussion of musical scales, their principles and so on &amp;mdash; and gives you a table of frequencies. (I'll probably rework that and put it up here, since it would be useful.)&lt;br /&gt;&lt;br /&gt;But to start I did a simple exercise in writing ChucK. I set some variables to the frequencies of the A scale and wrote two loops, one to  run a simple oscilator up and down the scale four times, and the second loop to run endlessly playing random notes of the A scale.&lt;br /&gt;&lt;br /&gt;If you'd like a copy of the program &lt;a href=http://garywilliams.org/chuck/Ascale.ck target=ascaleck&gt;Ascale.ck &amp;mdash; right click and save here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here's the code:&lt;br /&gt;&lt;center&gt;&lt;div style="color:#000000;width:550px;text-align:left;padding:5px;background-color:#EEEEEE;border:3px dotted black;font-size:12px;padding:10px;"&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// A scale -- simple use of set scale frequencies&lt;br /&gt;// set scale vars&lt;br /&gt;	440.0   =&gt; float A;&lt;br /&gt;	493.883 =&gt; float B; &lt;br /&gt;	554.365 =&gt; float Csharp;&lt;br /&gt;	587.330 =&gt; float D; &lt;br /&gt;	659.255 =&gt; float E;&lt;br /&gt;	739.989 =&gt; float Fsharp;&lt;br /&gt;	830.609 =&gt; float Gsharp; &lt;br /&gt;	880.0   =&gt; float Aoct; &lt;br /&gt;&lt;br /&gt;      // make our patch&lt;br /&gt;      sinosc s =&gt; dac;&lt;br /&gt;&lt;br /&gt;      // run the scale up, then down, at 100 ms notes 4 times&lt;br /&gt;	5 =&gt; int i;&lt;br /&gt;      while( i-- ) {&lt;br /&gt;		A =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		B =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Csharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		D =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		E =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Fsharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Gsharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Aoct =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		now =&gt; stdout;&lt;br /&gt;&lt;br /&gt;		Aoct =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Gsharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Fsharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		E =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		D =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		Csharp =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		B =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		A =&gt; s.freq;&lt;br /&gt;		100::ms =&gt; now;&lt;br /&gt;		now =&gt; stdout;&lt;br /&gt;      }&lt;br /&gt;// now do random notes in the A scale at 100 ms intervals&lt;br /&gt;	while( true ) {&lt;br /&gt;          100::ms =&gt; now;&lt;br /&gt;          std.rand2(0, 7) =&gt; i;&lt;br /&gt;		i =&gt; stdout;&lt;br /&gt;		if( i == 0) A =&gt; s.freq;&lt;br /&gt;		else if( i == 1) B =&gt; s.freq;&lt;br /&gt;		else if( i == 2) Csharp =&gt; s.freq;&lt;br /&gt;		else if( i == 3) D =&gt; s.freq;&lt;br /&gt;		else if( i == 4) E =&gt; s.freq;&lt;br /&gt;		else if( i == 5) Fsharp =&gt; s.freq;&lt;br /&gt;		else if( i == 6) Gsharp =&gt; s.freq;&lt;br /&gt;		else if( i == 7) Aoct =&gt; s.freq;&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/center&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110618983806180756?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110618983806180756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110618983806180756'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/simple-scale-exercise.html' title='The Simple A Scale Exercise'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110617700288737869</id><published>2005-01-19T15:23:00.000-08:00</published><updated>2005-01-19T15:27:33.686-08:00</updated><title type='text'>ChucK : Concurrent, On-the-fly Audio Programming Language</title><content type='html'>&lt;img src=http://garywilliams.org/i2005/chuck.jpg border=0 style="float:left;padding:3px;"&gt;via &lt;a href="http://chuck.cs.princeton.edu/" target=chuckprinceton&gt;ChucK : Concurrent, On-the-fly Audio Programming Language&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;what is it? : ChucK is a new audio programming language for real-time synthesis, composition, and performance, which runs on commodity operating systems. ChucK presents a new time-based concurrent programming model, which supports a more precise and fundamental level of expressiveness, as well as multiple, simultaneous, dynamic control rates, and the ability to add, remove, and modify code, on-the-fly, while the program is running, without stopping or restarting. It offers composers, researchers, and performers a powerful and flexible programming tool for building and experimenting with complex audio synthesis programs, and real-time interactive control.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110617700288737869?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110617700288737869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110617700288737869'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/chuck-concurrent-on-fly-audio.html' title='ChucK : Concurrent, On-the-fly Audio Programming Language'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-10264719.post-110617573268808726</id><published>2005-01-19T14:57:00.000-08:00</published><updated>2005-01-19T15:02:12.686-08:00</updated><title type='text'>Learning ChucK</title><content type='html'>I'm learning ChucK. I thought that writing about it might help me learn it.&lt;br /&gt;&lt;br /&gt;Here's a couple of links that are useful:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://soundlab.cs.princeton.edu/publications/chuck_icmc2003.pdf" target=princetonchuckpdf&gt;================== ChucK PDF ====================================&lt;br /&gt;http://soundlab.cs.princeton.edu/publications/chuck_icmc2003.pdf&lt;/a&gt;&lt;br /&gt;&lt;a href="http://tyala.freeyellow.com/t4scales.htm" target=tylascales&gt;----- scales and frequency -------------&lt;br /&gt;http://tyala.freeyellow.com/t4scales.htm&lt;/a&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10264719-110617573268808726?l=b-chuck.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110617573268808726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10264719/posts/default/110617573268808726'/><link rel='alternate' type='text/html' href='http://b-chuck.blogspot.com/2005/01/learning-chuck.html' title='Learning ChucK'/><author><name>Gary Williams</name><uri>http://www.blogger.com/profile/13620087480749427596</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://garywilliams.org/HeadshotGarySm.jpg'/></author></entry></feed>
