Tuesday, October 24, 2017

Midi To Trig with selectable MIDI channel.

I combined the work of two great minds and made this midi to trigger interface with changeable midi channel.

http://www.notesandvolts.com and http://youthvulture.blogspot.com/2014/03/rhythm-ace-fr-2l-midi-retrofit-with.html




// ************************************************************************
// AUDUINO - MIDI Upgrade v1.1
// For Arduino NANO
//
// MIDI programming by Notes and Volts http://www.notesandvolts.com
//
// Tutorial - http://www.notesandvolts.com/2015/05/auduino-synth-midi.html
//
// ** Requires Arduino MIDI Library v4.2 or later **
//
// Based on the Auduino Synthesizer v5 by Peter Knight http://tinker.it
// ************************************************************************
// Version 1.0 - Initial release
// Version 1.1 - Fixed bug that caused note to hang with some DAWs
// ************************************************************************

#include <avr/io.h>
#include <avr/interrupt.h>
#include <MIDI.h> // Requires Arduino MIDI Library v4.2 or later

// *******************************************************************************
// If the DIP Switch option is installed - set dipSwitchInstalled to "true"
const bool dipSwitchInstalled = true;
// DIP Switch Setting = Channel (1=ON, 0=OFF)
// 0000 = 1   0001 = 2   0010 = 3   0011 = 4
// 0100 = 5   0101 = 6   0110 = 7   0111 = 8
// 1000 = 9   1001 = 10  1010 = 11  1011 = 12
// 1100 = 13  1101 = 14  1110 = 15  1111 = 16
//
// If DIP Switch is NOT installed - change dipSwitchInstalled to "false"
// If dipSwitchInstalled is set to false, the MIDI channel will be set
// to the value of MIDICHANNEL
#define MIDICHANNEL 1 // Can be a value from 1 to 16
// *******************************************************************************

MIDI_CREATE_DEFAULT_INSTANCE();

// DIP Switch Pins
#define DIP_SW1 9
#define DIP_SW2 10
#define DIP_SW3 11
#define DIP_SW4 12

#if defined(__AVR_ATmega8__)
//
// On old ATmega8 boards.
//    Output is on pin 11
//
#define LED_PIN       13
#define LED_PORT      PORTB
#define LED_BIT       5
#elif defined(__AVR_ATmega1280__)
//
// On the Arduino Mega
//    Output is on pin 3
//
#define LED_PIN       13
#define LED_PORT      PORTB
#define LED_BIT       7
#else
//
// For modern ATmega168 and ATmega328 boards
//    Output is on pin 3
//
#define LED_PIN       13
#define LED_PORT      PORTB
#define LED_BIT       5
#endif

#define TRIG1 2     // Trig1 set to Arduino Pin 2
#define TRIG2 3     // Trig2 set to Arduino Pin 3
#define TRIG3 4     // Trig3 set to Arduino Pin 4
#define TRIG4 5     // Trig4 set to Arduino Pin 5
#define TRIG5 6     // Trig5 set to Arduino Pin 6
#define TRIG6 7     // Trig6 set to Arduino Pin 7
#define TRIG7 8     // Trig7 set to Arduino Pin 8

int TIME = 5;        // Very short delay time to keep the loop snappy

void NoteOnMidi(byte channel, byte pitch, byte velocity){
  digitalWrite(TRIG1, LOW);    // All pins set to LOW, since
  digitalWrite(TRIG2, LOW);  // rising edge (HIGH to LOW).
  digitalWrite(TRIG3, LOW);
  digitalWrite(TRIG4, LOW);
  digitalWrite(TRIG5, LOW);
  digitalWrite(TRIG6, LOW);
  digitalWrite(TRIG7, LOW);


  if (velocity > 0){             // So midi devices that send note-on at zero
                                 // velocity for note-off don't double trigger.
    if (pitch == 60) {        
      digitalWrite(TRIG1, HIGH);   // Looks for specific note numbers. If
      delay(TIME);               // they occur, rises from LOW to HIGH,
      digitalWrite(TRIG1, LOW);  // firing the trigger circuit, then
    }                            // goes back to LOW in anticipation of
    else if(pitch == 62) {
      digitalWrite(TRIG2, HIGH);
      delay(TIME);
      digitalWrite(TRIG2, LOW);
    }
       else if(pitch == 64) {
      digitalWrite(TRIG3, HIGH);
      delay(TIME);
      digitalWrite(TRIG3, LOW);
    }
    else if(pitch == 65) {
      digitalWrite(TRIG4, HIGH);
      delay(TIME);
      digitalWrite(TRIG4, LOW);
    }
    else if(pitch == 67) {
      digitalWrite(TRIG5, HIGH);
      delay(TIME);
      digitalWrite(TRIG5, LOW);
    }
    else if(pitch == 69) {
      digitalWrite(TRIG6, HIGH);
      delay(TIME);
      digitalWrite(TRIG6, LOW);
    }
    else if(pitch == 71) {
      digitalWrite(TRIG7, HIGH);
      delay(TIME);
      digitalWrite(TRIG7, LOW);
 
    }
  }
}




void setup() {
  if (dipSwitchInstalled) {
    pinMode(DIP_SW1, INPUT_PULLUP);
    pinMode(DIP_SW2, INPUT_PULLUP);
    pinMode(DIP_SW3, INPUT_PULLUP);
    pinMode(DIP_SW4, INPUT_PULLUP);
  }
  pinMode(LED_PIN, OUTPUT);
  pinMode(TRIG1, OUTPUT);
  pinMode(TRIG2, OUTPUT);
  pinMode(TRIG3, OUTPUT);
  pinMode(TRIG4, OUTPUT);
  pinMode(TRIG5, OUTPUT);
  pinMode(TRIG6, OUTPUT);
  pinMode(TRIG7, OUTPUT);
 
    if (dipSwitchInstalled) {
    MIDI.begin(DipSwitch());
  }
  else {
    MIDI.begin(MIDICHANNEL);
  }
  MIDI.setHandleNoteOn(NoteOnMidi);
 
}
byte DipSwitch() {
  byte value = 0;
  if (digitalRead(DIP_SW4) == LOW)
    value += 1;
  if (digitalRead(DIP_SW3) == LOW)
    value += 2;
  if (digitalRead(DIP_SW2) == LOW)
    value += 4;
  if (digitalRead(DIP_SW1) == LOW)
    value += 8;
  return (value + 1);
}


void loop(){
  MIDI.read();          // Tells Arduino to start listening for
}                       // midi info on the serial port

Friday, August 4, 2017

Fixing a broken Electro Harmonix slide potentiometer

I recently acquired a 1981 Electro Harmonix Graphic Fuzz with two broken sliders.



The Overdrive and the Vol sliders had both been broken off. 

Here's what the broken overdrive pot looked like. 



Luckily smallbear electronics sell drop in replacements! 
The slide pots are:

Overdrive = 100k 
Dynamics = 100k
Sustain = 100k
EQ pot 125–2000 Hz = 100k 
4000 Hz = 10k
Vol = 10k 

So I needed 1 100k and 1 10k potentiometer.

Here's what a brand new CTS 100k linear potentiometer looks like: 


The only 10k CTS slider smallbear sells is reverse log and here's what that looks like:


I installed the 100k linear overdrive pot and it worked great. The 10k revLog for volume worked too, but since it was reverse logarithmic most of the change happened at the bottom of the slider. Not sure if the original is linear or logarithmic. But it was most definitely not reverse log.

Hoping they hadn't changed the insides of these CTS pots. I decided to just replace the lever part. 
You open it by carefully bending these 4 tabs:

The new one:

and the old one:

Here's what the inside of the old one looked like:


Then you move the lever from the new pot to the old one. Luckily it fit perfectly: 


Then you put the top part back on top of that.

And TADA! 

A repaired CTS slide pot! 

And here's what the pedal looks like now:


I replaced the old white slider tops with new ones from tayda for a uniform look.




Friday, February 3, 2017

808 Drum schematics.

Here are some schematics I've pulled out of the TR-808 schematics. I didn't do the bass drum, snare or hihat since ericarcher.net has already done a way better job than I could with that.
Inspired by him I've so far made veroboard versions of the bass drum, snare drum, the three toms and the cowbell. 
I'll post those layouts once I'm done with layouts for all the sounds. Not sure why I'm posting this, but, eh, why not. 
So, yeah, Here's something:


Handclap/Maracas:



The toms/congas use pink noise from the noise generator. 
The snare uses white noise created by the same circuit.

High tom/conga:



Low tom/conga:



Mid tom/conga:



Rim shot/Claves:


Cymbal:



Cowbell:


These last two also uses a schmitt trigger. Look up the original schematic and you'll figure it out.

But it looks like this: