NANO-8 DRUM TRIGGER KIT..

Started by deadastronaut, May 08, 2016, 04:06:18 PM

Previous topic - Next topic

deadastronaut

yep thought so,  the dc sockets are internally switched to ground when unplugged.

no problem .

https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

neufena

Thanks so much for the help.  Will test tonight if possible and let you know how it works out.

deadastronaut

https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

stallik

Only just got a working 'brain' and having difficulty with the open/closed switch. No matter what I try, I get a rapid succession of notes. Tried different switches, cable lengths etc. Am I missing something?
Insanity: doing the same thing over and over again and expecting different results. Albert Einstein

deadastronaut

#44
hi kev, strange , i have a momentary spst and had no issue like that....its solidly either open or closed.

hmmmm.....

footswitch goes to socket 9

hi hat pad goes to socket 4





https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

stallik

One day, I'll learn to read. Not at home to check but I'm 100% sure that I'm using the wrong socket.
Was going by the android sketch while field testing a malt.
My new 'brain' is software on an iPad sitting in a Behringer dock courtesy Maplin closing down sale. Surprisingly low latency
Insanity: doing the same thing over and over again and expecting different results. Albert Einstein

deadastronaut

Yeah thought it might be....enjoy the malt... :icon_mrgreen:
https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

deadastronaut

hi guys, necro post...

been having fun with this a lot....however, a friend asked if this could put midi out on

MIDI CHANNEL 10 instead of CHANNEL 1.  (as midi channel 10 is standard on most midi keyboards
to use the keyboards internal drum kits.)

there isn't any 'MIDI' channel reference in the code that i can see, so is this possible?.

which part denotes 'MIDI CHANNEL 1'' ?...thanks guys.


/*ROB HENRY /DEADASTRONAUTFX 'NANO-8 PAD KIT...8 PADS IN CHRONOLOGICAL ORDER.
* // TEMPLATE FOR EZDRUMMER 'BASIC'KIT, works on ALL EZDRUMMER KITS
* // HI HAT OPENS ONLY WHEN HIT VERSION.
* // WITH HI HAT OPEN/CLOSED CONTROL VIA MOMENTARY SWITCH socket 9.
* //
* // 8 piece DRUM KIT.
* // HI HAT CONTROL USES PAD 4.
* // 8 PADS / PAD 4 (which uses 2 sounds) FOR HI HAT CONTROL . (when used with momentary switch)
// (SEE LINES 129&231=22)TO CHANGE CLOSED HAT SOUND)
*/



//Piezo defines
#define NUM_PIEZOS 8
#define PAD1_THRESHOLD 10
#define PAD2_THRESHOLD 10
#define PAD3_THRESHOLD 10
#define PAD4_THRESHOLD 10
#define PAD5_THRESHOLD 10 //MIN/MAX VELOCITIES/sensitivity...
#define PAD6_THRESHOLD 10
#define PAD7_THRESHOLD 10
#define PAD8_THRESHOLD 10


#define START_SLOT 0 //0 START ANALOG INPUTS

//MIDI note defines for each trigger
#define PAD1_NOTE 34 //pad1 kick + // <these are the assigned midi notes, change to suit.
#define PAD2_NOTE 38 //pad2 snare +
#define PAD3_NOTE 49 //pad3 crash 1
#define PAD4_NOTE 17 //pad4 HAT SWITCHES MIDI NOTES BETWEEN 17/22.(CLOSED/OPEN HAT)
#define PAD5_NOTE 53 //pad5 ride bell + //(SEE LINES 129&231=22)TO CHANGE CLOSED HAT SOUND
#define PAD6_NOTE 91 //pad6 ride cymbal + MIDI NOTE NUMBERS..
#define PAD7_NOTE 47 //pad7 mid tom
#define PAD8_NOTE 41 //pad8 lo floor tom


//MIDI defines
#define NOTE_ON_CMD 0x90
#define NOTE_OFF_CMD 0x80
#define MAX_MIDI_VELOCITY 127

//MIDI baud rate
#define SERIAL_RATE 31250

//Program defines
//ALL TIME MEASURED IN MILLISECONDS
#define SIGNAL_BUFFER_SIZE 50
#define PEAK_BUFFER_SIZE 10
#define MAX_TIME_BETWEEN_PEAKS 10
#define MIN_TIME_BETWEEN_NOTES 10

//map that holds the mux slots of the piezos
unsigned short slotMap[NUM_PIEZOS];

//map that holds the respective note to each piezo
unsigned short noteMap[NUM_PIEZOS];

//map that holds the respective threshold to each piezo
unsigned short thresholdMap[NUM_PIEZOS];

//Ring buffers to store analog signal and peaks
short currentSignalIndex[NUM_PIEZOS];
short currentPeakIndex[NUM_PIEZOS];
unsigned short signalBuffer[NUM_PIEZOS][SIGNAL_BUFFER_SIZE];
unsigned short peakBuffer[NUM_PIEZOS][PEAK_BUFFER_SIZE];

boolean noteReady[NUM_PIEZOS];
unsigned short noteReadyVelocity[NUM_PIEZOS];
boolean isLastPeakZeroed[NUM_PIEZOS];

unsigned long lastPeakTime[NUM_PIEZOS];
unsigned long lastNoteTime[NUM_PIEZOS];

//Variables used for switch mod
byte hihat_switch = 0;
unsigned long switch_pressed = 0;

void setup()
{
Serial.begin(SERIAL_RATE);
//initialize globals
for(short i=0; i<NUM_PIEZOS; ++i)
{
currentSignalIndex[i] = 0;
currentPeakIndex[i] = 0;
memset(signalBuffer[i],0,sizeof(signalBuffer[i]));
memset(peakBuffer[i],0,sizeof(peakBuffer[i]));
noteReady[i] = false;
noteReadyVelocity[i] = 0;
isLastPeakZeroed[i] = true;
lastPeakTime[i] = 0;
lastNoteTime[i] = 0;
slotMap[i] = START_SLOT + i;
}
thresholdMap[0] = PAD1_THRESHOLD;
thresholdMap[1] = PAD2_THRESHOLD;
thresholdMap[2] = PAD3_THRESHOLD;
thresholdMap[3] = PAD4_THRESHOLD; //hi hat switch controlled
thresholdMap[4] = PAD5_THRESHOLD;
thresholdMap[5] = PAD6_THRESHOLD;
thresholdMap[6] = PAD7_THRESHOLD;
thresholdMap[7] = PAD8_THRESHOLD;
noteMap[0] = PAD1_NOTE;
noteMap[1] = PAD2_NOTE;
noteMap[2] = PAD3_NOTE;
noteMap[3] = PAD4_NOTE; // hi hat switch controlled
noteMap[4] = PAD5_NOTE;
noteMap[5] = PAD6_NOTE;
noteMap[6] = PAD7_NOTE;
noteMap[7] = PAD8_NOTE;

}

void loop()
{
unsigned long currentTime = millis();

if(currentTime > (switch_pressed + 2))
{
hihat_switch = (((hihat_switch << 1) | digitalRead(3)) & 3);
if(hihat_switch == 2){
noteFire(22, 127); // <CHANGE THIS NUMBER '22' FOR 'OPEN HAT' SOUND.
switch_pressed = currentTime;
}

}
for(short i=0; i<NUM_PIEZOS; ++i)
{
//get a new signal from analog read
unsigned short newSignal = analogRead(slotMap[i]);
signalBuffer[i][currentSignalIndex[i]] = newSignal;
//if new signal is 0
if(newSignal < thresholdMap[i])
{
if(!isLastPeakZeroed[i] && (currentTime - lastPeakTime[i]) > MAX_TIME_BETWEEN_PEAKS)
{
recordNewPeak(i,0);
}
else
{
//get previous signal
short prevSignalIndex = currentSignalIndex[i]-1;
if(prevSignalIndex < 0) prevSignalIndex = SIGNAL_BUFFER_SIZE-1;
unsigned short prevSignal = signalBuffer[i][prevSignalIndex];
unsigned short newPeak = 0;
//find the wave peak if previous signal was not 0 by going
//through previous signal values until another 0 is reached
while(prevSignal >= thresholdMap[i])
{
if(signalBuffer[i][prevSignalIndex] > newPeak)
{
newPeak = signalBuffer[i][prevSignalIndex];
}
//decrement previous signal index, and get previous signal
prevSignalIndex--;
if(prevSignalIndex < 0) prevSignalIndex = SIGNAL_BUFFER_SIZE-1;
prevSignal = signalBuffer[i][prevSignalIndex];
}
if(newPeak > 0)
{
recordNewPeak(i, newPeak);
}
}
}
currentSignalIndex[i]++;
if(currentSignalIndex[i] == SIGNAL_BUFFER_SIZE) currentSignalIndex[i] = 0;
}
}

