Skip to content

Instantly share code, notes, and snippets.

@youpy
Created January 2, 2010 14:42
Show Gist options
  • Select an option

  • Save youpy/267514 to your computer and use it in GitHub Desktop.

Select an option

Save youpy/267514 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'scissor/echonest'
require 'pit'
config = Pit.get('echonest.com', :require => {
'api_key' => 'your Echo Nest API key'
})
Scissor.echonest_api_key = config['api_key']
def main
if ARGV.size != 2
puts "usage: #$0 infile outfile"
exit
end
infile, outfile = ARGV
results = []
Scissor(infile).beats.each_with_index do |beat, index|
results << beat if index % 4 != 3
end
Scissor.join(results) >> outfile
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment