I have a .csv file with information about a soundtrack and it is divided into beats (per minute), which are ordered by row. As in: the index corresponds to each beat, and the columns have info about what is going on in each beat. The idea is to train a model to be able to infer similar data from any given song following the example of the .csv. [EDIT] Take into account that, in this specific case, the beats per minute do not vary in length, but rather, have a constant, fixed time in each song. The BPM may vary between songs but not within them.

I already have tried some different ways to make a spectrogram. Now, I need to divide it into beat-sized chunks to train a deep neural network.

I used the librosa.core.spectrum to create a logarithmic spectrogram out of a .wav file. I have tried looking for tutorials on how to use spectrograms to train DNNs but they already have separated sound files which they then convert into a spectrogram. Or else they cite papers with a close solution with no code given (take into account that I am a Python beginner).

I need to take a spectrogram and divide it into chunks the size and duration of a beat (total number of beats = beats per minute multiplied by the length of the song), but I don't know where to begin looking for guidance on that process.

Unless there's a different way to relate each beat in the .csv to each segment of the spectrogram? What would you recommend?

  • $\begingroup$ How complex is the relationship between time and musical beat in your training data in general? If it's all modern dance, rock, pop, and without any timing-affecting expression like ritardo, accelerando, pauses or free expression, then your task can maybe be handled with relatively simple tools. But a lot of real music won't fit that $\endgroup$ Commented May 19 at 15:17
  • $\begingroup$ @NeilSlater Not complex at all. It is almost abstract. Specific colors and off-on commands for a lamp, fog machine activation, and so on. It is less about the music itself and more about what happens at certain points of the song at the night club. $\endgroup$ Commented May 20 at 8:07
  • $\begingroup$ That sounds like your data per beat is simple, but not quite what I was asking. Does each piece of music have a fixed and precise timing, with little flexibility? E.g. electronic dance music written on a sequencer with a fixed bpm per song would have simple and precise timing, whilst a recording of an orchestral piece performed by humans probably would not. Extracting beat timings will be a lot easier and simpler in the former case. $\endgroup$ Commented May 20 at 8:13
  • $\begingroup$ @Neil Slater Ah, sorry about the confusion. No, no tempo rubato, no change in tempo, no pauses, no variation in speed and no variation in beat length. In this specific case, BPM is less about musical tempo and more of a technician's hack to slice time in regular intervals for the sake of data entry. $\endgroup$ Commented May 20 at 8:27


You must log in to answer this question.