ref: dbd19eadceca1d711784b5b67e8286fd157b670a
parent: 33cf5416171abbf82de0baae4735b67edf219e09
author: Paul Brossier <piem@altern.org>
date: Thu Aug 10 10:34:17 EDT 2006
update demo-tempo to new gnuplot functions, fix audio yrange for -acf update demo-tempo to new gnuplot functions, fix audio yrange for -acf
--- a/python/test/bench/tempo/demo-tempo
+++ b/python/test/bench/tempo/demo-tempo
@@ -7,7 +7,7 @@
import sys,time
from aubio.task import taskbeat,taskparams
from aubio.aubioclass import fvec, aubio_autocorr
-from aubio.gnuplot import gnuplot_create
+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
from aubio.aubiowrapper import *
from math import exp,log
@@ -22,15 +22,7 @@
parser.add_option("-n","--printframe",
action="store", dest="printframe", default=-1,
help="make a plot of the n_th frame")
- parser.add_option("-x","--xsize",
- action="store", dest="xsize", default=1.,
- type='float', help="define xsize for plot")
- parser.add_option("-y","--ysize",
- action="store", dest="ysize", default=1.,
- type='float', help="define ysize for plot")
- parser.add_option("-O","--outplot",
- action="store", dest="outplot", default=None,
- help="save plot to output.{ps,png}")
+ gnuplot_addargs(parser)
(options, args) = parser.parse_args()
if not options.filename:
print "no file name given\n", usage
@@ -54,7 +46,7 @@
else:
extension = ''
outplot = None
-f = gnuplot_create(outplot=outplot,extension=extension)
+f = gnuplot_create(outplot=outplot,extension=extension,options=options)
params = taskparams()
params.onsetmode = 'specdiff'
--- a/python/test/bench/tempo/demo-tempo-acf
+++ b/python/test/bench/tempo/demo-tempo-acf
@@ -7,7 +7,7 @@
import sys,time
from aubio.task import taskbeat,taskparams
from aubio.aubioclass import fvec, aubio_autocorr
-from aubio.gnuplot import gnuplot_create
+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
from aubio.aubiowrapper import *
from math import exp,log
@@ -22,15 +22,7 @@
parser.add_option("-n","--printframe",
action="store", dest="printframe", default=-1,
help="make a plot of the n_th frame")
- parser.add_option("-x","--xsize",
- action="store", dest="xsize", default=1.,
- type='float', help="define xsize for plot")
- parser.add_option("-y","--ysize",
- action="store", dest="ysize", default=1.,
- type='float', help="define ysize for plot")
- parser.add_option("-O","--outplot",
- action="store", dest="outplot", default=None,
- help="save plot to output.{ps,png}")
+ gnuplot_addargs(parser)
(options, args) = parser.parse_args()
if not options.filename:
print "no file name given\n", usage
@@ -54,7 +46,7 @@
else:
extension = ''
outplot = None
-f = gnuplot_create(outplot=outplot,extension=extension)
+f = gnuplot_create(outplot,extension,options)
params = taskparams()
params.onsetmode = 'specdiff'
@@ -107,13 +99,6 @@
for i in range(0,laglen)]
acf = fvec(winlen,1)
-if options.outplot and printframe > 0:
- extension = options.outplot.split('.')[-1]
- outplot = '.'.join(options.outplot.split('.')[:-1])
-else:
- extension = ''
- outplot = None
-f = gnuplot_create(outplot=outplot,extension=extension)
nrframe = 0
while (task.readsize == params.hopsize):
task()
@@ -149,6 +134,7 @@
f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
f('set xrange [%f:%f]' % (0,btstep*hopsize) )
+ f('set yrange [%f:%f]' % (-1.2*max(sig),1.2*max(sig)) )
f.title('Input signal')
f.xlabel('time (samples)')
f.plot(*d[0])
@@ -155,6 +141,7 @@
f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
f('set xrange [%f:%f]' % (-winlen,0) )
+ f('set autoscale y')
f.title('Onset detection function')
f.xlabel('time (df samples)')
f.plot(*d[1])