cs-midi-docs/docs/examples/01-output/04-note-chord-button.md

990 B

NoteChordButton

Plays a chord on button press.

Original: NoteChordButton.ino

#include "pico/stdlib.h"
#include "pico/cyw43_arch.h"
#include <cs_midi.h>

using namespace cs;

BluetoothMIDI_Interface midi;

constexpr Channel channel = Channel_1;

NoteChordButton buttons[] {
    {2, {MIDI_Notes::C[4], channel}, Bass::Double + Chords::Major},
    {3, {MIDI_Notes::D[4], channel}, Bass::Double + Chords::Minor},
    {4, {MIDI_Notes::E[4], channel}, Bass::Double + Chords::Minor},
    {5, {MIDI_Notes::F[4], channel}, Bass::Double + Chords::MajorFirstInv},
    {6, {MIDI_Notes::G[4], channel}, Bass::Double + Chords::MajorSecondInv},
    {7, {MIDI_Notes::A[4], channel}, Bass::Double + Chords::MinorSecondInv},
    {8, {MIDI_Notes::B[4], channel}, Bass::Double + Chords::Diminished},
};

int main() {
    stdio_init_all();
    if (cyw43_arch_init()) return 1;
    Control_Surface.begin();
    while (true) {
        Control_Surface.loop();
        sleep_ms(1);
    }
}