Glitching Wasp keyboard fix

edp wasp inside

Bastard thing. It mostly works now, except when it doesn’t.

Ages ago, after moving house, I got my Wasp out to have a go at MIDI-fying it, and found that it would glitch when holding a note, as if it was flickering quickly between the held note and one much lower down.

Since then the Jasper clone was announced and released, I’ve got mine up and running in the last week, and that seems to work ok (although the VCA envelope sustain gets louder as a key is held down, which isn’t quite right). But the keyboard triggers absolutely perfectly, so it gives me a chance to compare it to my old Wasp.

Jasper (Wasp clone) all done bar the shouting

I noticed irregular pulses on the 4013 at IC44 on both Q and Qbar (labelled NOTE_READ and VCA_ENV_TRIG on the helpfully labelled Jasper schematic). I didn’t trust the Q-to-reset link, so I recreated that on a breadboard and linked to it, still the same. Checked the connections, my soldering might have been wonky – all OK. I replaced the CD4013 with a HCF, supposedly has Schmitt trigger inputs, so could be more forgiving of noisy inputs. Nope.

After much fretting all I had left was to strap a ceramic 0.1uF capaacitor across ground and +5V on IC44, and… it was much less glitchy. I added a couple more (fairly randomly) in the keyboard circuit, and then the glitches stopped.

And only then did I have a look at the 5V line on one of the non-decoupled ICs:

EDP Wasp - noise on the 5V rail

…which doesn’t look like it would much help. The Wasp uses a couple of NE555 timers at heart of the oscillators, and they have a tendency to smash the power rail. Only as far as I could tell the glitch wasn’t at its loudest next to the 555s, so I suspected something else.

Now I’ve put it all back together, I realise that 3.36µs works out to about 297KHz, which is in the same ballpark as the frequency of the master oscillator, which is supposed to run at 250KHz. Next time I open it up I’d be tempted to put a capacitor across 5V and ground on IC11 and see if that quietens it down.

Anyway with the glitch gone, I dared to start celebrating, and then found a different, intermittent problem – G and G# would play the notes B and C. Pressing the keyboard slightly harder seemed to bring the problem on, so it seem likely it was a dodgy solder joint, and I tracked it down to a dodgy connection between IC31 and IC30 – reflowing the joint on IC31 fixed it.

Very occasionally still F# will play a slightly inbetween lower note, but I’ve spent way too long staring at this as it is – I’m calling it done for now.

As a postscript, if you have a knackered or badly behaving Wasp, I had a look around for some help on fixing the keyboard and there was some interesting stuff in this post and comments on the Clacktronics post on the Wasp, but that’s about it. Now there’s a new generation of Wasps springing up in the form of the Jasper clone, the Muffwiggler DIY section might throw up some new help.

No Comments

midiwasp, kind of

Had a question from another Wasp owner about MIDI-ing up a Wasp so I chucked this thing together:

which seems like it works alright, but now I’m not so sure, due to my Wasp’s keyboard playing up fairly badly after being left alone for a few months. It seems like there’s a clocking problem somewhere in the keyboard note detection circuitry which causes it to semi-randomly flit between the note you pressed and a much lower one at a high speed… in some ways it’s quite an interesting effect, but not all the time.

To add to that, the timing from the x0xb0x via the Arduino seemed to get messed up as well, so I’m not convinced that this code is worth much but here goes anyway. Feel free to change it, smash it up, call it names.

/*

  __  __ ___ ___ _____      ___   ___ ___ 
 |  \/  |_ _|   \_ _\ \    / /_\ / __| _ \
 | |\/| || || |) | | \ \/\/ / _ \\__ \  _/
 |_|  |_|___|___/___| \_/\_/_/ \_\___/_|  
                                          

  - super simple 5 pin DIN MIDI to Wasp LINK converter
  - uses PORTB (digital pins 8 to 13) for the note output
    and pin 7 for the gate trigger
  - tested on an Arduino Duemilanove, 
  - should work on other 5V Arduinos - though the PORT
    number may change

  http://ua726.co.uk/2016/02/08/midiwasp

  Libraries
  ===================
  
  You will need the...
  
  - FlexiTimer2 - http://playground.arduino.cc/Main/FlexiTimer2
  - MIDI library - http://arduinomidilib.fortyseveneffects.com/index.html

*/

// **************************************
// Set these up how you want them....

// MIDI base note is the lowest MIDI note that the Wasp will respond to
// 36 = C2
#define MIDI_BASE_NOTE 36

// MIDI input channel is the channel you want the Wasp to respond on
#define MIDI_INPUT_CHANNEL 1

//***************************************

#include <MIDI.h>
#include <FlexiTimer2.h>

#define TRIG_OUT 7 
#define WASP_MAX_NOTE 35

volatile boolean noteIsOn = false;
volatile boolean triggerOutState = false;

int8_t codeLookup [] = { 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 
                      33, 32, 27, 26, 25, 24, 23, 22, 21, 20, 
                      19, 18, 17, 16, 11, 10, 9,  8,  7,  6, 
                      5, 4, 3, 2, 1, 0 };

MIDI_CREATE_DEFAULT_INSTANCE();

// -----------------------------------------------------------------------------

void handleNoteOn(byte channel, byte pitch, byte velocity)
{
  if(pitch >= MIDI_BASE_NOTE && pitch <= MIDI_BASE_NOTE + WASP_MAX_NOTE) {
    digitalWrite(TRIG_OUT, LOW);
    PORTB = codeLookup[pitch - MIDI_BASE_NOTE];
    digitalWrite(TRIG_OUT, HIGH);
    triggerOutState = HIGH;
    noteIsOn = true; 
  } 
}

