Skip to content

jfriend08/MusicClassification

Repository files navigation

Music Genre Classification

Procedure

  • Download GTZAN dataset
  • Pre-process data, including re-sampling and cliping
  • mv process.sh under genres and will auto perform pre-process. So each music which all with 30s length will be trim for 10 clip, each clip is 3s, sampling rate is 22050 Hz
sox -r 22050 $j "$NAME"_clip1.au trim 0 3
sox -r 22050 $j "$NAME"_clip2.au trim 3 3
sox -r 22050 $j "$NAME"_clip3.au trim 6 3
...
  • Pre-processed data can be downloaded HERE

Materialize data

  • Need scipy installed
  • pythonize.py needs to be in the same directory of genres_processed

Mel Filter Bank

  • Package is downloaded HERE
  • Make sure numpy is imported in hpc environment, and make sure ssh -X into hpc
module load python/intel/2.7.6
  • Run
python signalScattering.py
  • You will see figures generated alt text alt text
  • Low-pass filter (order of 6) will be designed by scipy.signal.butter, and filtered by scipy.signal.lfilter. alt text
  • Low-pass filter (order of 6) will be designed by scipy.signal.butter, and filtered by scipy.signal.lfilter. Here is an example of on of classical clip being filtered by 50Hz low-pass alt text

Scattering Procedures

if __name__ == '__main__':
  '''Get my mel-frequency bank'''
  melmat, (melfreq, fftfreq) = generate_melbank(0, 6000)

  '''Transfrom mel-frequency to time domain'''
  melmat_time = freq2timeDomain(melmat)

  '''Read in data'''
  # samples = pickle.load( open( "./data/data.in", "rb" ) )
  samples_small = pickle.load( open( "./data/data_small.in", "rb" ) )

  '''Example of performing lowpass on given signal'''
  y = butter_lowpass_filter(samples_small['classical'][0][0], 50, 22050, 6)

  '''samples_small_scattered will be the scattered result (plus lowpass filtered) from samples_small'''
  samples_small_scattered = scatteringHandler(melmat_time, samples_small)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published