søndag 18. november 2018

PG-200 busy line

When building the MPG-200 for the JX-3P, I discovered that the busy line is hardwired via a pullup resistor to +5V, in effect tying it to logic high.

Because of this, I decided to ignore it altogether. But when trying to get the MPG-200 to work with the MKS-30, I discovered that this synth actually DO control the line.

So what actually happens when the busy line is pulled low?

As expected, the PG-200 does not transmit anything while the line is low. Still, I was curious what happened afterwards, when the line was released again - did the PG-200 just ignore whatever had happened during busy, did it queue up events or did it send the new stable status?

Well, a bit of both really. It keeps the last state from before it was blocked. Then, once busy is cleared, it sends first the state it had before blocking, and then the state after blocking. This happens for both switches and potentiometers.

lørdag 17. november 2018

Fooled by running status. Again and again.

The midi protocol is not very complex. But one thing keeps making me trip: Running statuses. You can send a status byte, and as long as you don't send a new status byte you may keep sending data bytes for the same status. This is very convenient when sending for example filter sweeps etc.

In my work on the MPG-200 this has made me trip several times. Because:

The source for my midi data has mostly been my Moog Little Phatty. It sends running statuses of course. But when I reboot my mpg-200 without restarting the LP or playing a note, the LP don't send the status message again, and the MPG-200, having just booted, has no way of knowing what it is receiving as it has not seen any status message. It has fooled me more than once.

Today it happened again, but in a more subtle way. I have spent the last week trying to figure out a very strange bug I noticed after a large refactoring of the MPG-200 code: After changing the CC for the filter cutoff using sysex, things worked fine when sending the correct CC from my sysex/web midi based pg-200. But after rebooting nothing worked. Sending a sysex clear memory somehow reset things and the CC started working again.

I stripped down the program to the minimum and it still happened. I discovered though, that sending a midi note on had the same effect. Today I had time to think more thoroughly about it and came to the conclusion that it could not be the part of the program that treats the received bytes, it had to happen on reception. So I hooked up my logic probe to the midi rx line and watched what came into the MPG-200.

Guess what - after a restart, the web gui, knowing nothing about the restart, did not resend the status message. That explained almost everything, I had tripped in the running status issue again. But a little more research uncovered a few other interesting things:

Sending a midi note on from the LP actually reset the running status, so the status message was sent again. This surprised me, how does the web gui know that the LP has sent a midi on? I also tried to refresh the web gui to 'restart' the midi interface, but this did NOT work, it still did not send a new status message.

Then it dawned on me. I am using the LP as my midi interface. It is the LP that holds the state, NOT the web midi adapter! So even if the web midi did restart, the LP knew it was currently sending a particular CC, and so did not resent the status - and of course sending a note on merged into the same data stream and made the LP resent the CC status later.

Oh well, I am just glad I figured this out, even though it's a bit embarrassing.

torsdag 9. august 2018

Checking the Xonik Linear VCA performance

Way back in october 2017 I did some research on the BA662 clone. To my surprise I got massive distortion when trying to get unity gain out of it. This made me fear that my Xonik Linear VCA had the same issues.

Yesterday I simulated the circuit:

At 5V CV and 5kHz sine input, I got unity gain with no visible distortion. I then doubled the frequency:

I still didn't get the kind of distortion I expected, but I got SOME distortion (see the blue graph).

Now, this isn't good. I tried both with and without the output filter cap, no change there.

I am however using LT1001 opamps in place of the TL072.

Today I breadboarded the circuit, first without the output cap. The results were very promising. I could see no visible distortion, not even at 20kHz:

Changing to a triangle wave at 40kHz showed a slight distortion at the top of the curve:

Changing again to a square wave showed severe ringing on the output:

I then added a 33pF cap:

It worked wonders for the other waveforms as well:

I then experimented with a lot of other cap values, here are some:



18pF and 10pF in parallel

22pF and 22pF in parallel

It seems that 33pF is still the best match (or 18pF + 10pF if one wants a tiny ring instead of a rounded edge). It has to be said though, that this is not a very scientific method, and it has a huge error factor in that the breadboard itself may contribute massively, making the capacitance higher than expected. 

Just to make sure that I wouldn't get a significantly better result with a lower CV and higher compensating gain, I replaced the CV resistor with 6k8 and the output gain resistor with 22k (I did however not replace the cap. The filter frequency is 1/2*PI*R*C (presumably), so in doubling the R I also halved the output frequency, leading to more rounded corners:

I only realized this right now while writing this post. Still I think the results are quite good, the selected values seem ok though I have to test with both a 33pF and a 47pF cap (specified in the circuit) on the final board to see which one is best.

Anyway, my conclusion is that the Xonik Linear VCA is still a good choice.

fredag 3. august 2018

Bootloader working!

I finally got the midi based bootloader for the mpg200 up and running. I have yet to test it with the mpg200 code but a short test program uploads fine. So happy right now :)

torsdag 2. august 2018

Summer 2018 - DAC Mux, Ring mod

Summer is always kind of productive for me. While off on summer holiday to the western parts of Norway, I get time to do some electronics work. This time I've drawn up and ordered a 16 channel sample and hold circuit (DAC mux) to replace the 32 channel one used in the prototype. This one is easier to place and makes it possible to use only 16 channels for parts of the synth.

I also did a v3 of the linear VCA. This time, as for the first version, the trimmers are off-board, but the components are placed on both sides as in v2. The whole card is sort of a double width DIL thingy with the pins for one VCA on one side and the other on the other side. I imagine it possible to place it in a socket and have other parts of the circuit below it - we'll see.

Finally, I did a ring modulator based on the one from yusynth.net, which in turn is almost entirely a copy of the one in the datasheet. This one uses a surface mount MC1496. The circuit and board are finished (but untested), including logo.

Oh, and I have written a midi/sysex-based bootloader - it's almost finished. I will feel much better if I can remotely update any MPG-200 I sell. The bootloader is very simplistic and does not have any flow control, so sysex uploading must be done through a program made by me. Still better than not being able to update at all.

onsdag 27. desember 2017

YAC, a DAC (floating point)

I started looking for Yamaha OPL2 (YM3812) and OPL3 (YMF262) chips on ebay yesterday, as I thought it would be nice to get some for future use. These vintage FM chips were everywhere in the late 80's and early 90's, particularly on Adlib and SoundBlaster sound cards.

I soon realised that one needs an additional chip - a DAC - as the chips are completely digital.

The DACs used are YM3014B for the OPL2 and YAC512 for the OPL3. Both are serial input DACs with what they call 16bit dynamic range. But they are not 16bit integer DACs. So what are they?

They are in fact floating point DACs, with one "normal" integer DAC (10bit), called the mantissa, and an exponential multiplier, the exponent, that sets the reference voltage. This is just like a floating point number which has a significand (the mantissa) and a base raised to the power of an exponent.

As the exponent changes, the width of each step of the 10bit DAC changes. This means that at the resolution is higher at the lower end of the scale, and it decreases (the step width increases) as one moves upwards.

The circuitry is presumably along the lines of this (though this patent is from 1990 and the YM3014B is much older than that), though the Yamaha datasheets call the exponential part an analog shifter:
Floating point DAC patent
The YAC512 supports two time multiplexed outputs from a single DAC through external sample and hold capacitors. The YM3014B is single channel and requires no sample and hold.

I wonder if it would be a good idea to use such a DAC for my DCO - it seems to be available for less than $1 a piece on ebay, though I'm not sure if those are fakes or not. The exponential nature of the DAC should fit an exponential scale well.

søndag 5. november 2017

JP6 vs Juno 106 filters - Hz per mA

I've simulated both the Juno 106 filter (with 270pF caps) and the JP6 filter in 24dB LP mode, to figure out their response - what voltage (or rather current) to frequency rate to expect.

Quite interestingly, the two implementations track each other fairly well. Both have around a 30Hz per mA or 30uA per Hz response.

Also very interesting to note is that the response is not linear. The higher the frequency, the more current is needed for the same change in Hertz.

I measured the 3dB point at 16 selected currents:

The CV is the input to a constant current circuit. It is the voltage across a 3k3 resistor, and the resulting current (buffered to stay constant) is split between the four cells of the filters.

I selected 8 tightly spaced voltages and 8 further apart, as the lower end requires less change to double the frequency. Deltas are the difference between two measurements. F_c is the 3dB cutoff frequency point. This is a linear CV, e.g. without the exponential converter connected.

The result ended up like this:

Note that the y axis is truncated to get a better view of the effect. One would expect a linear response, but in fact, as mentioned, the Hz pr mA drops as the frequency increases. The Juno follows a sharper curve and even if it starts out higher than the JP, it drops below it at some point. In other words, the Juno linearity is worse than that of the JP.

So what does this mean? It means that the V/oct tracking of the filter is not perfect. It will be slightly more closed as one moves up the scale on the keyboard. I have read about this effect earlier, and the writer noted that it didn't seem to matter all that much. I guess a little difference is hard to hear when the base frequency changes a lot.

onsdag 25. oktober 2017

Jupiter 6 filter clone - initial simulation

After the success with simulating the juno filter, I tried the same with the Jupiter 6 multimode filter today. I struggled a lot before I got things up and running - among other things I forgot to connect the power to the resonance OTA of the first cell, and I never got the resonance control from the Jupiter 6 schematic to work so I swapped it for the one from the Juno.

After that however, things turned out VERY nice! What's interesting is that the circuit is exactly the one from the datasheet, with the same component values (replacing the OTAs with LM13700 without the output transistors, and using separate opamp buffers) - and the frequency response tracks the one from the juno clone very well. I got a slightly better tracking by switching from 330pF caps to 323pF, but 330pF will work just fine.

Here are a few plots before I go into details about some discoveries. The output VCA has been tweaked to give us a 0dB output for pass frequencies of the 24dB low pass filter>

This first one shows the frequency response of four of the five possible variations of the two cells. Here the LP output of the first stage is connected to the second stage:

  • Red is LP (12dB) + LP (12dB), or a 24dB LP
  • Green is 12dB LP tapped after the first stage
  • Blue is 12dB HP tapped after the first stage
  • Turquoise is 12dB LP + 12dB HP, or a 12dB BP

In the second one I've connected the HP output from the first stage to the second stage

  • Red is 12dB HP + 12dB LP, or a 12dB BP, similar to the option from plot 1
  • Green is 12dB LP tapped after the first stage
  • Blue is 12dB HP tapped after the first stage
  • Turquoise is 12dB HP + 12dHP, or a 24dB HP

The -3dB cutoff (for the 24dB LP filter) is at 727Hz (measured)

As for the discoveries: For a long time I could not get rid of the resonance. I even tried changing the feedback resistors that tap the stages and send them to the resonance OTAs, but it just didn't want to go away. But then I realised that I had forgotten to connect power to one of the resonance OTAs.

So what did I learn from this? Well, without the resonance OTA, the circuit actually self-oscillates. By adding parts of the signal tapped after the first 6dB cell, we cancel out the feedback that leads to oscillation (or at least that's what I think happens).

This leads to another realization - the control signal for the resonance is reversed. In the Juno, 0V of resonance CV turns off resonance and it increases the closer to 10V we get (also, I think the transistor in the Juno resonance CV circuit acts as an exponential converter, but I have not checked this). In the Jupiter 6 filter, when using the same resonance control circuit, 0V gives a huge (80dB) spike!

Maximum resonance

At 10V resonance is fully turned off. I have yet to confirm that 10V is indeed the correct max voltage for turning off resonance, but with this setting the plot looks exactly like it does for the juno with resonance CV=0V

Oh, and as a closing note - turning up the resonance does NOT attenuate pass frequencies. In the Juno, frequencies below the peak are attenuated up to 8-10dB - but more of that in a separate post comparing the two filters. I'll also post the circuit and work out the necessary control circuitry to get 1V/octave responses for the cutoff, but that's for later.

Update: I just came across a Jupiter 6 filter clone, I belive it is by the guy that writes at polysynth.blogspot.com. It says that the clone is open source, but for my own sake and the fun of working things out by myself, I'll try as hard as I can to not look at his clone before I finish mine :-D

tirsdag 24. oktober 2017

BA662 clone

While studying the Juno 106 filter I came across Analogue Renaissance's BA662 clone. It is dirt simple, but when I tried simulating it, I got massive distortion on the output compared to my Xonik linear VCA (based on the research by bergfotron etc, see separate post on the VCA)

When running a 2V p-p signal through it, using a 0.110mA (15V/136k) control current I got an output signal with the same amplitude, but the sine wave had been visibly distorted. Suspecting that this was only a simulation problem, I tried breadboarding the circuit. The distortion was even more visible on the oscilloscope.

2V p-p input (green), distorted output (blue)

I quickly realised that the amplification was not linear close to the maximum signal amplitude, much like a compressor/limiter circuit. Reducing the input to 1V p-p showed that the gain was in fact not 1 but more like 1.5.

Adjusted input, 1V p-p
After readjusting the control current to get unity gain again, I could still see some distortion:

Adjusted amplitude. Output wave is still distorted, though not as much as earlier

After reducing the input further, to 0.5V p-p, and readjusting the control current again, I got this, which seems much better. The control current is now 61.9uA

Then I took a closer look at a document I printed a few years back, that shows what voltages and currents to expect in the Juno:

An annotated Juno 106 service manual showing the various voltages. I can't quite remember where I got it, but I THINK Analogue renaissance made it?

To see how the BA662 is actually used in the circuit, I added the resistors between VCF out and VCA in (though not the VCA offset pot) and set the pot to 25k. Without changing the control current I got this:

Clone as used in the Juno 106 - with the 50k pot centered. Ampitude is MUCH lower.

Notice the significantly lower amplitude. I then adjusted the control current to the maximum according to the document above and got this:

Same configuration but with the control current at 0.3mA, which according to the picture above is the maximum. Notice that the amplitude is alost a quarter of the input. Even if we increase the control current, we are unable to reach unity gain.
So, there is no way to get unity gain out of this. I guess it is compensated elsewhere in the circuit. What troubles me is that with that much attenuation, wouldn't the VCA be unnecessarily noisy?

I will have to recheck the Xonik Linear VCA to see it it suffers from the same distortion problems. From my notes I see that I run it using a control current up to 1.5mA.

Juno filter analysis

I intend to use the Jupiter 6 multi mode filter for the XM8. As this is based on the IR3109, just like the Juno 6/60/106, which is better documented, I took a closer look at that filter first.

Analogue renaissance delivers a great clone of the 106 filter. I am not trying to build a drop-in replacement for anything, so exact component values to match the Juno's are not important, but the idea of using LM13700 in place of the IR3109's OTAs seem to be the go-to solution these days.

In fact, for the filter part (ignoring the resonance and output VCA), part values are mostly the same between the clone and the original Juno 6/60 circuit - 560R and 68k resistors all the way. The caps are 270p in the clone and 240 in the Juno 6/60. I have done a thorough comparison between the various IR3109 filter circuits made by Roland, most of them use 560/68k resistors. The caps have changed from 240p in earlier designs to 330p in later. It probably only affects the exact cutoff-to-CV; I'll test this before I decide on the cap value to use.

I wondered what the linear CV response of the filter would be, so I simulated the circuit in LT-spice. NB: This is the first time I do anything like this, so my findings may not be correct. However, it seems that the current is the case:

For every 2.5kHz increase, the OTA control current increases by 75uA. This means that the LINEAR control current to frequency ratio is (100 * 10^6) / 3 Hz per A. It does not seem perfectly linear however, it drops off somewhat as we go up the scale (an increase from 75 to 150uA increases the frequency by 2,54kHz while an increase from 300 to 375uA increases the frequency by 2.31kHz.

Of course, to properly control the filter, an exponential converter or a DAC output with a high enough resolution is needed. A cutoff of 10Hz requires 0.3uA while 10kHz requires 300uA, a factor of 1000.

Similarly to the DCO frequency calculations, the feasibility of this has to be tested properly, and we may get issues with opamp inaccuracies at the lower end of the scale, though they may not be as severe as with the DCO because the error is not accumulated over time.

PS: The Juno 106 has non-polar caps in line with the signal both before and after the filter. These act as a highpass filter with cutoff around 10Hz.

Filter response with cutoff around 2.5kHz, with HPF included

Update: Replacing the 270p caps with 330p caps changes the control current-to-cutoff frequency from 2.5kHz/75uA to 2.1kHz/75uA, with the same slight dropoff as the frequency increases.

søndag 15. oktober 2017

Noise filter responses

I just downloaded LTspice IV in order to simulate filter responses for the state variable filter for the XM8. To learn, I started out by simulating the various noise filters from the Andromeda A6.

Here are some nice plots to look at (continuous line is frequency response, dashed is phase response):

The A6 noise circuit. I've used LT1001 opamps, just because they where the first in the list.
White noise filter - an HPF. Measured Fc seems to be around 5.3Hz; each of the two filters have an Fc of 3.43Hz. Gain is around 36dB (?)  (multiplier: 72)

Pink noise filter, a 3dB low pass filter approximation, fairly linear from 10Hz to 20kHz. Gain is around 26dB (multiplier around 19.6 measured, as opposed to 21 calculated from the normal non-inverting amplifier formula, due to the 68k resistor)

White and pink noise filters combined

Red noise filter, 12dB low pass with Fc at 107.6Hz. Gain is approx 10dB (multiplier: 3.16)

White, pink and red noise filters combined

Now, after simulating the A6, of course I had to do the same to my pro-one/elliot white/pink noise combination. It turned out like this:
Pro one modificaton white noise. This is an HPF, similar to the one from the A6. The gain is very different though, about 55dB for this one. 

The Elliot 3dB pink noise filter. Not very different from the A6, but with a very different phase change.

White and pink noise filters combined. Fairly similar to the A6.
Now for the interesting part - how do the two circuits compare? Well, first of all, the overall gain of the A6 is significantly less than the pro one/Elliot version. Here is a combined plot:

A6 (green) vs pro one/Elliot (blue).
I did however do a calculation of all expected gains and updated the A6 circuit with a 20k resistor in place of the first 2.43k one in the white noise circuit. It sounded very similar to the pro one/Elliot after that, but what do the plot look like?

A6 after replacing a resistor (green) vs pro one/elliot (blue)
I'd say they are very similar! One thing to notice though, is the difference at the deep end. The pro one/elliot removes much more of the really deep frequencies. This is below what your ear should be able to hear though.

Xonik Waveshaper v1.0

The wave shaper board and Noise board was sent off to DirtyPCBs for production last week. They both turned out rather nice - the waveshaper board measures 28 x 64 mm and the noise around 24 x 25 mm.

Interestingly enough, the sub oscillator circuit takes up more than half of the waveshaper due to the many options (-1/-2 octaves, saw or square wave).

I’ve tested the circuit with the DCO and got some very nice results. There are still some spikes on the sub saw waves, but while adding filter caps did reduce the spike amplitudes, it also widened their base. I’ve chosen to leave the spikes as is but have left room for the filter caps should I redecide.

The noise board requires four external trimmers - one to center the saw wave, one to trim the triangle and sine waves and two to match the saw wave parts in the sub oscillator.

The noise circuit requires an external noisy 2n3904 or, as in the Andromeda A6, 1N5237B/8.2V zener diode. It has the option of adding a trimmer to control the noise amplitude, but also has room to just use an on-board resistor if exact amplitude is not of essence.

The A6 uses an opamp to offset the noise outputs due to its internal offset center (PMID), which also acts as a filter. This is not included in my circuit.

Waveshaper board. All mixing and amplitude control must be done externaly which makes it possible to use this card both with computer control and directly with mechanical switches or potentiometers if one wants to make a mono synth without patch storage.

Here are some photos of the output when the XDCO is connected istead of a function generator:

Sub oscillator saw, one octave down

Sub oscillator saw, two octaves down

Inverse saw


Sub oscillator square, one octave down

Sub oscillator square, two octaves down

Pulse wave
The results look very good, but I have yet to run it with a amplitude calibrated DCO, so right now wave shaping is not perfect for all frequencies, only the one the waveshaper is manually calibrated for.