void handleNoteOff(byte channel, byte pitch, byte velocity)
{
  doNoteOff();
}

// avoiding hanging notes with sequencers like the x0xb0x
void handleStop()
{
  doNoteOff();
}

void doNoteOff() 
{
  triggerOutState = LOW;
  noteIsOn = false; 
}

// 48hz - period of 20.833333333 ms
// need to use 10ms (as one-half of period)
void gateFlipTimerSetup() 
{
  FlexiTimer2::set(10, 1.0/1000, gateFlip);
  FlexiTimer2::start();
}

void gateFlip() 
{
  if(noteIsOn == true) {
    triggerOutState = !triggerOutState;
    digitalWrite(TRIG_OUT, triggerOutState);
  }
}

void setup()
{
    // set PORT B to output mode
    DDRB = B11111111; 
    PORTB = B00000000;
  
    // set up trigger out 
    pinMode(TRIG_OUT, OUTPUT);
  
    gateFlipTimerSetup();
  
    MIDI.setHandleNoteOn(handleNoteOn);
    MIDI.setHandleNoteOff(handleNoteOff);
    MIDI.setHandleStop(handleStop);
    MIDI.begin(MIDI_INPUT_CHANNEL); 
}

void loop()
{
    MIDI.read();   
}

I used a CNY13-4 as the optocoupler to connect MIDI to the Arduino this post just because that’s what I had to hand – for my final version I’d heed Olivier’s warning and use a 6N137. This is the relevant part from the MI Shruthi schematic:

Example MIDI to Arduino from MI Shruthi


The Wasp works off 5 volts so I’d recommend a 5v Arduino. It might work with a 3.3v Teensy 3.x, but you’d probably need a bunch of level shifting from 3.3v to 5v to get it work reliably. Also, out of laziness I’m using a PORTB command to write out to more than one pin at the same time, so you’d need to change this if you decided to use something other than an a Atmega 168/328-type Arduino.

For the connection from the Arduino to the Wasp you’ll need a 8 pin DIN plug. The connector that you’ll need to make, looking from the back from left to right, goes like this:

1 – trigger
2 – a (least significant bit)
3 – b
4 – c
5 – d
6 – e
7 – f (most significant bit)

…and don’t forget the ground at the bottom, that needs to connect to ground on your Arduino. The trigger pin will connect to pin 7 on the Arduino, with pins 2 – 7 being connected to Arduino digital inputs 8 – 13 respectively.

Looking at the Spider schematic, the note outputs should all be connected through 10K resistors, with the trigger connected through 47K. In my quick test I’ve gone direct, mostly because the keyboard is playing up and affecting the input.

The code started out being the most simple thing that would work, before I realised that I wanted to to do highest note priority, as with the original keyboard. Then I wanted it to do last note priority, so it got more complicated.

You will need to stop MIDI input when uploading the program to the Arduino because it uses the TX and RX pins as part of that process.

You could make it fancier, or try variations on the theme. It’d be good to do a USB MIDI > Wasp version for example – that should be easier with an Arduino Uno or Teensy. Or if you’ve modded your Wasp (or Jasper…) for filter CV input you could add a simple DAC to control the VCF from velocity or other MIDI controller.

I guess you could do a CV/gate > Wasp version as well if you were really keen to sequence it from your MC-4 or whatever. It’s just a matter of sampling the CV voltage when interrupted by a gate, and then quantising that to a note number.

It remembers the notes you’ve held down (up to a maximum of 8) so you could step through them on a clock (MIDI or analogue clock input) to make a simple arpeggiator.

Also also… if that Disklavier in the corner of the room just seems a bit unsatisfying, why not alter the code to make it into a MIDI output and control that grand piano from the Wasp’s capacitive touch keyboard? Endless fun, and so on.

9 Comments

DIY Spider sequencer

While I’m still working on other non-synth things… after I got the Wasp running last year I started to fiddle with making a Spider-ish sequencer out of a Teensy 2++ board, and this is as far as I got at the time.

Compared with the original track the oscillators should be an octave apart, but I never got the chance to re-record it before we moved house and the DIY Spider fell to the bottom of a box, somewhere in our loft. You get the idea, anyway.

The 7-pin DIN sockets on the top of the Wasp aren’t MIDI, but more like a weird digital CV/gate. .

The pitch is set in binary, with four pins determining the note within the octave, and the fifth and six pins defining the octave. There’s a table in the service manual which helps to work out the encoding. A 2 bit number has three states so you can get an extra octave from playing it externally.

The seventh pin is the “trig”, but it’s not just a simple on = note on, off = note off, rather it’s a square wave running at about 48Hz.

Everything works at 5v, which made it simpler to use the Teensy 2++ rather than the spare 3.3v Teensy 3.0 I had kicking around, and the extra I/O came in handy.

Compared to the original I added an LED display for showing the current step, and I made the transpose buttons latching. I almost got the real-time record working (with a silly piezo sounder for the metronome), but that always seems a bit pointless on these sorts of sequencers. Or maybe I’m just shit at playing in time.

I hadn’t got round to adding a clock input – from reading the Spider user manual, it’s not immediately clear how this might work in real-time playback mode – probably not very well. Or just very slowly.

The pin out of the Wasp DIN socket goes something like this

1 – f (MSB) – orange
2 – e – yellow
3 – d – green
4 – c – blue
5 – b – purple
6 – a (LSB) – grey
7 – trigger – white

… as if you are looking at the back of the socket (with the soldering) with the ground at the bottom, from left to right. Here’s a photo:

Wasp DIN socket

The sequencer is alright but to be honest it’s more fun to play from the keyboard… never thought I’d ever say that about any synth. I must be ill or something.

No Comments