Tuesday, June 24, 2014

CUSTOM DIY MIDI FOOT CONTROLLER for ABLETON LIVE - Arduino

I'm a geek. I know it. I like DIY'ing things. I bought a 3d printer (which is sitting in my office not working right now)... and like building drones. I usually bite off more than I can chew and often have to go to others for help. This time around, it was to build a custom Midi foot controller to use with Ableton Live for our click/loop tracks.


I have a Keith MacMillen Softstep... but its really complicated to program, and the buttons are rubber. I never knew if the thing was ever pressed or not. I wanted the "click" of a regular guitar pedal. And I don't need something that complicated. There are some other pedals you can purchase... but their footprint wasn't correct for my pedal board. And I didn't want to spend another $300-$400.

So for around $70 I built my own.

Physical Construction: 
I used luan ply and just made it in the wood shop.
SKETCHUP MODEL

Switches:
You need momentary SPST switches. I got the "silent" ones so it doesn't sound like a firecracker going off in the middle of the worship service. Something like this:

Microcontroller: 
I used an arduino teensy that I bought from sparkfun. It offers a couple of important things:
• It has USB connectivity
•It's powered via USB
•It supports a native MIDI control without need for some intermediary software.
•It has a ton of digital pins

LCD Display
I bought it HERE from sparkfun. I wanted a serial rather than parallel connection so I didn't have to chew up lots of extra pins. (pins= possible switches or leds, or connectors)

Connections. 
I suppose if I were really thorough I'd have some sort of fancy connection diagram. Basically,
I hooked pin 1 up to the serial LCD pin. And then the switches have all the connections from there. You could in theory have 24 or so physical buttons/switches. Or if you were really good with programming could figure out a way to use multiple banks. But that's too complicated for me.

Code:
This was the hard part. I first got it working with the MIDI buttons sketch. Then got the serial LCD sketch to work. As I'm not a programmer, I had to learn to combine the two together.
Here's the Arduino Code




/* Buttons to USB MIDI Example
   You must select MIDI from the "Tools > USB Type" menu
   To view the raw MIDI data on Linux: aseqdump -p "Teensy MIDI"
   This example code is in the public domain.
 
   You'll have to change the pin assignments below if you use different pins than I did.
*/

#include
#include
#define txPin 1

// the MIDI channel number to send messages
const int channel = 1;
SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10;  // conservative, 2 actually works


// Create Bounce objects for each button.  The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button14 = Bounce(14, 100);
Bounce button15 = Bounce(15, 100);  // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 10);  // which is appropriate for good
Bounce button3 = Bounce(3, 10);  // quality mechanical pushbuttons
Bounce button4 = Bounce(4, 10);
Bounce button5 = Bounce(5, 10);  // if a button is too "sensitive"
Bounce button6 = Bounce(6, 200);  // to rapid touch, you can
Bounce button7 = Bounce(7, 10);  // increase this time.
Bounce button8 = Bounce(8, 10);
Bounce button9 = Bounce(9, 10);
Bounce button10 = Bounce(10, 10);
Bounce button11 = Bounce(11, 10);
Bounce button12= Bounce(12, 10);



// wbp: goto with row & column
void lcdPosition(int row, int col) {
  LCD.write(0xFE);   //command flag
  LCD.write((col + row*64 + 128));    //position
  delay(LCDdelay);
}
void clearLCD(){
  LCD.write(0xFE);   //command flag
  LCD.write(0x01);   //clear command.
  delay(LCDdelay);
}
void backlightOn() {  //turns on the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(157);    //light level.
  delay(LCDdelay);
}
void backlightOff(){  //turns off the backlight
  LCD.write(0x7C);   //command flag for backlight stuff
  LCD.write(128);     //light level for off.
   delay(LCDdelay);
}
void serCommand(){   //a general function to call the command flag for issuing all other commands
  LCD.write(0xFE);
}


void setup() {
  // Configure the pins for input mode with pullup resistors.
  // The pushbuttons connect from each pin to ground.  When
  // the button is pressed, the pin reads LOW because the button
  // shorts it to ground.  When released, the pin reads HIGH
  // because the pullup resistor connects to +5 volts inside
  // the chip.  LOW for "on", and HIGH for "off" may seem
  // backwards, but using the on-chip pullup resistors is very
  // convenient.  The scheme is called "active low", and it's
  // very commonly used in electronics... so much that the chip
  // has built-in pullup resistors!

  pinMode(txPin, OUTPUT);
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);  // Teensy++ 2.0 LED, may need 1k resistor pullup
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(13, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP); //channel 1
  pinMode(15, INPUT_PULLUP); // channel 2 Teensy 2.0 LED, may need 1k resistor pullup
  LCD.begin(9600);
  clearLCD();
  lcdPosition(0,0);
  LCD.print("  Scott's MIDI      Dominator");
}

void loop() {
  // Update all the buttons.  There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  button14.update();
  button15.update();
  button2.update();
  button3.update();
  button4.update();
  button5.update();
  button6.update();
  button7.update();
  button8.update();
  button9.update();
  button10.update();
  button11.update();
  button12.update();


  // Check each button for "falling" edge.
  // Send a MIDI Note On message when each button presses
  // Update the Joystick buttons only upon changes.
  // falling = high (not pressed - voltage from pullup resistor)
  //           to low (pressed - button connects pin to ground)
  if (button14.fallingEdge()) {
    usbMIDI.sendNoteOn(60, 99, channel);  // 60 = C4
    if (digitalRead(14) == LOW) {
    LCD.print ("SONG 1");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 1     ");}
  }
  if (button15.fallingEdge()) {
    usbMIDI.sendNoteOn(61, 99, channel);  // 61 = C#4
        if (digitalRead(15) == LOW) {
    LCD.print ("SONG 2");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 2     ");}
  }
    if (button2.fallingEdge()) {
    usbMIDI.sendNoteOn(62, 99, channel);  // 62 = D4
    if (digitalRead(2) == LOW) {
    LCD.print ("SONG 3");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 3     ");}
  }
  if (button3.fallingEdge()) {
    usbMIDI.sendNoteOn(63, 99, channel);  // 63 = D#4
    if (digitalRead(3) == LOW) {
    LCD.print ("SONG 4");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 4     ");}
  }
  if (button4.fallingEdge()) {
    usbMIDI.sendNoteOn(64, 99, channel);  // 64 = E4
    if (digitalRead(4) == LOW) {
    LCD.print ("SONG 5");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 5     "); }
  }
  if (button5.fallingEdge()) {
    usbMIDI.sendNoteOn(65, 99, channel);  // 65 = F4
    if (digitalRead(5) == LOW) {
    LCD.print ("SONG 6");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("     SONG 6     ");}
  }
  if (button6.fallingEdge()) {
    usbMIDI.sendNoteOn(66, 99, channel);  // 66 = F#4
    if (digitalRead(6) == LOW) {
    LCD.print ("PLAY");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print (">>>>>PLAY<<<<<");}
  }
  if (button7.fallingEdge()) {
    usbMIDI.sendNoteOn(67, 99, channel);  // 67 = G4
    if (digitalRead(7) == LOW) {
    LCD.print ("STOP");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("      STOP      XXXXXXXXXXXXXXXX"); }
  }
  if (button8.fallingEdge()) {
    usbMIDI.sendNoteOn(68, 99, channel);  // 68 = G#4
    if (digitalRead(8) == LOW) {
    LCD.print ("NEXT");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("      NEXT      >>>>>>>>>>>>>>>>");}
  }
  if (button9.fallingEdge()) {
    usbMIDI.sendNoteOn(69, 99, channel);  // 69 = A5
    if (digitalRead(9) == LOW) {
    LCD.print ("PREVIOUS");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("    PREVIOUS    <<<<<<<<<<<<<<<<"); }
  }
  if (button10.fallingEdge()) {
    usbMIDI.sendNoteOn(70, 99, channel);  // 70 = A#5
    if (digitalRead(10) == LOW) {
    LCD.print ("EXTRA BUTTON 11");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("EXTRA BUTTON 11"); }
  }
  if (button11.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel);  // 71 = B5
    if (digitalRead(11) == LOW) {
    LCD.print ("EXTRA BUTTON 12");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("EXTRA BUTTON 12"); }
  }
    if (button12.fallingEdge()) {
    usbMIDI.sendNoteOn(72, 99, channel);  // 72 = C6
    if (digitalRead(12) == LOW) {
    LCD.print ("EXTRA BUTTON 13");
    LCD.print (0xFE, BYTE);
    LCD.print (0x01, BYTE);
    LCD.print ("EXTRA BUTTON 13");
          }
    delay(50);
  }

  // Check each button for "rising" edge
  // Send a MIDI Note Off message when each button releases
  // For many types of projects, you only care when the button
  // is pressed and the release isn't needed.
  // rising = low (pressed - button connects pin to ground)
  //          to high (not pressed - voltage from pullup resistor)
  if (button14.risingEdge()) {
    usbMIDI.sendNoteOff(60, 0, channel);  // 60 = C4
  }
  if (button15.risingEdge()) {
    usbMIDI.sendNoteOff(61, 0, channel);  // 61 = C#4
  }
  if (button2.risingEdge()) {
    usbMIDI.sendNoteOff(62, 0, channel);  // 62 = D4
  }
  if (button3.risingEdge()) {
    usbMIDI.sendNoteOff(63, 0, channel);  // 63 = D#4
  }
  if (button4.risingEdge()) {
    usbMIDI.sendNoteOff(64, 0, channel);  // 64 = E4
  }
  if (button5.risingEdge()) {
    usbMIDI.sendNoteOff(65, 0, channel);  // 65 = F4
  }
  if (button6.risingEdge()) {
    usbMIDI.sendNoteOff(66, 0, channel);  // 66 = F#4
  }
  if (button7.risingEdge()) {
    usbMIDI.sendNoteOff(67, 0, channel);  // 67 = G4
  }
  if (button8.risingEdge()) {
    usbMIDI.sendNoteOff(68, 0, channel);  // 68 = G#4
  }
  if (button9.risingEdge()) {
    usbMIDI.sendNoteOff(69, 0, channel);  // 69 = A5
  }
  if (button10.risingEdge()) {
    usbMIDI.sendNoteOff(70, 0, channel);  // 70 = A#5
  }
  if (button11.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel);  // 71 = B5
  }
  if (button12.risingEdge()) {
    usbMIDI.sendNoteOff(72, 0, channel);  // 71 = C6
  }
}










Monday, January 20, 2014

I was so proud of the body of Christ today:

Ricky is a man that one of our members at Grace Community Church of Frederick met at the Frederick Rescue Mission. Ricky was homeless and one of our members (Erik) took Ricky in, had him over to their house several times for dinner. They starting picking Ricky up to bring him to church. A couple of months ago Erik baptized Ricky as a disciple of Jesus at our church. Ricky has been attending faithfully and is a valued part of our body.

On Saturday, Ricky was rushed to the ER with significant health issues that placed Ricky in the ICU. Ricky's family is out of the picture. But Erik was right there with him. Erik slept overnight at the ICU to be by Ricky's side. The Dr.'s met with us to communicate Ricky's condition and asked who we were (since we were not family). All we could say is "We are disciples of Jesus and Ricky is a part of our Church." When no one else was there; the church was.

Today I learned something new about making disciples of Jesus- that following Jesus sometimes means sitting at the ICU hospital bed next to a homeless man to share Jesus' love. It means sleepless nights and prayers upon prayers. And I'm telling you this incredible act of kindness was not done by someone who is paid to be a pastor, but was done by a regular church member; someone who realized it was their life's calling to be a sold-out Christ follower.

That. Was. Awesome.

Please pray for Ricky- He has a very serious liver condition. The next steps and future is uncertain.

-Scott Avey

Tuesday, August 6, 2013

Consume Church?

I used to leave church and the conversation would go like this: Hey honey, “What did you think of church today?” The response followed: “I liked the message” or “It was too hot in the Worship Center” or “They played my song… I loved the music selection today” or “They have too many hymns” or “they don’t have enough hymns.” I'm sure you've had that experience too.... right?

We can evaluate our experience on Sunday morning by what we got out of it. We’ve submitted to the consumer mindset that says its all about me and what I can consume. I think somewhere in that conversation we’ve horribly missed the mark. 

It is my personal conviction that the primary purpose for the church gathering on Sunday is not what we can get, but what we can give. And I believe that’s in-line with the Bible. I believe our call is to evaluate how much we’ve been able to “one-another” at church. Did you know there are over 65 references to “one-another” in the NT alone?

Here are just a few:

Now that I, your Lord and Teacher, have washed your feet, you also should wash one another’s feet.

“A new command I give you: Love one another. As I have loved you, so you must love one another.

Be devoted to one another in love. Honor one another above yourselves.

Therefore let us stop passing judgment on one another. Instead, make up your mind not to put any stumbling block or obstacle in the way of a brother or sister.

[ Final Greetings ] Finally, brothers and sisters, rejoice! Strive for full restoration, encourage one another, be of one mind, live in peace. And the God of love and peace will be with you.

            Instead of evaluating our experience by what we get, we should evaluate our experience by how much we were able to pray for someone who is hurting, rejoice with someone that is rejoicing, mourning with someone who is grieving, care for someone who needs help, serve someone who needs assistance, share Christ with someone who needs hope. Lets leave and ask the question; “were you able to encourage someone today?” This is the call of each and every believer and not just the paid pastors.

            The one-anothers are so important because I can listen to some world-class preachers on the inter-webs, and I can worship on a mountain top with awesome music, but the one thing I cannot do by myself is encourage someone or be encouraged. And this only can happen if the entirety of the body is engaged. Its not up to a paid pastor. It's up to you.

Monday, July 29, 2013

I love you... but not your wife?

Imagine you went up to your good friend and said,
“Dude…. You’re awesome, but your wife. I just can’t stand her. I mean seriously, she’s super-lame.” 
I imagine you wouldn’t be good friends much longer. The quickest way to tick of a dude is to mess with his woman. But how many times do we bad-mouth the Jesus’ bride and act as if Jesus doesn’t even care? Do you think he will idly stand by while others bad-mouth his bride? 

The Church, according to Eph 5:25-33 is the bride of Christ. You can’t claim to love Jesus, but not love his bride- the church. Well…. I suppose you could, but you don’t know Jesus very well.

Eph 5 tells us that Jesus loves (agape) the church just as a husband would love his wife. As a matter of fact, his love for the church is so strong that, as men, we are supposed to model how we love our wives by how Jesus loves the church. It’s the standard. When it comes to loving his wife, there’s no one better than Jesus.

It’s easy to criticize the church- pointing out its blemishes, scars, abuses, moral failures, and hypocrisy. But really… finding fault with someone else doesn’t really take a lot of courage. “It takes no courage to criticize” to quote Anton Ego in Ratatouille. Yet many “Christians” join the chorus on blasting the church; particularly my generation and younger (born after 1980). They must not know Jesus as well as they thought. In doing so, I believe they grieve the heart of God.


I’m not submitting that we ignore problems. That’s naïveté. There has been way to much pain inflicted by the hands of people who claimed to be a Christ follower. But that’s a commentary on the individual, not the church. I'm submitting we need to acknowledge those problems, pursue growth, engage in solutions all while rejecting the sin of cynicism. Cynicism says that evil has had the loudest laugh and the last word. It says that God really isn’t in control of his church and that it’s beyond hope. Do you really believe that Jesus is not in control of his church? Do you believe that evil has triumphed- particularly over the church?

Repent. I did. I had to repent of cynicism toward the church. God showed me just a fraction of how much he loves His Church, and it was enough for me to say “I’m all in!” How bout you? Do you engage in solutions, or withdraw from the fight? Are you a critic who sits in the bleachers with their arms crossed, or are you a player on the field?



Friday, January 18, 2013

Questions and Crickets....

I've been putting my friends and family on the spot in the last 48 hours. In almost all cases, I get crickets. It was one of those questions that you don't mean to be rhetorical, but it can come across as if it was.

The question is this: What's the first thing you tell a new believer? Lets say you are sitting across the table from someone and they just made a decision to follow Christ. "In Jesus name we pray, amen." .... and they open their eyes. What do you say to them next? Reallly....What would you tell them. (Insert sound of crickets here) What is the next step for a new believer in Christ. I mean, what is the very next thing they should think or believe or do.? (More crickets)



I had the privilege of leading a new friend to Christ on Wednesday. It was awesome. I was pumped all day long. But I found myself soon in that place of anxiety:

 ... Stink... now what do I say? I want to get them started on the right path. If I mess up they could be set on a path to legalism or a permissive lifestyle. Neither of which are good. What to say... what to say....

Do you tell them a list of things they should not do? After all... they are Christians now and should act a certain way. Stop smoking! Don't party! (Col 2:20-23)


Or maybe they should get a list of things they should do. Read your bible, pray, go to church, fast, tithe.... You know, all the spiritual disciplines- (the things that us long-term Christians are not even that good at doing). After all, the song we all learned in church as a kid said: "Read the Bible pray every day and you'll grow, grow, grow. "

Here's what I told them. Well... I didn't tell 'em. Jesus did. And it was a good reminder to myself, that this is what the Christian walk is really all about. Abide in the vine.

John 15
This is to my Father’s glory, that you bear much fruit, showing yourselves to be my disciples.

Abide in Me, and I in you. As the branch cannot bear fruit of itself unless it abides in the vine, so neither can you unless you abide in Me. 5 I am the vine, you are the branches; he who abides in Me and I in him, he bears much fruit, for apart from Me you can do nothing.

There's a ton to dive into in this passage. What strikes me is that includes both a passive and active sense of abiding.

Passive: It is the vine that does the growing in us. We don't do it in ourselves. No amount of effort will see that we grow and produce fruit. I'll have to politely disagree with that children's song- the spiritual disciplines don't make us grow. They may be a tool to help us abide- but according to John 15, the vine makes us grow- not our efforts.

Active: We have to actively abide in the vine. We have a part to play. We have to submit ourselves to the vine. Don't fight against it. When He says to do something... follow.

I am reminded that in all of our Christian practices, it boils down to just that: Abide in the vine. 

Monday, January 14, 2013

God's on your team!

Think of all the things we give money to. We'll give money to our schools. We'll give money to Political Action Committees. We'll give money to charities. Each time we give, we are making a statement about the trustworthiness of the person we are giving money to. We are trusting that they money will get a better return on the investment- be it a soccer club, politician or a stock broker. (I get a little antsy giving money to someone who is called a "broke-er".) 




Malachi 3:10 as well as Proverbs 3:9 both tell us a principle- that giving to God is a great investment. We are taking a step of faith- knowing that God is trustworthy with our funds.  When we give to the Lord, we are inviting God onto our financial team. He is getting in the game. 




Think about it, God owns the cattle on a thousand hills (Ps. 50:10). Do you think that it will be too much for him to take care of you?


 Proverbs 3:5-6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways submit to him, and he will make your paths straight.

Thursday, June 7, 2012

Servant Leadership

 

Servanthood

Matthew 20:26-28 

"Whoever wants to become the greatest among you must be your servant, and whoever want to be first must be your slave- just as the Son of Man did not come to be served, but to serve, and to give his life as a ransom for many."  
      Jesus' teachings on servanthood have always bothered me. Not because I don't think He's right, but because its so stinking hard to do.
        What I love about the teaching is that it is so counter-cultural. I am an antagonist so I love times when Jesus acts against the culture and upsets the order of things. This is one of those teachings: the 1st shall be the last and the last shall be the 1st. He is totally re-arranging the social order; It's no longer the big-wigs who are the greatest, it's the lowest servants. I imagine that really torked off some of Jesus' listeners who had spent so much time and money trying to climb the social ladders of the day.
         But what bothers me about the teaching is that it reveals the true nature of my heart (and I would venture to say others' heart as well). When I'm really honest, I don't want to serve others. I want to be served. I want luxury. That desire is based on a love of self more than a love of others. The teaching reveals my diseased heart and I don't like that. It shows me what I really think and believe about other people. It attacks the real disease and reveals the sickness.
          Jesus says servanthood is a primary requirement for leadership. If you want to lead, you need to love those you are called to lead more than you love yourself. If you are in the workplace, it means you care for your people and don't use them. If you are in ministry, it means you care more about the well-being of your people than you do about growth or personal success. As a father, it means I am a servant-leader at home. My children do not exist to serve me, but I am there to look out for their best interest.
          As a Worship Pastor and lead worshipper, this means that I had better develop an addiction to serving behind the scenes; for the sake of the people I am leading as well as for the sake of my team. It also means that my artistic and music selections, while being true to my heart, primarily serve the congregation and not my own tastes and preferences. It means I stay focused on the mission of the church and the edification of the Bride rather than doing what I like to do.
          I believe we are called to be SERVANT leaders for two reasons; Primarily, for the blessing and betterment of the people we are called to lead. Secondarily, to set an example to those we lead. My kids learn to be servants when they watch me serve them and their mother.
         Step up folks. Step out. Seek out ways today of being a servant leader to those you are called to lead.