element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
MusicTech
  • Challenges & Projects
  • Design Challenges
  • MusicTech
  • More
  • Cancel
MusicTech
Blog PlectralEFFECTS - Final Notes and Demonstration
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Former Member
  • Date Created: 10 Apr 2016 5:57 PM Date Created
  • Views 568 views
  • Likes 2 likes
  • Comments 1 comment
  • plectraleffects
  • musictech
Related
Recommended

PlectralEFFECTS - Final Notes and Demonstration

Former Member
Former Member
10 Apr 2016

PlectralEFFECTS - Final Notes

 

 

I have had a busy couple of weeks, and unfortunately the project has been on hold.  I have been busy with getting our family home ready to go on the market.

 

I did however complete the implementation of continuous controllers, and obtained my main goal of the project to control the effect / envelopes from the plectrum.   Please see the following video for the demonstration purpose :

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

The main challenge for me in implementation of the enveloped effects was gaining an understanding of MIDI Clock.  The effect mode is varied between two states, depending on which side of the plectrum is used.  Effects are tempo synced to the DAW and are in time with beats.  MIDI Clock generates a byte 0xF8 at exactly 24 pulses per quarter note.  The envelope effects are sinusoidal calculated at 1/24th of a 1/2 wave, or 0.130899 radians to keep in time with the MIDI Clock.

 

 

 

The code is attached below, and I hope that is of some use. I will continue on with the project and see if there is more I can implement with it, but right now I am happy to play with it.

 

 

I would have liked to have seen what I could do with the BeagleBone Black.  Unfortunately, the main components including the BBB of the challenger kit never arrived.

 

 

 

Arduino Code :

 

// Include the Bounce2 library found here :
// https://github.com/thomasfredericks/Bounce2
#include <Bounce2.h>

#define BUTTON_PIN_1 0
#define BUTTON_PIN_2 1


#define LED_PIN  13
#define LED_PIN2 10
#define LED_PIN3 9

// Instantiate a Bounce object
Bounce debouncer1 = Bounce(); 
Bounce debouncer2 = Bounce(); 

// Current clock
byte midiClock;

// Current effect mode
byte effectMode;

float rads;


void noteOn(byte channel, byte pitch, byte velocity) {
  MIDIEvent noteOn = {0x09, 0x90 | channel, pitch, velocity};
  MIDIUSB.write(noteOn);
}

void noteOff(byte channel, byte pitch, byte velocity) {
  MIDIEvent noteOff = {0x08, 0x80 | channel, pitch, velocity};
  MIDIUSB.write(noteOff);
}


void controlChange(byte channel, byte control, byte value) {
  MIDIEvent event = {0x0B, 0xB0 | channel, control, value};
  MIDIUSB.write(event);
}

bool value1state=false;
bool value2state=false;

void loop() {
  debouncer1.update();
  debouncer2.update();

  int value1 = debouncer1.read();
  int value2 = debouncer2.read();

  // Turn on the LED if either button is pressed :
  if ( value1 == LOW ) {
    digitalWrite(LED_PIN, HIGH );
    if (!value1state)
    {
    effectMode=1;
    rads=0;
    value1state=true;
    }
  } 
  else {
    digitalWrite(LED_PIN, LOW );
    if (value1state)
    {
    value1state=false;
    }
  }

 if (  value2 == LOW ) {
    digitalWrite(LED_PIN, HIGH );
    if (!value2state)
    {
     effectMode=2;
     rads=0.13089969*6; // phase offset
     value2state=true;
    }
  } 
  else {
    digitalWrite(LED_PIN, LOW );
    if (value2state)
    {    
     value2state=false;
    }
  }


 while(MIDIUSB.available() > 0) {  
      MIDIEvent e;
      e = MIDIUSB.read();

      if (e.m1 == 0xFA) {
        midiClock = 0;
        rads = 0.0;
      }

      if (e.m1 == 0xFC) {
        midiClock = 0;
        rads = 0.0;
      }

      if (e.m1 == 0xF8) {
      
      if (midiClock == 0) 
       {
        digitalWrite(LED_PIN, HIGH );
       }

       midiClock++;
       if (midiClock >= 24) midiClock = 0;

       if (effectMode == 1)
        rads = rads + (0.13089969*4);
       else
        rads = rads + (0.13089969);

       
       if (rads >= PI*2) rads = 0;   
     
       controlChange(0, 74,  round((sin(rads)*63)+64));       
       MIDIUSB.flush();
      }
     }

   digitalWrite(LED_PIN, LOW );



}

void setup() {
  // Setup the first button with an internal pull-up :
  pinMode(BUTTON_PIN_1,INPUT_PULLUP);
  debouncer1.attach(BUTTON_PIN_1);
  debouncer1.interval(5); // interval in ms
  
   // Setup the second button with an internal pull-up :
  pinMode(BUTTON_PIN_2,INPUT_PULLUP);
  debouncer2.attach(BUTTON_PIN_2);
  debouncer2.interval(5); // interval in ms


  //Setup the LEDs :
  pinMode(LED_PIN,OUTPUT);
  pinMode(LED_PIN2,OUTPUT);
  pinMode(LED_PIN3,OUTPUT);
}

  • Sign in to reply
  • DAB
    DAB over 9 years ago

    It looks like you are making good progress.

     

    It is clear that you have a host of new techniques to play with to make music.

     

    Nice job,

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube