Lmms: Better MIDI support

Created on 20 Dec 2014  Â·  45Comments  Â·  Source: LMMS/lmms

This is a placeholder to consolidate MIDI related issues. If a new MIDI enhancement is reported on the tracker, close it out and mark it as a duplicate of this bug (and naturally add to this list as needed) (#1472)

Note: As opposed to our other placeholder bug reports, MIDI is slightly different as it is mostly feature-complete. Version-specific MIDI bugs should remain open and tracked on a per-version basis. Don't close out valid bug reports simply because they use the word "MIDI" in them, first make sure they aren't attributed to a specific build. :+1:


Basic Functionality:

  • [ ] LMMS should not manipulate the raw incoming MIDI streams #1857 [Milestone: 1.3]
  • [ ] Internal routing/support for MIDI-generating plugins/effects (e.g. BlueARP) #3485
  • [ ] MIDI import should support pitch bend range #1967
  • [ ] MIDI export support #258, #699 (via #1686, reverted via #3114 per #2384)
  • [ ] (Windows) empty/assignable MIDI channel #793 (Related #3485)
  • [x] (Apple) basic MIDI support #1153

Enhanced Functionality:

  • [ ] Simultaneous multi-track recording #4603
  • [ ] Expose MIDI controls (all 128 CC messages) #1159

    • [ ] MIDI play/pause/stop/record #1071 #4837

    • [ ] MIDI move loop #1071

    • [ ] MIDI bank-selection (MSB) support #62

    • [ ] MIDI pitch-bend recording support #1918, #3724

    • [ ] MIDI modulation wheel, sustain pedal and expression pedal support #1918 #1917 #1890 #1700 #1953

    • [ ] MIDI program change support for plugins #5138

  • [ ] Midi timecode output socket (ALSA, JACK #4838)
  • [ ] Allow using the MIDI output of Carla for LMMS' MIDI out #4858
  • [x] Faster access to MIDI assignment/auto-assignment #3400 #1189 #1781 #1918 #1942 #3185
  • [ ] Better MIDI import support/transpose #815 #148 #1918
  • [ ] Game controller MIDI support #695
  • [ ] MIDI mapping using custom key ranges #1743 #1381 #1792 #1460 [Milestone: 1.3]
  • [ ] Better VST effect support (i.e. Autotune, Vocoder) #1202
  • [ ] Multiplexing MIDI channels to a single instrument #1178
  • [ ] Microtonality (Scala .scl files, retuning, etc) #1387
  • [ ] MPE #3439
  • [ ] MIDI clock #3539

Bugs:

  • [x] MIDI import crash #972

Related:

  • (none reported yet)
bug enhancement meta

Most helpful comment

@Cangle50
You are at any moment more than welcome to address any or all of the requests. It will only take most of your spare-time, and you will almost have nothing to explain to other significant ones, about you being glued to a chair infront of a pc, instead of participating in life ..

The devs does an unbelievable job, and nothing is swept anywhere or under anything. Developing takes t i m e, and bug-fixing comes before feature-requests. Be patient, it will come

All 45 comments

@tresf Perhaps we could make this a checklist where we can tick each task as it is completed.

In my case I don't have a fully capable MIDI controller, but would like to work on the Export to MIDI feature.

Take a look at this reference on markdown checklists if you need.

On 12/26/2014 10:17 PM, Amadeus Folego wrote:

@tresf https://github.com/tresf Perhaps we could make this a
checklist where we can tick each task as it is completed.

In my case I don't have a fully capable MIDI controller, but would
like to work on the Export to MIDI feature.

Take a look at this reference
https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments
on markdown checklists if you need.

—

Export to MIDI should be implemented as an export plugin.

You don't need a MIDI controller for it.

I know, I am talking about the _other_ features, this is an example of a feature that does not need a virtual/real midi controller.

So when this task is completed is is marked and we have a sense on how our MIDI support is evolving.

Perhaps we could make this a checklist where we can tick each task as it is completed.

Sounds good. Planned on using strikeout (~~strikeout~~) to mark as done if that sounds OK.

Working on a keyboard layer plugin and keyboard layer track GUI mockup for #1381.

I'm finding midi import crashes LMMS on about 30% of the files I've tried on V1.10, V1.12, Win64 and Win32 versions. These files seem to play OK in Windows Media Player. Audacity imports them OK. Example: http://en.midimelody.ru/midi.php?str=%2Fb%2FBeck%2C%20Jeff%2FBeck%2C%20Jeff%20-%20Blue%20Wind.mid

Probably because it contains some feature that LMMS doesn't support

I haven't found exactly what causes the crash but it appears to be something with pitch bends. There is a lot of pitch bending in that tune (Jeff Beck's "Blue Wind") and when I filter all the pitch bends out of the midi file it imports correctly. I'll see if I can narrow it down to something more specific.

@tresf Can you tick #699 as it was fixed?

@tresf Can you tick #699 as it was fixed?

:+1:

This should be turned into a task list so its easier to mark fixed issues.

The Play and Stop, buttons on the B&B Editor needs to be assigned to deferent MIDI CC numbers then main transport, so you can assign them to deferent buttons on your MIDI controler then the main transport.

@Reaper10 in the future, try to provide some context when you link to another issue. For example, say something simple like "#1977 should be added to this list" so that we know _why_ you're linking us there.

So with these huge lists: if I want to discuss one specific item in depth, should I do it here or on the original issue that is linked (even though it's already closed)?

@Wallacoloo either is fine.

The closed topics are closed more for organization purposes, (technically they are still open and still valid) so feel free to use the original bugs as needed if you want to prevent bugs like this from turning into run-ons.

The consolidation was done because as you can see above, we have many, many duplicates and many related bugs that would otherwise be quite difficult to track independent of each other. :+1:

Hey I definitely don't want to be pushy, because after all it's a volunteer project that you guys put massive amounts of time into, but (haha) is there a way to prioritize based on what the average or potential users need.

To me these 2 are the most basic:

MIDI pitch-bend support #1918
MIDI modulation wheel, sustain pedal and expression pedal support #1918 #1917 #1890 #1700 #1953

Again, just a suggestion, maybe there could be a poll somewhere?

Thanks!
Dave

maybe there could be a poll somewhere

Someone could certainly do this. We've had some polls in the past. What we need more than anything is a few more people getting their hands dirty with the code, which a poll won't necessarily fix.

Cool I hear you, I've actually started learning c++ (I had taken 2 semesters of c in school) but I think it'll be a while before I could contribute.

Thanks

@tresf Can you tick #699 as it was fixed?

So MIDI export works now? How?

@drummyfish in a future release, 1.2.0.

For the "MIDI mapping using custom key ranges #1743 #1381 #1792 ", we could use the new tab in the plugin window, the one used to disable transposition.
It's a really important feature: with that you can use the B+B editor as a drum sampler #1460.

I've done some work for MIDI play/pause/stop/record, so I a Korg nanoKONRTOL assigned to control LMMS functions. on https://github.com/teknopaul/lmm.
I'll see if I can make it a bit more generic.

Supporting Advanced midi keyboard features / midi-HW drums-pads
This request was caused from this
http://lmms.io/forum/viewtopic.php?f=7&t=8627
The essence is that one single connection here means that
eight pads have notes assigned to them like:
[D3] [A2] [Eb3] [C#3]
[C2] [D2] [[F#2] [Bb2]
For the 8 pads resp.

I suppose stand-alone midi drum-pads has similar setups(?)
In order to have this covered i suppose lmms need to be able to bind a single key to a midi-channel
But, in the referenced issue, the keyboard only allow one channel connection.
I suppose a sampler / customized edited soundfont solution, could be 'a' way, but if at all lmms should be made able to handle this scenario, i see this as a situation where:

  • n (8) different AFPs must be allocated to one midi-channel
  • if pad-1 is tapped, then AFP-1 should play, but not the 7 others!
    But how?
    Is this too advanced and specific to be addressed at all?
    Does anyone know if other midi-HW does it the same way, eg -is that a kind of 'standard'?

Why are the request in this Issues not being addressed? It's as if they are being swept under the rug for some reason. The mod wheel for Vestige is a must have for automation purposes imho.

@Cangle50
You are at any moment more than welcome to address any or all of the requests. It will only take most of your spare-time, and you will almost have nothing to explain to other significant ones, about you being glued to a chair infront of a pc, instead of participating in life ..

The devs does an unbelievable job, and nothing is swept anywhere or under anything. Developing takes t i m e, and bug-fixing comes before feature-requests. Be patient, it will come

@musikBear
The mod wheel for Vestige has been requested for almost 5 years now. I don't think revisiting old request are unreasonable, if for no other reason then to remind the dev's that some request are still relevant.

I didn't mean to get under your skin musikBear. I know that the Dev's work hard and I appreciate their efforts, but I had do it. As the old saying goes, the squeaky chair gets the oil.

The mod wheel for Vestige has been requested for almost 5 years now

"Swept under the rug" suggests blame. We have a zero tolerance on this tracker. Next offense, you're banned.

I had do it. As the old saying goes, the squeaky chair gets the oil.

The proverb is "the squeaky wheel gets the grease". Please appreciate the irony of this statement when moderators have to issue ban warnings.

Any news about "Expose MIDI controls" and all sub-points? I know that I necrobump this, but it's really annoying to not be able to use such basic functions with midi controllers on lmms.

@Amathadius Which feature do you need the most in the list? We may prioritize the issue if it's valuable enough.

@PhysSong

"Which feature do you need the most in the list?"

Bank Select MSB, Bank Select LSB and Program Change...
Or a way for us to choose what to send choosing one of Midi CC and setting the value to be sended.

@PhysSong The feature that most ask us about, is a fast simple way to connect any instrument in song-editor to play through MIDI-keyboard. Ideally would be that the one in focus, would play transparently when a MIDI-kb key was pressed- Eg no manually "connect-to-midi" on the midi-tab

This seems consistent with what I've seen, people want to play via MIDI keyboard the same way LMMS does for a typing keyboard.

That's true, but I feel like this should just add up over the existing Midi routing, so that you can still use LMMS with many keyboards connected to different synths, e.g. while not having any in focus.

So:

  • You should still be able to manually connect a keyboard to an instrument
  • The instrument on focus also gets MIDI _from all connected keyboards_

The "Faster access to MIDI assignment" point should still be addressed, but it would be far less important, as it would only affect users that are setting up an advanced project.

To be able to assign buttons, knobs, sliders... controller "sections"... to any functions of LMMS (play, pause, stop, volume, switch track, loop, etc.). Right click on option, assign key/button/knobs...

To be able to at last manually assign "things" to what ever you want makes LMMS more flexible and midi controller more usable.

as it would only affect users that are setting up an advanced project.

I fear we even have to remember, that some like to use (be able to use ) LMMS in live-performance, so also relevant there.

I think #1857 should be added to the "Basic Functionality" section.

Edit: I have added it myself.

Some ideas that have come up to my mind so far. If needed, I can open separate tickets for them.

  • A possibility to assign MIDI controllers' buttons to toggle switches. Some controllers, such as Alesis QX49 are highly configurable and their buttons can be assigned a CC, even with defined values on both key-down and key-up. On the other hand, controllers such as AKAI Midimix send Note On and Note Off events, with no way to configure anything. AKAI Midimix has 19 physical buttons, but from the MIDI perspective it exposes 27, so you could do a lot with them.

    • As an extension of the feature above, a group of MIDI controller keys could be assigned to one CC but with different values. This way, for example, I could assign eight buttons on Midimix to choose waveforms of both OpulenZ's oscillators.

  • Back-feeding the actual state of the plugin's control to the MIDI controller. In AKAI Midimix, sending a Note Off message with nonzero velocity will turn on the backlight of the button (the same message with a velocity of 0 will turn the light off). I don't know if there are any MIDI controllers that are capable of moving their sliders or knobs (I have come across such audio mixers only), but if they exist, they might listen for Controller Change messages sent back. Novation Launchpad users will be especially interested in this feature, I guess :)
  • Support for various MIDI Machine Control messages. They are actually SysEx messages but they are defined in the standard, and they include:

    • transport control (Play, Pause, Stop, Rewind, Fast-forward, Record, etc.)

    • master volume control

    • coarse and fine tuning; coarse tuning is typically equivalent to transpose control (Casio CTK-4200 sends them when I transpose the keyboard)

      We could internally re-map these messages into keys and CC using IDs above 128.

Speaking of transport control, the Play/Stop/Record controls could also be made assignable to MIDI events, but this was already mentioned by others.

What's the main blocker for midi pitch bend recording support? I was recording a solo via midi and was surprised that even though the pitch bends were correct during the recording, they were missing during later playback. If there's something I could contribute to help this make it into a near-term release I'd be happy to look into it!

Hi @benwiley4000,

I had a quick look at the problem, i.e. I have checked what happens if you play a note while recording and what happens if the pitch wheel is moved. Unfortunately it seems that there is no quick solution to your problem. In my opinion the main blocker is that MIDI is not a first class citizen in LMMS. So you have asked your question in the correct issue. ;)

MIDI and audio streams in other DAWs

Most other DAWs know at least the following two first class citizens:

  • Audio streams
  • MIDI events

If you record something (or import files) these DAWs will create containers which store or reference this data. The containers can be moved or copied around the timeline and tracks to build a song. If you record MIDI with a keyboard the container will still represent this information as a stream of MIDI events. And if you play back with the playhead over the container then the DAW will reproduce this stream of MIDI events and route it wherever it should go, e.g. to an instrument plugin. It's then up to the instrument plugin to interpret what to do with this data which allows for very flexible and different implementations. Because the data is still represented as MIDI events this also means that pitch bends would be played back without problems because they are simply events in that event stream.

What happens in LMMS?

Recording a note

Let's now see what happens in LMMS when you hit record in the piano roll and press a key on your keyboard. I have tested this with an instance of TripleOsc. A note is recorded as follows:

  1. As soon as you press a key on the MIDI keyboard the method InstrumentTrack::processInEvent is triggered. The switch statement in that code will trigger the MidiNoteOn case which in turn will call NotePlayHandleManager::acquire which creates an instance of a NotePlayHandle.
  2. In the constructor of NotePlayHandle the signal midiNoteOn is emitted for the associated instrument track because it is created with the origin being set to OriginMidiInput.
  3. The method PianoRoll::startRecordNote is connected to that signal and adds a new instance of Note to its recorded notes which are stored in m_recordingNotes.

Moving the pitch bend wheel

If you move the pitch wheel this will also trigger InstrumentTrack::processInEvent. In this case the MidiPitchBend case is handled. If you look at the code you will find that it only makes changes to the current state of the instrument track. That's the reason why you can hear the changes during recording. However, it does not trigger any code that will record the pitch bend events. This is because LMMS does not know how to store pitch wheel events and also has no place to store them. It does not make sense to store them in a NotePlayHandle because in that case the NotePlayHandle would now need to be able to store different states of pitch for different times.

A potential solution (how most other DAWs do it)

Put differently: LMMS is very quick to translate the MIDI data into its own representation which is not able to handle all the nuances of a MIDI stream. In my opinion it also does too much interpretation outside of the instruments and plugins (compared to having the interpretation implemented in plugins/clients). The best solution would be to represent all non-audio data as MIDI internally (or at least in a form that encompasses all of MIDI) and to route it accordingly. This would also enable the usage of plugins which transform the MIDI stream (e.g. transpose it, make all notes of equal volume, etc.). With the current implementation I assume that such plugins are not supported.

The fact that most plugin standards (VST2, VST3, LV2, etc.) differentiate between audio and MIDI is another indicator that it's a good idea for a DAW to be able to deal with streams of MIDI data internally.

If MIDI was a first class citizen it would likely make importing MIDI data easier as well. You would "simply" read the MIDI data, perhaps transform it and then put it into the containers. And then play it back to your hearts content.

@michaelgregorius what do you think some actionable steps could be? The "perfectly correct" way, and also, what would actionable steps be if I'm totally selfish and only want to get my feature implemented? 😜 I'm brand new to the code base but if there's a small task I could start with that would be great.

Hi @benwiley4000,

I guess even a "selfish" and perhaps even "hacked" implementation that only solves this single problem would be rather complex. The base problem can be described as "MIDI events are generated but only some of them are recorded so only a subset of the input events will be played back". So you'd have to solve the following problems:

  1. Find a way to record the events that are not recorded currently (or at least the pitch bend events). As noted above it likely does not make sense to also store them in the NotePlayHandle instances so you'd have to invent your own data structure and organisation of the structure during recording and playback.
  2. You will also to implement a way to store that new data structure in a saved file so that the recorded events are persisted across sessions.
  3. If you had this data structure then you'd also have to find out in some way how many voices are active for example in a given InstrumentTrack that gets the pitch bends applied. Because if you for example press three keys one after the other on your MIDI keyboard without releasing them and then move the pitch wheel then the pitch bend will have to be applied to all three active notes.

As you can imagine the steps that need to be implemented for the "perfectly correct" way would be even more complex. Things that come to mind are:

  • Implement a data structure that holds the MIDI events and of which several can be associated with an instrument or MIDI track.
  • The note patterns that are saved in old files will have to be converted to MIDI upon loading.
  • The interfaces of LMMS' own plugins will likely need to be changed to now accept MIDI event streams.
  • We would likely need a base class for the existing plugins which provides functionality to convert the incoming MIDI events to a similar behavior as is implemented currently, i.e. this base implementation might make use of the NotePlayHandles because the current "old" code outside of the plugins will not be usable anymore.

Once this infrastructure was available I think many interesting and useful things could be implemented. For example:

  • MIDI containers that point to a file on disk. Whenever that file is changed all instances in the project would be adjusted.
  • MIDI containers which are "instances" or clones of one "internal" MIDI container. One you make changes to the original all clones are adjusted.
  • Same for audio. Once you have something recorded it's one file on disk which might be referenced by several instances at different times or even tracks. This would save tons of memory because as far as I know LMMS currently stores all samples fully in memory.
  • If the containers are implemented intelligently they should stream the data into memory as needed.

By the way, if you want to get your feet wet with regards to coding in LMMS there are some issues which are tagged as "good first issue". Perhaps you can find something interesting there even if it doesn't scratch your current personal itch. :wink:

Has functional MIDI-export been implemented at any time? Afair : Yes. I believe it has been working.
I can read the Notes in the archive, and the first time MIDI-export is mentioned, is in v1.1.90, under General Improvements as 6. item in that list:

    General Improvements
        Build support for Haiku (BeOS) Operating System
        Better handling of corrupt projects/presets
        Export as loop support for CLI (#2131)
        Added Apple MIDI support (#1153)
        Fix "Dummy" audio selection (#2376)
        MIDI export support

MIDI-export is broken in aspects of

  • Pitch
  • Note-position
  • full length export

in 1.2.1 #5287


Irrelevant:
Yesterday i spend ~20 mins to search for the most relevant thread for (re)-reporting broken MIDI-export in 1.2.1. This thread did not appear in any search involving MIDI+ (fail | broken | lost) -So i made a new Issue. (5287) But it belongs here.
Searching and getting relevant results here, are imo a problem. Some kind of 'header' with most relevant keywords -could that be an idea?

Hello !
Firstly, allow me to wish all of you a happy new year !
Secondly, as it is my first post here, I would like to thank really kindly all contributors to this project. I discovered LMMS a few days ago, and I'm very impressed by the quality of this software.

Now to the point : MIDI sound banks !
I also have a nice Yamaha CLP-645 with very high quality piano samples (Yamaha GH2 / Bösendorfer Imperial ...) and I would like to write some parts on LMMS and render them via MIDI.
The problem is : i'm only allowed to select a program (from -1 to 127) that applies to the default bank. But to select the other voices, you need to send a MSB and LSB then a program...
clp685_en_mr_b0.pdf

So, if my opinion is accepted : "MIDI bank-selection (MSB) support #62" item would be really appreciated ;)

Sadly it will be impossible for me to contribute, as my level in programming is too low ... wish I could help...

@tresf
With the merge of pullrequest #5499
"Faster access to MIDI assignment/auto-assignment" can be ticked now I think.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnini picture mnini  Â·  3Comments

DomClark picture DomClark  Â·  3Comments

Gabrielxd195 picture Gabrielxd195  Â·  3Comments

Sawuare picture Sawuare  Â·  3Comments

PaulBatchelor picture PaulBatchelor  Â·  4Comments