Skip to content

MIDI channel number mismatch #26

Open
@baloe

Description

@baloe

I am trying to figure out how to have certain sounds played via MIDI, and am encountering the following issue:

I have these wav files from one of your demos on the SD card:
Screenshot_20221229_151926

And I am able to play them through the MIDI library for Arduino when sending notes 1 through 9, but oddly I have to use channel 2. Why is that?
Based on the MIDI section of the instructions the track number is computed as

Track Number = (MIDI Channel * 128) + (MIDI Bank Number * 128) + MIDI Note Number 
#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

void setup()
{ 
    delay(2000);
    MIDI.begin();
    play();
}

void loop()
{
  play();
}

void play()
{
    int channel = 2;
    for (int note = 1; note < 10; note++) {
      MIDI.sendNoteOn(byte(note), 60, byte(channel));
      delay(1000);
      MIDI.sendNoteOff(byte(note), 0, byte(channel));
      delay(100);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions