Created
September 22, 2011 23:43
-
-
Save edeleflie/1236367 to your computer and use it in GitHub Desktop.
Use Data to drive a synth
This file contains hidden or 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
/* | |
Data from: | |
http://www.bom.gov.au/climate/dwo/201108/html/IDCJDW2014.201108.shtml | |
http://www.bom.gov.au/climate/dwo/201108/text/IDCJDW2014.201108.csv | |
*/ | |
// open file, read and put strings into array, close file. | |
x = CSVFileReader.read("/Users/etiennedeleflie/Documents/teaching/music_synthesis/09/weather_data.201108.csv", true); | |
// some sound | |
// ~orchestra= Buffer.read(s, "/Users/etiennedeleflie/Documents/teaching/music_synthesis/09/pithoprakta.wav"); | |
~orchestra= Buffer.read(s, "/Users/etiennedeleflie/Documents/teaching/music_synthesis/09/pizzicatos.wav"); | |
~first_filter = Synth("auditory_s_s", [ \in, 100, \out, 0, \room, 0.1, \pan, 0.7, \mix, 0.3, \source_vol, 0.1, \stereoWidthVol, 1.0, \stereoWidthAmount, 0.00 ]); // try a rate of 0.1 | |
~xenakish_1 = Synth("Xenakish", [ \out, 100, \soundFile, ~orchestra, \speed, 1.0, \goTo, 0.5, \grainLength, 0.05, \triggerGrainEvery, 0.01, \randomPosSpread, 0.008, \t_ramp, 1 ]); | |
// This bit of code is like a hand-written pattern | |
// Every second, | |
( | |
fork { | |
(1..31).do { |day| | |
// start at minimum temp | |
// ~xenakish_1.set(\goTo, x[day][2].asFloat / 25.0, \goIn, 0, \t_ramp, 1); | |
// go to maximum temp | |
~xenakish_1.set(\goTo, x[day][3].asFloat / 25.0, \goIn, 2000, \t_ramp, 1); | |
// maps randomSpread to humidity | |
~xenakish_1.set(\randomPosSpread, x[day][4].asFloat ); | |
// ~first_filter.set(\stereoWidthAmount, x[day][4].asFloat ); | |
// wait 1 second before moving on | |
2.0.wait | |
} | |
}; | |
) | |
// You can see what each column is like this | |
// x[day][column] | |
x[0][1].postln(); | |
x[0][2].postln(); | |
x[0][3].postln(); | |
x[0][4].postln(); | |
// etc | |
// max temp on the 15th day | |
x[15][3].postln(); | |
// min temp on the 15th day | |
x[15][2].postln(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment