hydrogen
hydrogen copied to clipboard
Add general instrument property to Note and Drumkit
To make a Pattern
independent from a specific Drumkit
some intermediate property is required to map between them.
In this issue I would like to discuss the naming and implementation of the property itself. Since we need to specify them in a xsd file, the list must, unfortunately, the exhaustive.
For starters I would use naming like snare primary
, snare secondary
, ... and go to a depth that still needs to be defined. This concept I would apply to all main instruments and it's up to the person creating the drumkit to decide what is primary, secondary etc. But what's a main instrument? Will there be eight different main toms (with the aforementioned depth since e.g. in Big Mono toms are separated into "hit by left/right hand")? Same for the hihat. All the others are more or less straight forward.
What about the splash and china cymbals? You name them splash
and china
and convey them to a crash
if there are no such cymbals in the drumkit?
The jazzFunkKit has the two rides played on top and on edge. I think the latter ones should be called something like ride edge
and may be conveyed into crash
if ride edge
is not found (and inverse if crash
, nor splash
or china
is not found)
Thinking out loud.
Wouldn't using GM (General MIDI) drumkit be a first step? See #38 for a bit of background information.
As a user, I'd think that when I've got a song and I want to change the drumkit, there is 2 possibilities:
- both drumkits (the current one and the one I want to change to) are GM compliant, hence 99% all good
- one or both isn't/aren't GM compliant, hence I would propose H2 to show me a windows asking how hydrogen should "translate" the different instruments from the current drumkit, to the one I want to change to. On this pop-up window, I could/should be able to play every sounds from both the drumkits to be able to choose what's needed.
This way, it would avoid the burden of being exhaustive, or more likely, trying to be. Thoughts?
propose H2 to show me a windows asking...
I like the idea. Since almost no drumkit is GM compatible, the exhaustive map would allow H2 to propose a mapping, then user may change some (or all) of them in the window and press enter. Otherwise you should map all the instruments manually.
In that case GM is not sufficient
On this windows, I could/should be able to play every sounds from both the drumkits to be able to choose what's needed
User should be able to save the mapping configuration, to import another pattern later
@theGreatWhiteShark do you mean "Add general instrument property to Instrument and Instruments in Drumkit"?
Still thinking out loud here.
I don't understand how we could be exhaustive here. AFAIU, it'll never be possible since what we call a drumkit can be pretty much anything sounding. Think about the circafric drumkit (djembe, dundun, and so on), think about the very strange drumkit I-don-t-remember-its-name-right-now (made during a past H2 competition IIRC) with strings sounds in it, I've got a personal batucada drumkit too, think about a Terry Bozzio usual drumkit, ...etc
User should be able to save the mapping configuration, to import another pattern later
:+1: totally agreed
About, GM drumkit, could it be processed by Hydrogen as a "proposal for the user" maybe?
Maybe calculate and store a signature that's a very, very approximate parametric representation of the spectrum of the instrument sample, and then use that to find the closest sounding instrument in the new kit?
Good points. The statement above was not a proper proposal but just a reminder to tackle the problem at some point.
Let me elaborate my motivation behind the quasi-exhaustive approach:
GM is quite restricted. If kit (a) has one snare and kit (b) has two snares switching between the kits needs some kind of policy to choose which snare of (b) should be used. One could choose at random but I think a reproducible solution is better. Tagging both snares in (b) with snare
and letting the user decide which to pick does via a widget is fine and I also had some graph-like connection view in mind. The problem (or inconvenience) I do see here is that all users have to acquire the information which e.g. snare is best used as the primary one on their own. By providing tags like snare primary
, snare secondary
pondering over which instruments will be available when mapping a song from a GM kit is largely on side of the person designing the kit. Of course, the user can still alter the suggestions but get's a default mapping including a lot prior knowledge. Making it quasi-exhaustive would be a way for us to make the problem tractable. We do a one time major effort to introduce the property, mapping, widget, upgrade ... and than it's just new drumkit designers choosing from a pool of limited tag options (well, as if but hopefully it will be more easy to maintain this way).
AFAIU, it'll never be possible since what we call a drumkit can be pretty much anything sounding.
You are perfectly right. Didn't thought about it. So, there should be a null element requiring a manual interaction upon remapping.
What about the splash and china cymbals? You name them splash and china and convey them to a crash if there are no such cymbals in the drumkit?
The jazzFunkKit has the two rides played on top and on edge. I think the latter ones should be called something like ride edge and may be conveyed into crash if ride edge is not found (and inverse if crash, nor splash or china is not found)
china
and splash
could probably be two different categories. With ride
and ride edge
things are more difficult. This is also a question whether the list of categories should be bloated to the expense of a more simple mapping function or the other way around. I'll try to compile a list of possible categories when I find some time during the next weeks (but, everyone, please feel free to do the same. Since I'm not a drum and most do ufta beats I might miss out some serious subtleties. :D )
@theGreatWhiteShark do you mean "Add general instrument property to Instrument and Instruments in Drumkit"?
Nope. Each Note does carry reference to an instrument so the sampler does now which sample to use during playback. Right now this is just a number representing the nth instrument in the order provided by the drumkit.xml file. Adding the snare primary
property to a Note in a pattern will result in an identical instrument for each drumkit (after mapping). (or none. If the drumkit consists of just hihat sample the note should not be mapped)
Maybe calculate and store a signature that's a very, very approximate parametric representation of the spectrum of the instrument sample, and then use that to find the closest sounding instrument in the new kit?
Programming parametric representations of spectra and using them to define distances between instruments sounds like so much more fun than all of the things I suggested. But I think it would make switching drumkits less stable and way harder to maintain. E.g. how do we preprocess the samples? Does one average over the spectra of all samples or just at a specific velocity? Does one take the user settings, like ADSR and pitch shift, into account? Also, it doesn't allow a person designing a drumkit to specify the mapping behavior. Nevertheless, I think it would be a nice additional source of information.
Maybe calculate and store a signature that's a very, very approximate parametric representation of the spectrum of the instrument sample, and then use that to find the closest sounding instrument in the new kit? Programming parametric representations of spectra and using them to define distances between instruments sounds like so much more fun than all of the things I suggested.
I'm not entirely sure how serious I was being, but I'm going to answer the questions I can, because that's fun too ;)
But I think it would make switching drumkits less stable and way harder to maintain.
Absolutely, but potentially a useful default to be used with an explicit override property of some sort.
E.g. how do we preprocess the samples? Does one average over the spectra of all samples or just at a specific velocity?
I'd guess just at a middling velocity. The samples in a kit should be fairly consistent in spectrum across velocities, just with potential for saturation of lower frequencies, stronger high harmonics and maybe spread from clipping as velocity increases. If they weren't consistent, then it would be a fairly strange instrument! The 'middle' velocities would be most representative of the 'character' of the instrument so that seems best to take as a "signature".
Does one take the user settings, like ADSR and pitch shift, into account?
Yes. Overall pitch can be normalised to the fundamental harmonic and a shift applied to match the old and new samples. New ADSR can be calculated to fit the new sample's envelope to the old sample's fairly easily I think by fitting overall volume.
Each Note does carry reference to an instrument so the sampler does now which sample to use during playback. Right now this is just a number representing the nth instrument in the order provided by the drumkit.xml file
Sorry, I am not following it: I thought to a list something like this in the pattern file:
<genInstrList>
<instr>
<refNumber>1<\refNumber>,
<genInstrTag>kick primary<\genInstrTag>
<\instr>
<instr>
<refNumber>2<\refNumber>,
<genInstrTag>snare primary<\genInstrTag>
<\instr>
<!-- ... -->
<\genInstrList>
And add a new tag member to just the instrument
class
Right now the pattern file does contain a list of notes of the following type
<note>
<position>0</position>
<leadlag>0</leadlag>
<velocity>0.8</velocity>
<pan_L>0.5</pan_L>
<pan_R>0.5</pan_R>
<pitch>0</pitch>
<probability>1</probability>
<key>C0</key>
<length>-1</length>
<instrument>9</instrument>
</note>
I would just replace the number in the snare primary
. The actual mapping of an instrument in the drumkit to the more general tag (and thus to the pattern) I would only store in the .h2song file. This keeps the pattern light-weighted and independent of a particular drumkit.
I see. So for any drumkit, all the instruments need a unique tag