void recordNewPeak(short slot, short newPeak)
{
isLastPeakZeroed[slot] = (newPeak == 0);
unsigned long currentTime = millis();
lastPeakTime[slot] = currentTime;
//new peak recorded (newPeak)
peakBuffer[slot][currentPeakIndex[slot]] = newPeak;
//1 of 3 cases can happen:
// 1) note ready - if new peak >= previous peak
// 2) note fire - if new peak < previous peak and previous peak was a note ready
// 3) no note - if new peak < previous peak and previous peak was NOT note ready
//get previous peak
short prevPeakIndex = currentPeakIndex[slot]-1;
if(prevPeakIndex < 0) prevPeakIndex = PEAK_BUFFER_SIZE-1;
unsigned short prevPeak = peakBuffer[slot][prevPeakIndex];
if(newPeak > prevPeak && (currentTime - lastNoteTime[slot])>MIN_TIME_BETWEEN_NOTES)
{
noteReady[slot] = true;
if(newPeak > noteReadyVelocity[slot])
noteReadyVelocity[slot] = newPeak;
}
else if(newPeak < prevPeak && noteReady[slot])
{
noteFire(noteMap[slot], noteReadyVelocity[slot]);
noteReady[slot] = false;
noteReadyVelocity[slot] = 0;
lastNoteTime[slot] = currentTime;
}
currentPeakIndex[slot]++;
if(currentPeakIndex[slot] == PEAK_BUFFER_SIZE) currentPeakIndex[slot] = 0;
}

void noteFire(unsigned short note, unsigned short velocity)
{
if(velocity > MAX_MIDI_VELOCITY)
velocity = MAX_MIDI_VELOCITY;
if((note == 17) && (hihat_switch == 0)) //if pad 4 is hit (note 17) and switch is pressed change note to 22 //
{ //
note = 22; // <CHANGE THIS NUMBER '22' FOR 'OPEN HAT' SOUND.
}
midiNoteOn(note, velocity);
midiNoteOff(note, velocity); //
}
void midiNoteOn(byte note, byte midiVelocity)
{
Serial.write(NOTE_ON_CMD);
Serial.write(note);
Serial.write(midiVelocity);
}

void midiNoteOff(byte note, byte midiVelocity)
{
Serial.write(NOTE_OFF_CMD);
Serial.write(note);
Serial.write(midiVelocity);
}



https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

bluebunny

It's the second half of the NOTE_ON_CMD and NOTE_OFF_CMD bytes, currently always zero:

#define NOTE_ON_CMD 0x90
#define NOTE_OFF_CMD 0x80


The 0x9 half (most significant four bits) is actually the "note on" command.  The "0" half (least significant four bits) is the channel - in this case channel 1 (it counts from zero).   So a note on for channel 10 would be 0x99.
  • SUPPORTER
Ohm's Law - much like Coles Law, but with less cabbage...

deadastronaut

ahhh cheers marc...thats blinding mate.

i still dont get this codey lark.....might as well be latvian... ;D

cheers man, i'll give it  go.  8) 8) 8)
https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

PRR

#50
> this codey lark.....might as well be latvian...

No, it's hasty programming.

Fully self-explaining code would put ALL "magic numbers" in header constants.

// top of code
#define CHANNEL_CMD 0x9
// 0x9 is MIDI CHANNEL 10 , 0x0 for Ch1, 0x1 for Ch2, etc
#define NOTE_ON_CMD 0x9
#define NOTE_OFF_CMD 0x8
//body
send NOTE_ON_CMD then CHANNEL_CMD    //(probably want to byte-shift and AND
// makes Note On for Ch 10

even....
MIDI_CHANNEL = 10
MIDI_CH_CODE = byte(MIDI_CHANNEL)-1
  • SUPPORTER

Ripthorn

I've been on a big arduino/attiny85 kick lately, and this thread getting bumped reminded me of your PCB which I saw when it first came out. Now that I have some more uC experience under my belt, I think I may need to give this a crack. Currently debating all the options and how I could take advantage of the digital in's or PWM'd outs to make a monster thing...Something like using rotary encoders to be able to set the min sensitivity threshold parameter in the code on the fly. Put it in a larger enclosure and give it more...something :)
Exact science is not an exact science - Nikola Tesla in The Prestige
https://scientificguitarist.wixsite.com/home

deadastronaut

cheers paul. thats what i need, baby steps...cheers 8)

rip: cool, i added a temporary pot on my mates build for the hell of it, on the kick and snare inputs , to add a 'faux sensitivity on the fly' which worked pretty well...whilst testing with an E KIT snare n kick pedal.

like i say it worked well to set the max hit'velocity/ ....handy for different styles, jazz, slow blues/rock etc...



https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//