<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 &larr; Back to Index
Spectral Features
For classification, we're going to be using new features in our arsenal
Step1:  librosa.feature.spectral_bandwidth
librosa.feature.spectral_bandwidth
Step2:  librosa.feature.spectral_contrast
librosa.feature.spectral_contrast
Step3:  librosa.feature.spectral_rolloff
librosa.feature.spectral_rolloff
<ASSISTANT_TASK:>
Python Code:
x, fs = librosa.load('simple_loop.wav')
IPython.display.Audio(x, rate=fs)
spectral_centroids = librosa.feature.spectral_centroid(x, sr=fs)
plt.plot(spectral_centroids[0])
Explanation: &larr; Back to Index
Spectral Features
For classification, we're going to be using new features in our arsenal: spectral moments (centroid, bandwidth, skewness, kurtosis) and other spectral statistics.
[Moments](https://en.wikipedia.org/wiki/Moment_(mathematics) is a term used in physics and statistics. There are raw moments and central moments. 
You are probably already familiar with two examples of moments: mean and variance. The first raw moment is known as the mean. The second central moment is known as the variance.
librosa.feature.spectral_centroid
librosa.feature.spectral_centroid
End of explanation
spectral_bandwidth = librosa.feature.spectral_bandwidth(x, sr=fs)
plt.plot(spectral_bandwidth[0])
Explanation: librosa.feature.spectral_bandwidth
librosa.feature.spectral_bandwidth
End of explanation
spectral_contrast = librosa.feature.spectral_contrast(x, sr=fs)
# For visualization, scale each feature dimension to have zero mean and unit variance
spectral_contrast = sklearn.preprocessing.scale(spectral_contrast, axis=1)
librosa.display.specshow(spectral_contrast, x_axis='time')
Explanation: librosa.feature.spectral_contrast
librosa.feature.spectral_contrast
End of explanation
spectral_rolloff = librosa.feature.spectral_rolloff(x, sr=fs)
plt.plot(spectral_rolloff[0])
Explanation: librosa.feature.spectral_rolloff
librosa.feature.spectral_rolloff
End of explanation
<END_TASK>