danielgomezmarin / rhythmtoolbox

Python code used to analyze and process symbolic drum patterns
8 stars 1 forks source link

Handle non-drum instruments #4

Closed p3zo closed 1 year ago

p3zo commented 1 year ago

Add a drums boolean parameter to the entrypoint functions to indicate whether the input rhythm is from a drum or not. For non-drum instruments, we omit the descriptors that require splitting the input into low/mid/hi bands, since these splits are based on perceptual research that is applicable only to drum rhythms. The descriptors that are valid for non-drum instruments are:

This means we added four new descriptors to the result object: balance, evenness, sync, and syness. These were previously only used as intermediate values to calculate low/mid/hi/poly descriptors, but now we include them in the output because they are not redundant for non-drum instruments.

Also included a few improvements like consistently using camelCase for descriptor names, consistently using snake_case for function names, expanding "D" to "Density", and moving the list of descriptor names out of a function so that it can be imported.