Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Patrick SchäferMatthias L. Jugel
Published © CC BY-NC

Der Calliope mini als Midi-Player

Mit einem Lightning-USB Adapter und einem USB-Midi-Adapter schließ man den Calliope mini an das iPad an, das dann per Midi angesteuert wird.

AdvancedFull instructions provided4,742
Der Calliope mini als Midi-Player

Things used in this project

Hardware components

Calliope mini
Calliope mini
×1
Apple Lightning-USB-Adapter
×1
USB-Midi-Adapter
×1
iPad
Apple iPad
×1
Midikabel
×1

Software apps and online services

Bismark BS-16i

Story

Read more

Code

Untitled file

JavaScript
serial.redirect(
    SerialPin.P0,
    SerialPin.P1,
    31250
);

basic.forever(() => {
    for (let note = 60; note <= 80; note++) {
        // Note on channel 1 (0x90), some note value (note),
        // middle velocity (0x45):
        serial.writeString(String.fromCharCode(144));
        serial.writeString(String.fromCharCode(note));
        serial.writeString(String.fromCharCode(69));

        serial.writeString(String.fromCharCode(145));
        serial.writeString(String.fromCharCode(note + 4));
        serial.writeString(String.fromCharCode(69));


        basic.pause(100);
        // Note on channel 1 (0x90), some note value (note),
        // silent velocity (0x00):
        serial.writeString(String.fromCharCode(144));
        serial.writeString(String.fromCharCode(note));
        serial.writeString("\0");

        serial.writeString(String.fromCharCode(145));
        serial.writeString(String.fromCharCode(note + 4));
        serial.writeString("\0");


        basic.pause(100);
    }
});

Credits

Patrick Schäfer

Patrick Schäfer

1 project • 0 followers
Matthias L. Jugel

Matthias L. Jugel

4 projects • 10 followers
Hacker, dad. I flash devices for fun. Mostly stuff works for me...

Comments