Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatecarson/9eacb696c3470b81a07e293d0a22eaba to your computer and use it in GitHub Desktop.
Save tatecarson/9eacb696c3470b81a07e293d0a22eaba to your computer and use it in GitHub Desktop.
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];
}
}
@LukasNowok
Copy link

Lukas NowOk (just for the sake of correctness). cheers ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment