LMMS / LMMS/lmms

Short notes are (sometimes) not played

Open
#6,264 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

### Bug Summary

When a MIDI device sends **a very brief note** (a *note on* and then a *note off* after few milliseconds), sometimes the instrument plays the sound, and **sometimes it is ignored**. I've discovered this using an MPK mini keyboard, with the pads, which are pressed for a very short time (just a "tap", less than 10 ms). I noticed that **some "taps" where skipped**. I tried the same MIDI keyboard on MPC Beats (windows) and Ableton Live (windows), and there are no missing sounds (the device is not damaged). I've also created a simple Python script to generate brief notes in order to verify the problem:

```python
#!/usr/bin/env python3

import mido
import time

port = mido.open_output(name="TEST", virtual=True)
on = mido.Message("note_on", note=56, velocity=127)
off = mido.Message("note_off", note=56, velocity=0)

while True:
print(".", end="", flush=True)

port.send(on)
time.sleep(5 / 1000)
port.send(off)

time.sleep(1)
```

#### Steps to reproduce

1. Create an empty project, and add an instrument track (ie. "BitInvader". Enable the *envelope* and rise the *release* time to get a less annoying note).
2. Run the previous script (or use a MIDI device that can produce very short notes)
3. Connect the intrument track MIDI input to the TEST device

#### Expected behavior

Hear a note every second (or at the pace you press the key in the MIDI device).

#### Actual behavior

Some notes are skipped (not played at all). It does not occur on every note, just one beat each three or four.

#### Screenshot

![test](https://user-images.githubusercontent.com/4654094/148692035-ccccf665-a2e9-465b-aadb-37c3dd32f173.png)

#### Affected LMMS versions

* Version 1.3.0-alpha.1.158+gbf323d202 (Linux/x86_64, Qt 5.12.8, GCC 9.3.0). (tested on **Ubuntu 20.04** and **Ubuntu 21.10**)
* Version 1.2.2 (Linux/x86_64, Qt 5.9.7, GCC 5.4.0 20160609) (tested on **Ubuntu 20.04** and **Windows 10**)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the supplied Python reproducer and connecting its TEST MIDI output to an instrument track as described. Trace the MIDI input and note handling to determine why some brief note-on/note-off pairs are skipped. Done means the instrument reliably plays each short note across the listed environments and reproduction steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.