Classification of Separated Signals

Follow the K-NN example in Lab 1, but classify the separated signals.

As in Lab 1, extract features from each training sample in the kick and snare drum directories.

Train a K-NN model using the kick and snare drum samples:


In [3]:
import numpy as np

labels = np.empty(20, np.int32)
labels[0:9] = 1 # First 10 are the first sample type, e.g. snare
labels[10:20] = 2 # Second 10 are the second sample type, e.g kick

model_snare = KNeighborsClassifier(n_neighbors = 1)
model.fit(scaledTrainingFeatures, labels.take(train_index, 0))
model_output = model_snare.predict(scaledTestingFeatures)


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-914682621b17> in <module>()
      5 labels[10:20] = 2 # Second 10 are the second sample type, e.g kick
      6 
----> 7 model_snare = KNeighborsClassifier(n_neighbors = 1)
      8 model.fit(scaledTrainingFeatures, labels.take(train_index, 0))
      9 model_output = model_snare.predict(scaledTestingFeatures)

NameError: name 'KNeighborsClassifier' is not defined
  1. Extract features from the drum signals that you separated in Lab 4 Section 1.

  2. Classify them using the K-NN model that you built.

    Does K-NN accurately classify the separated signals?

  3. Repeat for different numbers of separated signals (i.e., the parameter K in NMF).

  4. Overseparate the signal using K = 20 or more. For those separated components that are classified as snare, add them together using `sum}. The listen to the sum signal. Is it coherent, i.e., does it sound like a single separated drum?

...and more!

  • If you have another idea that you would like to try out, please ask me!
  • Feel free to collaborate with a partner. Together, brainstorm your own problems, if you want!

Good luck!