Solution :
This error "only length-1 arrays can be converted to Python scalars" is raised when the function expects a single value but you pass an array instead.
PFB code will solve your issue
import numpy as np
import matplotlib.pyplot as plt
def f(x):
return np.int(x)
f2 = np.vectorize(f)
x = np.arange(1, 15.1, 0.1)
plt.plot(x, f2(x))
plt.show()
You can skip the definition of f(x) and just pass np.int to the vectorize function: f2 = np.vectorize(np.int).
Further Readings:
https://github.com/tyiannak/pyAudioAnalysis/issues/190