@ Paul
sorry for confusing. my english is bad and it is sometimes hard to articulate.
i don't use usb midi. and the midi problem is gone. i missed the custom teensy midi library but i solved it with the standard midi lib from arduino like i mentioned before.
for the simultaneously sound problem:
i use raw files. separate objects and i have a mixer object. i trigger the sound objects via midi. sometimes (often but not always) if i play two or more sounds at the same time, i have a strange glitch and it is hearable in the lower range (bass drum i.e.)
here is my sketch:
#include <MIDI.h>
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
HardwareSerial Uart = HardwareSerial();
MIDI_CREATE_INSTANCE(HardwareSerial, Uart, midi2);
AudioPlaySdRaw track1, track2, track3, track4;
AudioMixer4 mixer1;
AudioOutputI2S dac;
AudioConnection c0(track1, 0, mixer1, 0);
AudioConnection c1(track2, 0, mixer1, 1);
AudioConnection c2(track3, 0, mixer1, 2);
AudioConnection c3(track4, 0, mixer1, 3);
AudioConnection c4(mixer1, 0, dac, 0);
AudioConnection c5(mixer1, 0, dac, 1);
AudioControlSGTL5000 audioShield;
const char* track_1_sound = "BD1.RAW";
const char* track_2_sound = "HH1.RAW";
const char* track_3_sound = "SD1.RAW";
int active_track = 1;
void HandleNoteOn(byte channel, byte pitch, byte velocity){
switch(pitch){
case 64:
track1.play(track_1_sound);
break;
case 65:
track2.play(track_2_sound);
break;
case 66:
track3.play(track_3_sound);
break;
}
}
void HandleNoteOff(byte channel, byte pitch, byte velocity){
}
void HandleProgramChange (byte channel, byte number, byte value){
}
void setup() {
midi2.setHandleNoteOn(HandleNoteOn); // Put only the name of the function
midi2.setHandleNoteOff(HandleNoteOff);
midi2.setHandleProgramChange(HandleProgramChange);
midi2.begin(MIDI_CHANNEL_OMNI);
delay(100);
AudioMemory(50);
audioShield.enable();
audioShield.volume(0.6);
SPI.setMOSI(7);
SPI.setSCK(14);
SD.begin(10);
}
void loop () {
midi2.read();
}
sorry for confusing. my english is bad and it is sometimes hard to articulate.
i don't use usb midi. and the midi problem is gone. i missed the custom teensy midi library but i solved it with the standard midi lib from arduino like i mentioned before.
for the simultaneously sound problem:
i use raw files. separate objects and i have a mixer object. i trigger the sound objects via midi. sometimes (often but not always) if i play two or more sounds at the same time, i have a strange glitch and it is hearable in the lower range (bass drum i.e.)
here is my sketch:
#include <MIDI.h>
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
HardwareSerial Uart = HardwareSerial();
MIDI_CREATE_INSTANCE(HardwareSerial, Uart, midi2);
AudioPlaySdRaw track1, track2, track3, track4;
AudioMixer4 mixer1;
AudioOutputI2S dac;
AudioConnection c0(track1, 0, mixer1, 0);
AudioConnection c1(track2, 0, mixer1, 1);
AudioConnection c2(track3, 0, mixer1, 2);
AudioConnection c3(track4, 0, mixer1, 3);
AudioConnection c4(mixer1, 0, dac, 0);
AudioConnection c5(mixer1, 0, dac, 1);
AudioControlSGTL5000 audioShield;
const char* track_1_sound = "BD1.RAW";
const char* track_2_sound = "HH1.RAW";
const char* track_3_sound = "SD1.RAW";
int active_track = 1;
void HandleNoteOn(byte channel, byte pitch, byte velocity){
switch(pitch){
case 64:
track1.play(track_1_sound);
break;
case 65:
track2.play(track_2_sound);
break;
case 66:
track3.play(track_3_sound);
break;
}
}
void HandleNoteOff(byte channel, byte pitch, byte velocity){
}
void HandleProgramChange (byte channel, byte number, byte value){
}
void setup() {
midi2.setHandleNoteOn(HandleNoteOn); // Put only the name of the function
midi2.setHandleNoteOff(HandleNoteOff);
midi2.setHandleProgramChange(HandleProgramChange);
midi2.begin(MIDI_CHANNEL_OMNI);
delay(100);
AudioMemory(50);
audioShield.enable();
audioShield.volume(0.6);
SPI.setMOSI(7);
SPI.setSCK(14);
SD.begin(10);
}
void loop () {
midi2.read();
}