Files
@ b05423b17c46
Branch filter:
Location: light9/bin/wavecurve - annotation
b05423b17c46
1.3 KiB
text/plain
remove curvecalc's old intro/post cheats, replace with slightly better ones
Ignore-this: abdfdba8eedd6e050f88d3f4b0d82efc
Ignore-this: abdfdba8eedd6e050f88d3f4b0d82efc
4a51d4eefa95 4a51d4eefa95 4a51d4eefa95 4a51d4eefa95 4a51d4eefa95 7771f37252da 7771f37252da 7771f37252da 5a83935377f9 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 4a51d4eefa95 4a51d4eefa95 7771f37252da 7771f37252da 4a51d4eefa95 4a51d4eefa95 4a51d4eefa95 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da 7771f37252da | #!/usr/bin/env python
import os, sys, optparse
import run_local
from light9.wavepoints import simp
def createCurve(inpath, outpath, t):
print "reading %s, writing %s" % (inpath, outpath)
points = simp(inpath.replace('.ogg', '.wav'), seconds_per_average=t)
f = file(outpath, 'w')
for time_val in points:
print >>f, "%s %s" % time_val
parser = optparse.OptionParser(usage="""%prog inputSong.wav outputCurve
You probably just want -a
""")
parser.add_option("-t",type="float",default=.01,
help="seconds per sample (default .01, .07 is smooth)")
parser.add_option("-a", action="store_true",
help="make standard curves for all songs")
options,args = parser.parse_args()
if options.a:
from light9 import showconfig
from light9.namespaces import L9
from rdflib import RDF
graph = showconfig.getGraph()
for song in graph.subjects(RDF.type, L9['Song']):
inpath = showconfig.songOnDisk(song)
for curveName, t in [('music', .01),
('smooth_music', .07)]:
outpath = showconfig.curvesDir() + "/%s-%s" % (
showconfig.songFilenameFromURI(song), curveName)
createCurve(inpath, outpath, t)
else:
inpath,outpath = args
createCurve(inpath, outpath, options.t)
|