MIDI MODULATION EFFECTS inspired by musical effects & DJ tools

This project is sort of a pitch shift and oscillator modulation like effects for electric musical instruments. For instance, an effects pedal for a guitar, or a signal processor for a midi synthesizer. It’s also has reference from DJ equipments.

The main pitch shifter is the potentiometer. The pitch actually changes as the potentiometer turns up. There’s also a switch to turn on the piezo in order to produce sound.

Like any effects pedal, we need to know whether it’s on or off. This kit actually has a LED to determine whether the effect is running. By turning the potentiometer, it dims or light the LED as it turns.

In the circuit, there’s also an oscillator which changes the oscillation of the sound. It goes faster or slower through the use of a photoresistor. The aim is to have 2 effects instead of 1, so a bypass switch is used to run with or without the oscillator effect.

Later, I’ll go through my process in this program, and challenges that I have faced in terms of programming, circuitry and faulty parts.

INPUT:

–          Button switch : (1) for bypass (2) to complete the circuit

–          Potentiometer : Pitch Shift, sending signals to the LED

–          Photoresistor : Oscillator, closes when it’s too dark

OUTPUT:

–          LED

–          Piezo

This is the end sketch by using Frizzing:ImageImage

I started off testing the possibilities that this small piezo can do. So it was actually a simple circuit with a button switch. Then it worked!! This was actually referred from the arduino tutorial.

Image

So, here I started with an idea to use the potentiometer to change pitch. However, it was first started off with 5 buttons, but the idea was not new and I actually broke one of it. In addation with the lack of power supply through multiple buttons So, potentiometer pitch shift was an interesting plan to go.

Image

Everything was fine, I started to add more output with the LED. I merged both sketches in 1 void loop. It fades in and out smoothly when the potentiometer is turned. It actually received the signal from the digital output that the potentiometer had sent.

Image

Everything was fine, I started to add more output with the LED. I merged both sketches in 1 void loop. It fades in and out smoothly when the potentiometer is turned. It actually received the signal from the digital output that the potentiometer had sent.

Image

Lastly, the photoresistor did not work as usual. After adding my 3rd loop, the whole circuit just gone wrong. I found out it was the programming issue. I actually commanded both the photoresistor and the potentiometer to produce separate sound. So, instead I use back the concept for the LED. The photoresistor then receive signals from the potentiometer to produce speed changes or oscillations.  Another thing that I want to voice out is the piezo I got. Look at the bottom one, that’s actually mine and it sounded soft. Thankfully, my friend was willing to trade hers for mine.

Image

I could say the toughest part is to merge both loops together without errors. It needs thought out thoroughly before hand, so pseudo code would be preferable for starting.

You guys can try it out too. Here’s the code,

#include “pitches.h”

int notes[] = {
NOTE_B0,NOTE_C1,NOTE_D1,NOTE_E1,NOTE_F1,NOTE_G1,NOTE_A1,
NOTE_B1,NOTE_C2,NOTE_D2,NOTE_E2,NOTE_F2,NOTE_G2,NOTE_A2,
NOTE_B2,NOTE_C3,NOTE_D3,NOTE_E3,NOTE_F3,NOTE_G3,NOTE_A3};

int Tone = 0;
int speakerPin = 2;

const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)

float frameRate = 1.0f; // speed of playing the sound
float inputValue = 0;
void setup() {
// initialize serial communications (for debugging only):
Serial.begin(9600);
}

void loop() {

// POTENTIOMETER:
// get potentiometer input
int sensorValue = analogRead(A0); // 0 – 1023
Serial.print(sensorValue);

// calculate corresponding, divide by 49 as we have 21 pitches. 1023/13 ~ 21
int pitch = sensorValue/49;

tone(speakerPin, notes[pitch], 100);

// delay to let it finish ‘tone’ instruction.
delay(100);

// LED:
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// change the analog out value:
analogWrite(analogOutPin, outputValue);

// print the results to the serial monitor:
Serial.print(“sensor = ” );
Serial.print(sensorValue);
Serial.print(“\t output = “);
Serial.println(outputValue);

// wait 2 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(2);

// PHOTORESISTOR:
// read the sensor:
int sensorReading = analogRead(A5);
// print the sensor reading so you know its range
Serial.println(sensorReading);
// map the analog input range (in this case, 400 – 1000 from the photoresistor)
// to the output pitch range (120 – 1500Hz)
// change the minimum and maximum input numbers below
// depending on the range your sensor’s giving:
int thisPitch = map(sensorReading, 400, 1000, 120, 1500);
frameRate = 0.5f + ( sensorReading / 1023 );

// play the pitch:
tone(4, thisPitch, 10);
delay(frameRate); // delay in between reads for stability

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s