Last active
June 14, 2019 18:05
-
-
Save iani/b217081fe1391297ae19aa670378445a to your computer and use it in GitHub Desktop.
sonify text - very very simple example
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
//: a text: | |
( | |
{ | |
var text; | |
text = "The tao that can be told | |
is not the eternal Tao | |
The name that can be named | |
is not the eternal Name. | |
The unnamable is the eternally real. | |
Naming is the origin | |
of all particular things. | |
Free from desire, you realize the mystery. | |
Caught in desire, you see only the manifestations. | |
Yet mystery and manifestations | |
arise from the same source. | |
This source is called darkness. | |
Darkness within darkness. | |
The gateway to all understanding."; | |
text.size; // 432 characters; | |
text.split($ ).size; // 60 words | |
/* | |
// version 1 - first test | |
// each char is a midinote | |
text do: { | char | | |
[char, char.ascii].postln; | |
(midinote: char.ascii).play; | |
0.2.wait; | |
}; | |
"THE END".postln; | |
*/ | |
// verson 2: play each word as a phrase | |
text.split($ ) do: { | word | | |
var transposition; | |
transposition = 12.rand; | |
word do: { | char | | |
// [char, char.ascii].postln; | |
(midinote: char.ascii + transposition, dur: 0.1).play; | |
(transposition + 1 / 12).wait; | |
}; | |
(midinote: word.ascii, dur: word.size / 10).play; | |
// pause 1 second between words. | |
((word.size/10)+0.4).wait; | |
}; | |
}.fork; | |
) | |
//: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment