# Does TheMidibus Library work in Processing 4?

**URL:** <https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851>\
**Category:** Libraries\
**Created:** [August 23, 2021, 2:48am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851 "2021-08-23T02:48:25Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![BBellamy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bbellamy/32/17356_2.png) [@BBellamy](https://discourse.processing.org/u/BBellamy)\
**Post date:** [March 18, 2024, 7:40pm UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/21 "2024-03-18T19:40:15Z")

</div>

Well, for some mysterious reasons, the fix doesn’t work on one of the computers I use (a Macbook Air 2015 with Mac OS 10.14.6 Mojave): I still have the NullPointerException when running a simple example with the MidiBus, with Processing 4.3 (I don’t have that problem with Processing 3.5 though, but I’m pretty sure it’s better to upgrade anyway). Also, the MidiBus has other issues. For instance, when registering a MIDI/USB device, it gets the name field, where other softwares that detect synths correctly seem to use the description field, and as a result I have a Blofeld synth that it detects as “Unknown name”, which is not really useful. I’ve read somewhere that MidiBus also has issues with other stuff I might try to use later, as sysex messages or something.  
I then resolved to use Java Midi to manage MIDI receivers, AND the MidiBus to manage transmitters, in the same program, so I could get the right device names but also be able to detect when a MIDI controller sends some MIDI message…  
But 1) that’s quite complicated and unelegant and 2) it works only with Processing 3.5, not 4.3.  
So yeah, switching for good to Java Midi sounds like a much better solution than using that hybrid Java Midi/MidiBus thing. Except for that one missing piece: I don’t know how to detect noteOn/noteOff/midiMessage events the way MidiBus does. And I’m pretty sure it’s possible through some Java code integration into my Processing code, but, alas, from all the documentation I’ve been reading, I couldn’t find how to do that. I found many pages talking about connecting transmitters to receivers, recording sequences or writing MIDI files, but nothing about simply getting MIDI event data from a transmitter to put it in a variable. I’ve been on this for months and it’s quite frustrating… 😉

---

<div class="post-metadata">

**Author:** ![robertesler](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@robertesler](https://discourse.processing.org/u/robertesler)\
**Post date:** [March 19, 2024, 3:26am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/22 "2024-03-19T03:26:31Z")

</div>

Hi @BBellamy. I have an example how to use Java.sound.midi.  
The trick is to filter the midi messages using the correct Hex codes. Here is a resource for that,

> **[Essentials of the MIDI protocol](https://ccrma.stanford.edu/~craig/articles/linuxmidi/misc/essenmidi.html)**
>
> Essentials of the MIDI protocol by C. Sapp

Otherwise this example will get you started.

> <https://github.com/robertesler/Pd4P3/blob/main/examples/MIDI/MIDI_Example/MIDI.pde>

Good luck.

---

<div class="post-metadata">

**Author:** ![Grumpy\_Mike](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/grumpy_mike/32/14787_2.png) [@Grumpy\_Mike](https://discourse.processing.org/u/Grumpy_Mike)\
**Post date:** [March 19, 2024, 6:38am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/23 "2024-03-19T06:38:41Z")

</div>

Well @BBellamy I just tried with the basic example from TheMidibus library  
This is what I get when I run it and get a list of available devices

> Available MIDI Devices:  
> ----------Input----------  
> [0] “Real Time Sequencer”  
> [1] “IAC Bus 1”  
> [2] “IAC Bus 2”  
> [3] “Out”  
> [4] “EDITOR Out”  
> ----------Output----------  
> [0] “Gervill”  
> [1] “Real Time Sequencer”  
> [2] “IAC Bus 1”  
> [3] “IAC Bus 2”  
> [4] “In”  
> [5] “EDITOR In”

So my keyboard is being labeled as “in”, sure it is not the correct name but what do I care.  
If I run MIDI Monitor it shows up as “from VMini Out” and I can see the note on / off MIDI messages.  
Then I take the Basic MIDI example and comment out this line:-

```auto
myBus = new MidiBus(this, -1, "Java Sound Synthesizer")

```

and comment in this line:-

```auto
 myBus = new MidiBus(this, 3, 4); // Create a new MidiBus using the device index to select the Midi input and output devices respectively.

```

The input is a keyboard so I don’t want to send anything to it so I comment out this section:-

```auto
// it is a keyboard so we don't have to send it a note
/*
  myBus.sendNoteOn(channel, pitch, velocity); // Send a Midi noteOn
  delay(200);
  myBus.sendNoteOff(channel, pitch, velocity); // Send a Midi nodeOff

  int number = 0;
  int value = 90;

  myBus.sendControllerChange(channel, number, value); // Send a controllerChange
  delay(2000);
  */

```

And when I press a key on my Alesis vmini keyboard I get printed out in the console window:-

> ## Note On:
> 
> Channel:0  
> Pitch:48  
> Velocity:43
> 
> ## Note Off:
> 
> Channel:0  
> Pitch:48  
> Velocity:43

This is using Processing V4.2, on a Mac laptop, running OS 10.14.6 Mojave.

You might want to use the solution above, but I leave it here for others searching the forum threads to show how I would do things.

---

<div class="post-metadata">

**Author:** ![gudmundursteinn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gudmundursteinn/32/3863_2.png) [@gudmundursteinn](https://discourse.processing.org/u/gudmundursteinn)\
**Post date:** [August 18, 2024, 10:13am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/24 "2024-08-18T10:13:08Z")

</div>

I have just been updating to Processing 4 on a windows. I have gotten past the initial midibus and other errors but my old sketches turn on and look right in the beginning but the midi connectors aren’t returning any signal in. Has the syntax for the midibus changed at all? Has anyone run into this? So midibus “works” but it isn’t doing anything.

---

<div class="post-metadata">

**Author:** ![justin\_lincoln](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/justin_lincoln/32/53_2.png) [@justin\_lincoln](https://discourse.processing.org/u/justin_lincoln)\
**Post date:** [January 24, 2025, 6:13am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/25 "2025-01-24T06:13:33Z")

</div>

The minibus compatibility issue returned last year. This post from r/Processing reminded me of the frustration I had last year, perhaps in an update I made in November. [Reddit - Dive into anything](https://www.reddit.com/r/processing/comments/1hqno5v/something_changed_recently_odd_null_exceptions/). Like the op writes, midi works fine on other apps for my MacBook, but for me hundreds of programs that I designed to work with midi controllers all get that nullPointer exception. Figured I’d boost the signal here. I’d love to use my midi controllers with Processing again.

---

<div class="post-metadata">

**Author:** ![clankill3r](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/clankill3r/32/1098_2.png) [@clankill3r](https://discourse.processing.org/u/clankill3r)\
**Post date:** [November 6, 2025, 10:42am UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/26 "2025-11-06T10:42:02Z")

</div>

I ended up using OpenFrameworks cause I could not get any input with processing. (M3)

---

<div class="post-metadata">

**Author:** ![onebus](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/onebus/32/10204_2.png) [@onebus](https://discourse.processing.org/u/onebus)\
**Post date:** [February 17, 2026, 4:56pm UTC](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851/28 "2026-02-17T16:56:15Z")

</div>

Booooi - did i ever mention how happy this made me – anyways have a beautiful day!

[Previous page](https://discourse.processing.org/t/does-themidibus-library-work-in-processing-4/31851.md?page=1)
