edusynth, getting there!

Making progress! Because of the start of a new semester at my university, I tried to finish a first version of the edusynth. And, also to my own amazement, I did! Here’s a first 3d brd view of the eagle file:

edusynth_proto

Dual VCO, VCF and VCA. Dual ADSR and a number of OPS (CV, mix and split). Board are ready according to pcbway – I’m waiting for delivery… First try outs to follow. Also, the edusynth is full open source / open hardware thus schematics and code also underway.

edusynth, successor to senk

Not out yet and already succeeded… poor Senk ;)

Anyways, now presenting edusynth with an updated VCO design because the previous design had bad performance over 500hz. Also, hardsync is an option here and sounds absolutely great! Here’s the ltspice schematic: edusynth_vco1

and the amplifier and output section:edusynth_vco2

understandable and low part count. Nice.

Senk, a 5v µModular

Been busy building a 5v µModular system for students to learn about and experiment with sound. Design should follow the classic synth setup like for example a Minimoog, with added patchpoints. Part of the design is finished, as follows:

senk1and2

Input of [1] is an Arduino PWM wave. This wave is passively filtered to a DC voltage (ranging from 0v to 5v). This resulting voltage will be one way to drive the voltage controlled oscillator. [2] is necessary to shift the voltage to a more musically interesting range including lower frequencies (-2v to 3v). The range is not amplified to i.e. -5v to 5v because the Arduino PWM only has limited resolution (10 bit = 1024 values). The shifted voltage is inverted because of the sawtooth oscillator under [4].

senk3

[3] shows the voltage scaler (1v -> ~18mV) and the exponential converter as already discussed on sinneb.net.  The 1k tempco should be coupled to the CA3046 array.

senk4

and finally [4] shows the sawtooth core for the Senk. Previous designs of me had an inverting schmitt trigger followed by an inverting buffer in the waveform reset loop. This design features a non-inverting schmitt trigger, sidelining the inverting buffer and a number of resistors. Deploying of the BC550 resulted in the best waveforms, as shown by this youtube video:

Next features I’m working on:

senkworking

Oscillator pulse out, oscillator sub out and mixer section.

Screen Shot 2015-12-08 at 22.23.45

Mixed waveform looking cool in simulation :) Output needs AC coupling.

A temperature controlled CA3046

So, finally started work again on the heated CA3046. First, the results of the previous post regarding the CA3046 were reexaminated. Indeed, when building the schematic from that post: tempchip

and heating that circuit with a hair dryer:

the base voltage of the NPN transistor changes along with the temperature.

The next step I took was connecting that output to an opamp comparator to be able to switch a heating circuit on and off. Passing a certain voltage level, should turn off the heater. Tested with LED’s and, once again, the hair dryer:

Ah, nice! The heater section is inspired by one of the (great!) electronotes from the past (S-019). The LED section of the circuit was given an own comparator because the heater and the temp sensor are in so close balance, that the opamp doesn’t switch to negative.

And the result, the schematic:

Screen Shot 2015-10-29 at 12.29.47

Nice touch (I think) is that the circuit contains 2 LED’s: one is lit when the CA3046 is not at temperature and the other lights up when the CA3046 is at temperature (because of the comparator U1).

Next step: combine this heater with the actual exponential converter circuit.

Oh don’t forget to GND the substrate of the CA3046 (pin 13). Update: or should this be the most negative potential (-15V?). Better be sure before connecting that CA3046…

SSHing to a Raspberry Pi behind a firewall (Eduroam)

The firewall at my university (Eduroam) prevents direct connections between two computer on the network on all ports. SSH-ing to an other computer is therefor not possible. However, when a connection is ESTABLISHED, this connection can be reused – for example the other way around! Let’s work on this.

Requirements: rpi, external server

Automate your ssh login from your rpi to your external server using (this link). Execute these commands using “sudo” because the startup script we’re going to edit is run as root.

edit /etc/rc.local and add:

ssh -fN -l [username] -R 2210:localhost:2222 [external server ip]

The 2222 is the ssh port on my rpi. Your rpi could use 22 (default) or any other port. The 2210 is the loopback port (per this link). Upon reset, this line should be processed without errors. Then, on the external server, connect back to the rpi using:
ssh -l pi -p 2210 localhost

and your ssh session is available!

Raspberry pi as high quality LFO generator

I’ve been experimenting with external LFO generators to modulate my MS20 mini. Working towards a small and portable solution, I first built a larger format prototype using my laptop, a Presonus Firestudio and a fresh copy of pyo (a Python module written in C to help digital signal processing script creation).

Nice results! But I want a smaller, dedicated device to generate a variety of LFO waveforms, with enough range in the frequency (say from 0.001Hz to 5k Hz) to make the LFO interesting.

Enter Raspberry Pi.

