Files
@ 62dc1b3644a0
Branch filter:
Location: light9/bin/attic/wavecurve - annotation
62dc1b3644a0
1.4 KiB
text/plain
collector client uses rdf types, not strings
4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 4556eebe5d73 | #!bin/python
import optparse
from run_local import log
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 = open(outpath, 'w')
for time_val in points:
print("%s %s" % time_val, file=f)
log.info(r'Wrote {outpath}')
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",
"--all",
action="store_true",
help="make standard curves for all songs")
options, args = parser.parse_args()
if options.all:
from light9 import showconfig
from light9.ascoltami.playlist import Playlist
graph = showconfig.getGraph()
playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri())
for song in playlist.allSongs():
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)
|