-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathone.py
More file actions
37 lines (31 loc) · 858 Bytes
/
one.py
File metadata and controls
37 lines (31 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# encoding: utf=8
"""
one.py
Digest only the first beat of every bar.
By Ben Lacker, 2009-02-18.
"""
import echonest.remix.audio as audio
usage = """
Usage:
python one.py <input_filename> <output_filename>
Example:
python one.py EverythingIsOnTheOne.mp3 EverythingIsReallyOnTheOne.mp3
"""
def main(input_filename, output_filename):
audiofile = audio.LocalAudioFile(input_filename)
bars = audiofile.analysis.bars
collect = audio.AudioQuantumList()
for bar in bars:
collect.append(bar.children()[0])
out = audio.getpieces(audiofile, collect)
out.encode(output_filename)
if __name__ == '__main__':
import sys
try:
input_filename = sys.argv[1]
output_filename = sys.argv[2]
except:
print usage
sys.exit(-1)
main(input_filename, output_filename)