-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
5,221 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
|
||
// In your project you will import it like this: | ||
// var sc = require('supercolliderjs'); | ||
|
||
// From within this example folder I will import it using a relative path: | ||
var sc = require('../index.js'); | ||
|
||
sc.server.boot({debug: true}).then(function(s) { | ||
|
||
s.send.msg(sc.msg.groupNew(s.state.nextNodeID())); | ||
|
||
// send immediately | ||
// results in a late warning from scsynth: | ||
// stdout : late 0.020416441 | ||
// because now is already in the past by the time the message | ||
// is received | ||
s.send.bundle(null, [ | ||
sc.msg.groupNew(s.state.nextNodeID()) | ||
]); | ||
|
||
// 0.03 second from now | ||
// small numbers are interpreted as relative seconds from now | ||
s.send.bundle(0.03, [ | ||
sc.msg.groupNew(s.state.nextNodeID()) | ||
]); | ||
|
||
// Schedule a sequence of notes. | ||
// All osc bundles are sent immediately. | ||
var start = (new Date()).getTime() / 1000; // unix time UTC | ||
var seq = [ | ||
0, | ||
1, | ||
1.5, | ||
2, | ||
8, | ||
12, | ||
16 | ||
]; | ||
var bpm = 120; | ||
var secondsPerBeat = 1 / (bpm / 60); | ||
|
||
function sched(beat) { | ||
return start + beat * secondsPerBeat; | ||
} | ||
|
||
for (var i = 0; i < seq.length; i++) { | ||
// Here we are sending large numbers | ||
// which are interpreted as unix timestamps. | ||
s.send.bundle(sched(seq[i]), [ | ||
sc.msg.groupNew(s.state.nextNodeID()) | ||
]); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.