I already did some experiments with the Pi and pyo, a great combination even on the “classic Pi”. With the generation of simple waveforms, the load from the pyo process never exceeds the 10%. No problems there. Problems did arise in the audio out selection. Like the audio out on my MacBook Pro, the audio out of the HDMI chip on the Pi is obviously lowfiltered, thus not outputting waveforms with a frequency lower than ~1Hz. Too bad I can’t use my HDMI to VGA and audio cable for this LFO then.

S-PC-0203_7

Next option is a cheapo USB audio adapter, called “3d sound” and based on the C-Media CM108 audio chip.ux_a06091200ux0003_ux_c Some first experiments conform this adapter to be adequate for the LFO job! Nice looking waveforms, going down to at least 0.01Hz (100 seconds). Too bad it has a DC offset of +2V. On decent audio hardware this is 0V. I tried a solution by Mick @ Leeds49 to no avail, the DC offset did not change. A small opamp circuit is needed anyway to generate a bipolar voltage – that circuit will thus also remove the DC offset. A differential amplifier circuit should do the trick.

LittleBits synced to Volca Beats’ pulse clock

Recently I was fiddling with a set of LittleBits and I was trying to sync these (the LitteBits micro sequencer that is), to my Volca Beats. With the current lineup of LittleBits, this was impossible. Since the Volca Beats has a sync out (0V, 5V pulses with 15ms duration), the solution was not all too difficult. I just took a LittleBits wire, cut it in two, reconnected the VCC and the GND but connected the SIG to the signal connector of an 3.5mm jack plug; this is shown in the schematic below.

littlebits_volca_schem

While this was working, I really wanted to have more control over the sync rate, e.g. double, quadruple, or half the BPM from the Volca Beats (or any other clocksource). Solutions using only IC’s or other non-microcontroller components seemed to difficult or complex (if any were found at all, can’t exactly remember). Time to develop some Arduino code than! Using pin 2 as the “sense” pin to detect the incoming pulses, the following code will lock on to that clockpulses, multiply the pulses by 4 or 8 and output the resulting multiplied pulses on pin 13 (easy to debug since the onboard LED will flash in sync with the outputted pulses).

// SINNEB.NET
// trigger in clock multiplier
// Arduino software to read a clock on pin 2 and multiply this clock times 4 or times 8
// output on pin 13

unsigned long delta_trigger_micros;
unsigned long prev_trigger_micros;
unsigned long triggers[7] = {0,0,0,0,0,0,0};

void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);

  // execute "rising" on RISING interrupt on pin 2
  // pin 2 is connected to the KORG VOLCA BEATS
  // which sends a 15ms, 5V pulse every half beat
  attachInterrupt(0, rising, RISING);
}

void loop() {
  // continuesly scan the trigger array, which is setup by the "rising()" function
  // all 4 of 8 triggers lie in the future
  // when the micros() clock passes a trigger, that trigger is fired (flipPin13)
  // and the trigger is set to 10seconds in the future, waiting to be updated by the "rising()" function
  for(int x = 0; x < 7; x++){
    if(triggers[x] < micros()) {
      flipPin13();
      triggers[x] = micros() + 10000000;
    }
  }
}

void flipPin13() {
  digitalWrite(13, digitalRead(13) ^ 1);
}

void rising() {
  digitalWrite(12, digitalRead(12) ^ 1);
  flipPin13();

  // sync the multiplied clock with the slow clock after a rapid tempo change
  if (digitalRead(12) == HIGH) {
    if (digitalRead(13) == LOW) {
      digitalWrite(13,HIGH);
    }
  }

  // calculate delta between consecutive triggers
  // this "delta_trigger_micros" is used to calculate and activate "in-between" triggers
  delta_trigger_micros = micros()-prev_trigger_micros;
  prev_trigger_micros = micros();

  // split the delta_trigger_micros in a number of subtriggers to
  // multiply the interrupt clock signal
  // every division, a trigger is placed in the trigger array
  for(int x = 0; x < 7; x++){
    triggers[x] = micros() + (((x+1.0)/8.0) * delta_trigger_micros);
  }

}

To divide the Arduino output into different clockspeeds, a CD4017 decade counter is deployed. The Arduino drives the clockpin, a button is connected to the clock enabled pin to “pause” the clock to influence the sync and the reset pin is connected to one of the divider outputs. Depending on the selection of the multiplication by the Arduino (4x or 8x) and the selected divider output, pin 3 of the CD4017 sends out the new clock.

Untitled

I uploaded 2 Youtube videos to demonstrate this!

The heated CA3046, part 1

A reliable VCO needs a steady exponential converter. Exponential converter are, because of their transistor based design (needed for the exponential functions), very temperature sensitive. A number of solutions to this problem exist. A solution that looks very interesting from a technical point of view is the solution found in (among others) the Moog Prodigy. The exponential converter only needs two transistors (the matched pair) from the five transistor available in the CA3046 chip. The Prodigy uses one of the left over transistor to heat the entire chip. An other transistor is deployed to measure temperature (the CA3046 transistors have a -2mV per centigrade temperature sensitivity). This measurement is compared by a comparator to stop or start the heating and keep the chip at a 55 degrees temperature.

First simulation: The temperature sensitivity of 1 of the transistors in the CA3046

tempchip

Result: The transistor shows a temperature sensitivity of around -2mV per centigrade (first 5 temp.steps shown):

tempresults

According to the simulation, the voltage at 20 degrees Celcius is 621mV and the voltage at 55 degrees Celcius is 553mV

LM13700 Triangle VCO

The LM13700 OTA chip has an interesting schematic for a triangle VCO in its datasheet. The discreet sawtooth VCO I’m building is too complex for breadboarding and does not deliver a decent sawtooth (probably due to distortion picked up somewhere in the breadboard). Therefor I decided to give the LM13700 triangle VCO a go. The schematic in the datasheet is very clear. All I did was exchange some resistor and capacitor values to ones that I have laying around. I also wanted to achieve a waveform at an audible frequency so I calculated values for a waveform around 500Hz.

LM13700trianglevco

The minus input on the second LM13700 has the triangle wave output. The Darlington output on the second LM13700 has the square wave output. The triangle looks like this:

trianglewaveoutput

and sounds like this:

Building an exponential converter

In this article I’ll describe the steps I took to design an exponential converter. YMMV of course, but I think this article is a good start and may provide some useful guidelines.

The following table shows the relation between Hertz and wavelength. These are the MIDI C notes per octave, in Hz with their corresponding wavelength in ms

8.1757989156 hz
122.312205856 ms

16.3515978313 hz
61.156102927 ms

32.7031956626
30.578051464

65.4063913251
15.289025732

130.8127826503
7.644512866

261.6255653006
3.822256433

523.2511306012
1.911128216

1046.5022612024
0.955564108

2093.0045224048
0.477782054

The required wavelength a capable VCO should be able to deliver thus lays between 122ms and 0.47ms. Experimenting with a slightly customised sawtooth generator (design below) shows the following relation between the (ideal) current source and the wavelength.

0.1ua -> 470ms
1ua -> 47ms
10ua -> 4.7ms
100ua -> 0.47ms (470us)
1000ua (1ma)-> 0.047ms

First, the slightly customised sawtooth VCO. The inverting Schmitt trigger in the sawtooth reset circuit guarantees a long enough reset pulse and thus a clean reset of the sawtooth waveform. The capacitor is too large, leading to a small distortion in the waveform. Will be fixed in updates.

sawtoothVCO600
sawtoothvco in PDF

The current source (exponential converter) must deliver a steady current between 0.1ua and 1000ua to the VCO to have to VCO achieve interesting musical abilities (enough octaves, very low frequencies, MIDI controllable). The deployment of an exponential converter in this current source is almost inevitable. Linear control, preferable digital through DAC’s or such, of a current source with such a bandwidth (0.1ua -> 1000ua) is very difficult.

The circuit of the exponential converter:

expcurrentsource

The formula for the exponential part of the converter is iout = iref * exp(-Vb/Vt) where vt = 26mV.

iref runs over R1 => iref = Vref / Rref = 15V / 1000000ohm = 0.000015A = 15uA. To achieve an output current of 0.1ua (the VCO will generate a 470ms waveform) => 0.1 = 15 * exp(-Vb/26) => Vb = 130mV. Some calculations of Vb in the required bandwidth of 0.1ua and 1000ua:

wavelength: current -> required voltage
470: 0.1ua -> 130mV
235: 0.2ua -> 111mV
118: 0.4ua -> 94mV
59: 0.8ua -> 76mV
30: 1.6ua -> 58mV 
15: 3.2ua -> 40mV
8: 5.9ua -> 24mV
4: 11.75ua -> 6mV
2: 24ua -> -12mV
1: 47ua -> -30mV
0.5: 94ua -> -48mV
0.25: 188ua -> -66mV

This leads to a relation between linear voltage and exponential current! Required to translate a difference of 1 volt to a musical difference of 1 octave (which is a exponential scale).

The voltage into the exponential converter will thus have a 1V/octave scaling and start at 0 volts (130mV) up to 12 volts (-66mV). The base voltage will be 130mV. The voltage scaling opamp will have to scale the incoming voltage (0-12V) to a -18mV per Volt. This voltage is buffered by an opamp follower and a voltage summer then combines the base voltage and the voltage scaler voltage (note to self: make the 1k in the summer smaller for a more precise summer).

voltagescaler

The exponential converter takes this voltage (in V4) and transforms it into a current source following calculations above. Temperature drifting and transistor matching have not been explored in full. For now the CA3046 is deployed. Temperature compensation is probably achievable by driving the other transistors in the CA3046 to a certain temp (like in the Moog Prodigy).