Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

midi : midi out only : using instrument as sequencer for external app #63

Open
thijz opened this issue Nov 29, 2012 · 17 comments
Open

midi : midi out only : using instrument as sequencer for external app #63

thijz opened this issue Nov 29, 2012 · 17 comments

Comments

@thijz
Copy link
Member

thijz commented Nov 29, 2012

currently if you want to use a H2 instrument as a pure sequencer (ie the notes in the pattern are only sent out as MIDI notes. H2 does not generate any sound) you MUST still load a long empty wav file into that instrument.
if you do not do this the MIDI notes will have a duration of 0. as a consequence the external app will not play anything.

the best option would be that H2 always sends out MIDI notes regardless of the duration of the loaded WAV file
an alternative would be to add a 'MIDI out only' tickbox on the General tab of the Instrument editor that automatically loads a 'very long' empty WAV into that instrument

this second option however is only a quick workaround

comment by Chris Mennie :
The purpose of having an associated sound file (which admittedly is a huge hack) is to tell Hydrogen how long to hold the note before a note off message is sent. So it's not just a case of specifying a "very long" duration of sound file because different drum sounds require different play lengths.

As far as the code goes, I believe it'd be straight forward to define a default note length to use when there's no associated sound sample. However, this doesn't really solve the real issue (though it does go much farther than what's currently in place). I don't know how it should be presented, but the user needs to be able to specify the note length (via the UI? via midi input?).

@a13
Copy link

a13 commented Jun 21, 2013

The purpose of having an associated sound file (which admittedly is a huge hack) is to tell Hydrogen how long to hold the note before a note off message is sent.

I think drum samplers don't care about note off messages

but the user needs to be able to specify the note length

definitely

via the UI? via midi input?

somewhere in editor window, between size and resolution combos

@Michael-Z-Freeman
Copy link

I've been using Hydrogen to drive drums created by Yoshimi (Zynaddsubfx variant). The sequencing works OK, but unless I'm missing a setting somewhere, none of the controls actually change how the MIDI out note is being handled. No velocity. No cutoff. No use of mixer faders. Surely they should all alter the MIDI output ? Unless this all conflicts with Hydrogen design philosophy or approach in some way ? I would see adding this as an advantage for Hydrogen as using pure generated percussion sounds from Yoshimi (and the many other drum generators out there) sounds vastly superior to samples.

@elpescado
Copy link
Contributor

I don't see connection between sample lengths and note lengths. When MIDI note is sent to external sampler, its most likely that samples played by external sampler have different length than smaples loaded into Hydrogen.

Besides, drum samplers doesn't seem to care. I have created MIDI file with quarter, eighth, sixteenth ans 1/32 notes played, and both Addictive Drums and Steven Slate Drums (two samplers I have access to) play every note the same. I have included the same track played by synthesizer, to hear the difference:
ableton
https://dl.dropboxusercontent.com/u/1474460/Hydrogen/Drum%20Test%201-SSDSampler.aif
https://dl.dropboxusercontent.com/u/1474460/Hydrogen/Drum%20Test%202-Addictive%20Drums.aif
https://dl.dropboxusercontent.com/u/1474460/Hydrogen/Drum%20Test%204-minimoog%20V%20Original.aif

So I assume that using arbitrary note length (eg. a quaver), or just assuming that note ends when next note begins will be "good enough".

@thijz
Copy link
Member Author

thijz commented Feb 20, 2015

similar to #57 and #195

@rghvdberg
Copy link

I've tried to use H2 as a sequencer for synthesized drums.
It failed horribly because the Note On / Off messages overlapped - the Note On message was sent before the Note Off message.
Maybe sent the Off message just before the new note on message ?
This will of course result in notes with different lengths but that would be better then cut notes.

@Yaoir
Copy link

Yaoir commented May 25, 2017

I looked in the MIDI 1.0 specification to see if there was a recommended way to handle note off events for one-shot sounds (such as drum hits), and couldn't find anything. But it did say that every note on should be followed by a note off.

I think the only sensible way to handle this is for Hydrogen to emit a note off immediately following the note on, and assume the receiver will ignore the note off. Sending the note off when the internal sample finishes playing is simply wrong. It makes no sense, and according to rghvdberg can cause problems.

(Actually, an exception to that is when a note is entered into the pattern with a MIDI keyboard, and has a duration. It shows up as a horizontal bar instead of a dot in the pattern. Then Hydrogen would send the note off at the end of the bar. Actually, this may be the best general way to handle it because notes entered with the mouse have a zero duration. I hope I got that right!)

While figuring this stuff out, it occurred to me that simple bass/synth riffs could be handled by Hydrogen by adding an instrument for each note in the bass/synth riff and recording it from a MIDI keyboard. But for that to work, the MIDI note off events must be handled right, as I described in the above paragraph.

