fetching the music data we will use the gtzan datasetwhich is frequently used to benchmark music genre classification tasks it is organized into distinct genresof which we will use only six for the sake of simplicityclassicaljazzcountrypoprockand metal the dataset contains the first seconds of songs per genre we can download the dataset at recorded at , hz ( , readings per secondmono in the wav format converting into wave format sure enoughif we would want to test our classifier later on our private mp collectionwe would not be able to extract much meaning this is because mp is lossy music compression format that cuts out parts that the human ear cannot perceive this is nice for storing because with mp you can fit ten times as many songs on your device for our endeavorhoweverit is not so nice for classificationwe will have an easier time with wav filesso we will have to convert our mp files in case we would want to use them with our classifier in case you don' have conversion tool nearbyyou might want to check out soxarmy knife of sound processingand we agree with this bold claim one advantage of having all our music files in the wav format is that it is directly readable by the scipy toolkitsample_ratex scipy io wavfile read(wave_filenameherex contains the samples and sample_rate is the rate at which they were taken let us use this information to peek into some music files to get first impression of what the data looks like looking at music very convenient way to get quick impression of how the songs of the diverse genres "looklike is to draw spectrogram for set of songs of genre spectrogram is visual representation of the frequencies that occur in song it shows the intensity of the frequencies on the axis in the specified time intervals on the axisthat isthe darker the colorthe stronger the frequency is in the particular time window of the song