Created
June 8, 2016 01:36
-
-
Save tatecarson/9eacb696c3470b81a07e293d0a22eaba to your computer and use it in GitHub Desktop.
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
SpearRead { | |
//originally written by Lukas Nowak | |
*new { |filePath, time| | |
^super.new.initClass(filePath, time) | |
} | |
initClass { |filePath, time| | |
var file; | |
var freq = List.new; | |
var ratio = List.new; | |
var amp = List.new; | |
var data; | |
var line; | |
file = FileReader.read(filePath); | |
line = (time*100)+5; | |
data = file.at(line); | |
data.removeAt(0); | |
data.removeAt(1); | |
data.do | |
({ | |
arg element, index; | |
if(index%3 == 1) | |
{ | |
freq.add(element.asFloat); | |
}; | |
if(index%3 == 2) | |
{ | |
amp.add(element.asFloat); | |
}; | |
}); | |
freq.do | |
({ | |
arg element, index; | |
ratio.add(element/freq.at(0)); | |
}); | |
^[freq.asArray, ratio.asArray, amp.asArray]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lukas NowOk (just for the sake of correctness). cheers ;)