Coder Social home page Coder Social logo

Arduino Esplora Example about control-surface HOT 3 CLOSED

tttapa avatar tttapa commented on July 20, 2024
Arduino Esplora Example

from control-surface.

Comments (3)

tttapa avatar tttapa commented on July 20, 2024

Hi, thanks for the example!

I can add it to the "boards" examples if you'd like. I don't own an Esplora myself, so I can't really test it, though.

What exactly would you like the buzzer to do? Should it just play MIDI notes like a MIDI synth?

from control-surface.

tarTG avatar tarTG commented on July 20, 2024

I can add it to the "boards" examples if you'd like

Feel free to add it.

Should it just play MIDI notes like a MIDI synth?

Yes. I don`t need this soon. It's just an Idea i came up with while playing around with this board.

from control-surface.

tttapa avatar tttapa commented on July 20, 2024

To play notes, you could use something like this:

#include <Control_Surface.h> // Include the Control Surface library

USBMIDI_Interface midi;

// Return true to indicate that handling is done, and Control_Surface shouldn't
// handle it anymore. If you want Control_Surface to handle it as well, return
// false.
bool channelMsgCallback(ChannelMessage cm) {
  ChannelMessageMatcher matcher = cm;
  // Filter the channels if necessary
  if (Channel(matcher.channel) == CHANNEL_1) {
    // Extract note data
    uint8_t note = cm.data1;
    uint8_t velocity = cm.data2;

    if (matcher.type == NOTE_ON) {

      // Play tone here

      return true;
    } else if (matcher.type == NOTE_OFF) {

      // Stop playing tone here

      return true;
    }
  }
  return false;
}

void setup() {
  Serial.begin(115200);
  Control_Surface.begin();
  Control_Surface.setMIDIInputCallbacks(channelMsgCallback, nullptr, nullptr);
}

void loop() {
  Control_Surface.loop();
}

from control-surface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.