MIDI Note sequence (Newbie help)

Status
Not open for further replies.

Chambo

Member
Hi all, this is my first post.

I've just got a Teensy 3.6 and I need some basic help.

I want to run a (midi) sequence of notes into a DAW via USB.

What is the simplest way of adding a midi note sequence to the Teensy? I've looked for code examples, but lots of them appear to relate to midi controllers, buttons and keys. All I want to do is to continually run the sequence, in the first instance.

Any help much appreciated :)
 
As far as I understand, a DAW is not made to receive MIDI messages. Thus, your Teensy would not only have to generate the midi sequence, but also to synthesize the corresponding digital audio signal from these, which can basically be done with the Teensy 3.6, the audio library, and some code to convert the midi note and velocity values into the corresponding parameters for the chosen audio synth object.
https://www.pjrc.com/teensy/td_libs_Audio.html
 
Im running it straight into Ableton Live, or a Virtual Instrument. So the midi would just be used to trigger the 'audio' in the settings.

I'll have a look at that thanks.

As far as I understand, a DAW is not made to receive MIDI messages. Thus, your Teensy would not only have to generate the midi sequence, but also to synthesize the corresponding digital audio signal from these, which can basically be done with the Teensy 3.6, the audio library, and some code to convert the midi note and velocity values into the corresponding parameters for the chosen audio synth object.
https://www.pjrc.com/teensy/td_libs_Audio.html
 
Sorry I think I didn't explain myself very well. I have the midi file that's a pre-generated set of tones.
 
thus, I'd start with a simple test and tutorial code (be sure to select USB Midi in the board options before compiling)

Code:
uint8_t myScale[] = {60,62,64,65, 67, 69, 71, 72};
uint8_t myChannel = 0; // fire on all channels, replace by a valid channel number if you want to be more selective)
uint8_t myVelocity = 127;

void setup() {
    // nothing to do here
}

void loop() {
    for(int i = 0; i < 8; i++) {     // walk through the scale
        uint8_t myNote = myScale[i]; // pick the corresponding note from the scale
        usbMIDI.sendNoteOn(myNote, myVelocity, myChannel); // start the note
        delay(500); // let it sound for half a second
        usbMIDI.sendNoteOff(myNote, 0, myChannel); // stop the note
    }
}
 
Ah! That's great. I actually understand it. . . which is even better. I aim to go through the tutorials, but I find that I need a little project in order to sustain my interest :)
With this program are there any 'headers'. I remember programming C years ago and had to include libraries.

Thanks again this is a great help (Y)
 
The needed headers and libraries are automatically and invisibly included by your selection in the Tools->Board and Tools->USB Type menu of the Arduino/Teensyduino IDE.
 
Sure that I did this before and had the midi from the card being read by the DAW.
Anyone remember anything? :)
 
Status
Not open for further replies.
Back
Top