History

update demo-tempo to new gnuplot functions, fix audio yrange for -acf update demo-tempo to new gnuplot functions, fix audio yrange for -acf

Paul Brossier committed 20 years ago

Commit dbd19ea1 parent 33cf5412 files · +8 −29Browse files

Showing the changes to python/test (2 of 2 files). Show all

Unified · Split

2 files
  1. python/test/bench/tempo/demo-tempo +3 −11
  2. python/test/bench/tempo/demo-tempo-acf +5 −18
python/test/bench/tempo/demo-tempo+3−11
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 import sys,time
88 from aubio.task import taskbeat,taskparams
99 from aubio.aubioclass import fvec, aubio_autocorr
10−from aubio.gnuplot import gnuplot_create
10+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
1111 from aubio.aubiowrapper import *
1212 from math import exp,log
1313
@@ -22,15 +22,7 @@ def parse_args(): · 8 unmodified lines
2222 parser.add_option("-n","--printframe",
2323 action="store", dest="printframe", default=-1,
2424 help="make a plot of the n_th frame")
25− parser.add_option("-x","--xsize",
26− action="store", dest="xsize", default=1.,
27− type='float', help="define xsize for plot")
28− parser.add_option("-y","--ysize",
29− action="store", dest="ysize", default=1.,
30− type='float', help="define ysize for plot")
31− parser.add_option("-O","--outplot",
32− action="store", dest="outplot", default=None,
33− help="save plot to output.{ps,png}")
25+ gnuplot_addargs(parser)
3426 (options, args) = parser.parse_args()
3527 if not options.filename:
3628 print "no file name given\n", usage
@@ -54,7 +46,7 @@ if options.outplot and printframe > 0: · 17 unmodified lines
5446 else:
5547 extension = ''
5648 outplot = None
57−f = gnuplot_create(outplot=outplot,extension=extension)
49+f = gnuplot_create(outplot=outplot,extension=extension,options=options)
5850
5951 params = taskparams()
6052 params.onsetmode = 'specdiff'
python/test/bench/tempo/demo-tempo-acf+5−18
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 import sys,time
88 from aubio.task import taskbeat,taskparams
99 from aubio.aubioclass import fvec, aubio_autocorr
10−from aubio.gnuplot import gnuplot_create
10+from aubio.gnuplot import gnuplot_create, gnuplot_addargs
1111 from aubio.aubiowrapper import *
1212 from math import exp,log
1313
@@ -22,15 +22,7 @@ def parse_args(): · 8 unmodified lines
2222 parser.add_option("-n","--printframe",
2323 action="store", dest="printframe", default=-1,
2424 help="make a plot of the n_th frame")
25− parser.add_option("-x","--xsize",
26− action="store", dest="xsize", default=1.,
27− type='float', help="define xsize for plot")
28− parser.add_option("-y","--ysize",
29− action="store", dest="ysize", default=1.,
30− type='float', help="define ysize for plot")
31− parser.add_option("-O","--outplot",
32− action="store", dest="outplot", default=None,
33− help="save plot to output.{ps,png}")
25+ gnuplot_addargs(parser)
3426 (options, args) = parser.parse_args()
3527 if not options.filename:
3628 print "no file name given\n", usage
@@ -54,7 +46,7 @@ if options.outplot and printframe > 0: · 17 unmodified lines
5446 else:
5547 extension = ''
5648 outplot = None
57−f = gnuplot_create(outplot=outplot,extension=extension)
49+f = gnuplot_create(outplot,extension,options)
5850
5951 params = taskparams()
6052 params.onsetmode = 'specdiff'
@@ -107,13 +99,6 @@ rwv = [(i+1.)/rayparam**2 * exp(-(i+1.)**2 / (2.*rayparam)**2) · 46 unmodified lines
10799 for i in range(0,laglen)]
108100 acf = fvec(winlen,1)
109101
110−if options.outplot and printframe > 0:
111− extension = options.outplot.split('.')[-1]
112− outplot = '.'.join(options.outplot.split('.')[:-1])
113−else:
114− extension = ''
115− outplot = None
116−f = gnuplot_create(outplot=outplot,extension=extension)
117102 nrframe = 0
118103 while (task.readsize == params.hopsize):
119104 task()
@@ -149,12 +134,14 @@ while (task.readsize == params.hopsize): · 29 unmodified lines
149134 f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
150135 f('set orig %f,%f' % (0.0*xsize,0.66*ysize) )
151136 f('set xrange [%f:%f]' % (0,btstep*hopsize) )
137+ f('set yrange [%f:%f]' % (-1.2*max(sig),1.2*max(sig)) )
152138 f.title('Input signal')
153139 f.xlabel('time (samples)')
154140 f.plot(*d[0])
155141 f('set size %f,%f' % (1.0*xsize,0.33*ysize) )
156142 f('set orig %f,%f' % (0.0*xsize,0.33*ysize) )
157143 f('set xrange [%f:%f]' % (-winlen,0) )
144+ f('set autoscale y')
158145 f.title('Onset detection function')
159146 f.xlabel('time (df samples)')
160147 f.plot(*d[1])

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t