removeListener(event, listener, options = {}) {

    if (WebMidi.validation) {

      // Legacy compatibility
      if (typeof options === "function") {
        let channels = [].concat(listener); // clone
        listener = options;
        options = {channels: channels};
      }

    }

    if (options.channels === undefined) options.channels = Enumerations.MIDI_CHANNEL_NUMBERS;

    // If the event is not specified, remove everything (channel-specific and input-wide)!
    if (event == undefined) {
      Utilities.sanitizeChannels(options.channels).forEach(ch => {
        if (this.channels[ch]) this.channels[ch].removeListener();
      });
      return super.removeListener();
    }

    // If the event is specified, check if it's channel-specific or input-wide.
    if (Enumerations.CHANNEL_EVENTS.includes(event)) {

      Utilities.sanitizeChannels(options.channels).forEach(ch => {
        this.channels[ch].removeListener(event, listener, options);
      });

    } else {

      super.removeListener(event, listener, options);

    }

  }
Removes the specified event listener. If no listener is specified, all listeners matching the
specified event will be removed. If the event is channel-specific, the listener will be removed
from all [`InputChannel`]{@link InputChannel} objects belonging to that channel. If no event is
specified, all listeners for the `Input` as well as all listeners for all
[`InputChannel`]{@link InputChannel} objects belonging to the `Input` will be removed.

By default, channel-specific listeners will be removed from all
[`InputChannel`]{@link InputChannel} objects unless the `options.channel` narrows it down.

@param [type] {string} The type of the event.

@param [listener] {function} The callback function to check for.

@param {object} [options={}]

@param {number|number[]} [options.channels]  An integer between 1 and 16 or an array of
such integers representing the MIDI channel(s) to match. This parameter is ignored for
input-wide events.

@param {*} [options.context] Only remove the listeners that have this exact context.

@param {number} [options.remaining] Only remove the listener if it has exactly that many
remaining times to be executed.