view swig/python/test.py @ 96:757e6f99dcd7

Dan Stowell: Removed strange "zeroing" part of xtract_mfcc() which was zeroing a load of elements despite the fact that they're ignored by the DCT process called next, and never used for anything. This was writing to an assumed large result array (same size as number of FFT bins) despite the fact that only a small number of MFCCs (typically less than 50) are required, therefore either wasting memory or writing to memory it shouldn't do!
author Dan Stowell <danstowell@gmail.com>
date Wed, 03 Oct 2007 13:43:16 +0000
parents 35a3bb5c3ffd
children 1cbbe5b5e461
line wrap: on
line source
#!/usr/bin/python

try:
    import xtract
except ImportError:
    print 'Failed to load the library "jxtract"'

print '\nRunning libxtract Python bindings test...\n'

len = 5

a = xtract.floatArray(len)
temp = []

for i in range(0, len):
    a[i] = 2 * i
    temp.append(str(a[i]))

print 'The mean of ' + ', '.join(temp) + ' is: %.2f' % \
	  xtract.xtract_mean(a,len,None)[1]

print '\nFinished!\n'