MIDI: how to send large amount of data?
- PipeWire version (
pipewire --version
):
pipewire Compiled with libpipewire 1.1.0 Linked with libpipewire 1.0.3
- Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
):
ArchLinux up-to-date 2024-02-23
-
Desktop Environment: none
-
Kernel version (
uname -r
): 6.7.5
Description of Problem:
Hello! I'm currently implementing pipewire support in https://github.com/jcelerier/libremidi
One thing I'm struggling to understand with the API is : how can one support sending large amounts of MIDI data in a single frame?
e.g. right now it seems i'm getting one buffer of 4kb per port per tick:
const auto b = pw.filter_dequeue_buffer(this->filter->port);
assert(b->buffer->n_datas == 1);
assert(b->buffer->datas[0].maxsize == 4096);
which, well, is nice but assuming e.g. 3-byte CC gives 1365 messages for a time quantum of 21 milliseconds-ish / 1024 samples or 65 messages per millisecond and barely more than a message per sample... which is actually not that much if you're having a few dozen instruments with each hundreds of parameters automated - projects I work on are sometimes like a factor of 10 above this in terms of density.
Ideally I'd like to have a way to set the buffer size on the port - and, if insufficient, have a way to provide another - but i'm not sure it's safe to just have my own buffer on the side that i'd give to pw in that case while i'd keep the one I got with pw_filter_dequeue_buffer stored / released ?
Think that nowadays some consumer programs can render > 1M notes per second (or >40 midi messages per sample at 48k) : https://www.youtube.com/watch?v=urLlKB8KtrU ;)