In any case, I suggest that the subject of controlling MIDI devices from Hydrogen be written up in the manual. The way Hydrogen currently acts definitely needs to be documented there because it's very unintuitive, and without proper documentation, anyone who creates a new instrument with the sole purpose of sending MIDI to a synth will have problems.

@m-grabner
Copy link
Contributor

I had the same problem and opened a separate tracker issue (#533), elpescado redirected me here. With the code modified as posted under #533, I get a "note off - note on - note off" sequence in a very short time (some milliseconds) for each note in Hydrogen, and when connected to LinuxSampler, the notes are played as expected (i.e., "note off" messages are ignored). With unmodified Hydrogen-0.9.7, only "not off" messages are produced, which certainly don't trigger any sound output in LinuxSampler.

BTW, not everyone agrees with a "note off" being required after each "note on". There is a MIDI tutorial (http://www.music-software-development.com/midi-tutorial.html) where percussion instruments are explicitly excluded from this rule. Why not simply create a checkbox "Generate note-off" near the checkbox "Ignore note-off" and let the user decide? Variable-length note are probably harder to implement, and not really useful in a drum machine.

Markus

@thijz
Copy link
Member Author

thijz commented Nov 4, 2017

@Yaoir : very interesting observation about the different behavior when recording the note using a midi device and entering it manually.
When you did this test, did you have a sample loaded in the instrument you were recording the midi notes for ? or was it an empty instrument ?

@m-grabner : you are correct about not requiring a 'note off' for percussion instruments, and the option to simply not send any note off messages would indeed be a nice addition. But keep in mind that quite a few people (including me :-) use H2 not only for drums, but also as a synth sequencer. In that scenario the note off is obviously very relevant :-)

@mauser
Copy link
Member

mauser commented Feb 16, 2018

Hi,

i suppose that adding an "Omit NoteOff at end of sample" option should be easy to implement and would be helpful in such use cases.

@thijz : This could be a nice method to define note length for empty samples.. I will have a look into this..

@elpescado
Copy link
Contributor

@thijz there are two kinds of notes in Hydrogen. "Dots", and "rectangles" which have defined duration. That option should affect only "dots".

@thijz
Copy link
Member Author

thijz commented Feb 21, 2018

@elpescado : good observation, so a dot would be a 'percussion note' (=only note ON) and a rectangle would be the equivalent of the traditional midi notation in most DAWs like cubase/logic : a 'note on' at the beginning of the rectangle, and a 'note off' at the end.

So this means that for the 'rectangle' the length of the sample should never affect the midi note on/off messages, right ?

@elpescado
Copy link
Contributor

What's the idea behind sending note off when sample playback ends anyway? For me it doesn't make any sense, but I might be missing something.

In my opinion, there are two cases to consider.

  1. Square notes - this one is clear, "note on" when note starts, "note off" when note ends
  2. Dot notes - here are few possibilities
  • don't send note off at all
  • send note off when sample playback ends (prohibits using Hydrogen as sequencer only)
  • send note off instantly after note on
  • send note off after predefined interval (eg. 1/4)

We should discuss whether this should be hardcoded or configurable, and in latter case, on what level (song vs application).

I lean towards not sending note-off messages for "dot" notes. I think it's in line with MIDI spec (see @m-grabner comment above).

@thijz
Copy link
Member Author

thijz commented Feb 23, 2018

+1 for dot=note ON only
all other use cases just dont make sense

@mauser
Copy link
Member

mauser commented Feb 23, 2018

@thijz , @elpescado :

Would you be willing to create a wiki page with the use cases and the description of the current situation concerning note off? This could be a help with the discussion for the moment and a good documentation for the future. Thijz, i remember that you also mentioned note off problems when using the Panic button.

Another thing: I suppose the midi export has also to be considered. Maybe there it makes sense to embed also note off notes at sample end? Since we don't know to what machines/synths those midi tracks will be fed to..

@thijz
Copy link
Member Author

thijz commented Feb 26, 2018

@mauser : ok, will do
@elpescado : as soon as i have something i will post it here and invite you to add more info to the page

@thijz
Copy link
Member Author

thijz commented Feb 27, 2018

wiki page :
https://github.com/hydrogen-music/hydrogen/wiki/MIDI-implementation---current-state-and-usecases

This wiki page is work in progress, feel free to add/comment

@elpescado
Copy link
Contributor

My use case is using Hydrogen as pure sequencer in tandem with external sampler, so sound is generated solely by second application. In that case, I'd like to create a drumkit, assign MIDI notes to instruments but not load any sample sounds.

However, Hydrogen refuses to play MIDI notes unless there's at leas one sample assigned to instrument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants