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:
Saw

Sub oscillator saw, one octave down

Sub oscillator saw, two octaves down

Inverse saw


Triangle
Sine
Square

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.

søndag 1. oktober 2017

Xonik DCO v1.0

The XDCO board arrived friday, and yesterday I soldered one to test it. I cannot find my 2N3904 SMD transistors for some reason, I was supposed to have received 100 of them in my last Farnell shipment but they were nowhere to be found. Instead, I had to modify a regular 2N3904 to fit the SMD footprint. It works fine but looks rather strange - and is of course not very durable. But for testing, it works just fine.

This wouldn't be a real Xonik project if the first version worked flawlessly however. After some initial problems programming the chip (I connected ISCP data and clock to SPI data and clock....), I discovered that I've used ISCP data as DCO CS, and NOT exposed it as a separate pin! That means that it is not possible to program the chip in circuit. I had to add a thin wire to expose pin 13 on the MCU. After doing this, everything worked as planned and I now have a working DCO.

The ISCP bug may be handled two ways:
- fix the bug and re-order the boards
- develop a boot loader and program the chips before soldering them into the circuit, then use SPI for programming later.

I've wanted to do a boot loader for a long time, so maybe this is the motivation I need - we'll see. The price of the board is not a big issue, they cost less than $20.

As for the crystals and speed - On the breadboard the crystals didn't start properly, resulting in fallback to the internal oscillator. I bought new crystals and did some proper calculation on what caps to use (the crystals require 18pF, using two 27pF in series should result in the correct value, see separate post) and now the crystals oscillate at the desired 32MHz right from the start.

Time to test the DCO with the waveshaper!

Update:
While the frequency is ok, the amplitude is off. The output maxes out at around 8.6V. If removing the cap, we get a flat 8.6V meaning something sinks the rest (?).  I tried removing the transistor collector, the opamp saturated to 15V so it is absolutely capable of delivering the necessary voltage. I also tried disabling resetting of the cap and even then the max was the same. The output stays at 8.6V even while programming the circuit. Someting is definitely wrong around the transistor.

BTW: I tried 5 different transistor and three variants of opamps on the breadboard and it still worked fine.

Update 2:
The amplitude issue was just a miswiring of the external transistor, I had mixed up collector and emitter. After changing this, calibration works again. There are some issues with timing and mcu crashes though, maybe related to unfiltered psu lines?

I've also tested and eliminated the 330k resistor from base to ground. it is necessary in the Juno 6 to keep the base voltage between 1.5 and -12.5 (from a 0 to 5v input) to control a PNP transistor. I am using an NPN which is on when the base is > 0.7V and off when the base is at GND, so it can be controlled directly without any biasing resistor. I've also checked the 68k value, it keeps the I_base high enough to allow I_c to be fully sunk while still being low enough to not damage the transistor.

mandag 25. september 2017

Xonik Waveshaper - breadboarded version

I finished breadboarding the waveshaper last night. Here is the schematics (not bug checked though) and a few photos of the output waveforms from the sub oscillator. The saw wave looks like crap but that is because I used a function generator without saw output as the source of the original wave (using a triangle wave with a very unbalanced center in place of the saw). It will look a great deal better with a real saw wave input.

Full waveshaper circuit. Note that the sub saw output has the same polarity as the input. It is also possible to get an inverted output.
Square wave (top) and square wave sub oscillator

Pulse wave and square wave sub oscillator

Saw wave and saw wave sub oscillator. Note that the spikes are artifacts created by the not-completely-a-saw-wave input (the vertical lines in the input wave are not fully vertical). This will disappear when using a real saw wave as input.

1 oct down and 2 oct down saw waves.





søndag 24. september 2017

Coming soon: the Xonik Waveshaper


On my breadboard today: The Xonik Waveshaper - insert a non-centered 0-10V saw wave from the Xonik DCO and you'll get the following (centered) waves:

- Saw
- Inverted saw
- Triangle
- Sine
- Pulse/square with VC-PWM and VC amplitude (no VCA needed)
- Sub oscillator with square -1oct, square -2 oct, saw -1 oct and saw -2 oct.

The current triangle/sine circuit is based on the Jupiter 8 and Yusynth modular, the sub oscillator is a simplified version of the Xonik Sub oscillator. The pulse circuit amplitude control idea (but not circuit) is lifted from the Juno.


fredag 22. september 2017

Alesis Andromeda A6

While searching for noise samples to compare my breadboarded noise against, I had a look at the Andromeda A6 circuit diagram. It is fun to study what the big guys think are good designs and I've picked up a few ideas already. I will probably post more as I go anlong.

My first findings

Separate center reference voltage

The A6 seems to use a reference voltage, PMID/PDMID in place of ground whenever ground would be expected on any of the inputs of an opamp. My guess is that PMID/PDMID means Power Middle/Power Digital Middle or something like that, as ground in these places would normally be the center of the wave.

The PxMID originates with a 5V voltage regulator. I've calculated PxMID to be 2.05V. The A6 uses +/- 12V internally, with an offset of +2V this means that any positive amplitude is reduced to +10V minus any opamp limitations.

The PMID line is littered with bypass caps. I assume that by using a separate, well regulated reference voltage, one may get rid of some noise from other components, and also that its hard to get 0V from a regulator, thats why it's 2.05V (?).

Noise


The A6 has most of its analog circuitry inside a bunch of ASICs. The noise section however, is discrete. Only one noise source is used for all voices and it supplies white, pink and red noise.

The noise source seems fairly standard, it is based around a zener diode (which is the same technique as using a transistor without connecting the collector). The pink noise filter seems to be a true pink noise approximation (3dB/oct) as it uses a multiple filter sections in the same fashion as Elliot Sound Products. It is not entirely similar as it has the filter sections connected to between the positive input and ground, whereas the Elliot version have them in the feedback loop, but I assume this is only because the A6 one is a non-inverting filter and the Elliot an inverting filter. All noise outputs are connected to an inverting amp which also adds the PMID reference and acts as a low pass filter with cutoff at 493Hz.

Analog pots


All analog pots (that are read digitally) have 10nF caps across them - I assume this is to stabilize values or prevent that noise from one pot falsely triggers another one. 8 5kOhm pots are multiplexed through one CD4051 mux.

FX bus


The FX send has both positive and negative sends that are inverted versions of each other. Not sure if this means that it uses a balanced bus but it could be likely. Further investigation necessary :-D

Master volume


Master volume is a physical pot connected directly in the audio path, no VCA is used. No master volume saving is possible which makes sense.

mandag 11. september 2017

Noise research

I intend for the XM8 to have noise as a waveform for both oscillators, and also to be able to switch between various 'colors' of noise. At the very least, white and pink noise should be present, possibly even red. But what exactly does this mean?

White noise is noise where the signal has equal intensity at all frequencies. In the synth world, it is commonly generated by using a transistor with one leg disconnected.

Pink noise is a signal where each octave carries the same amount of noise energy. But how is this achieved in practice?

According to Wikipedia, pink noise falls off at 3dB per octave. To get pink noise one filters white noise through a filter with 3dB/octave drop off.

Problem is, most basic active low pass filter has a 6dB drop off (which would actually give us red noise if used). So how may this be solved?

This page shows one method - use multiple filter sections to approximate a 3dB filter with a flat response. The more sections the better, but even four sections is pretty good for a 20-20 000kHz signal.

As a side note - the same page mentions NP capacitors, bipolar electrolytics, and says that film capacitors cannot replace them - this is interesting information as I've stumbled across NP in other circuits.

A similar approach seems to be in use on this page, which is a modification for the Sequential Circuits Pro One. It uses fewer sections (two?) and has an additional cap (C3).

But how does one calculate the frequency of each section?

In a normal active low pass filter (6dB), the frequency is 1/(2*PI*R2*C) and the gain is -R2/R1 where R2 is the resistor in the feedback loop.

It seems that the same holds true for each section in the multi section filter. For example:

1/6.28*100nF*1MOhm) = 1.59Hz
1/6.28*33nF*330kOhm) = 14.6Hz
...
which matches the frequencies next to the sections.

This would mean that the lower section of the Pro one filter is 338.8Hz, but the rest - the 270k and 3.3n combined gives us a 268.1Hz filter which seems a bit strange - however, I'm not sure this is the way to calculate the combined frequencies.

As for the gain, if the same formula as before is correct, it would be -270k/15k = -18.

The pink noise filter in the pro one matches the inverting shelving low pass filter found on this page. However, the only formula, found in the gif, is missing the lone cap in the feedback circuit.

Funny enough, the same filter topology is found in the BOSS CE-2 pedal's de-emphasis filter :). The de-emphasis filter reduces treble, which of course means it is a low pass filter of sorts. :)

On that page, the circuit is fully explained. When calculating the frequencies, the lone cap is omitted. It says that it is an LP of some sort but it is not essential when calculating the shelving frequencies.

The filter right after the transistor in the pro one circuit is a simple non-inverting HP filter. I am not sure exactly what C2 does.

The first filter in the Ray Wilson Noise Cornucopia is a simplified non-inverting amplifier filter as shown here and here. Its gain is 1 + R10/R9 (=48), the frequency is 1/(2*PI*R10*C4), or approx 34kHz.

ERROR: det er et lowpass non inverting shelving filter.

lørdag 9. september 2017

Wiring the Xonik PSU3 v1.0

The Xonik PSU3 v1.0 is a copy of the Ken Stone CGS66 Rev 1.1.

In addition to the dual voltage of the CGS66, it has a third part meant for digital/logic voltage.

The input to the third channel may either be a dual secondary/centre-tap transformer or a single secondary. If using a dual secondary, do NOT connect D11 and D12.

Using two transformers - connect earth to ground/0V on both connectors and mount D11 and D12

Using one transformer (or two centre-tap transformers): do NOT mount D11 and D12.
NB: Remember to fit suitable fuses and switches on the primary sides of the transformers.

The colors on the dual secondary transformer are the ones used on my Noratel TA050/15:



PS: The Xonik PSU3 has the main smoothing capacitors mounted close to the heat sinks. If the heat sinks get hot, the lifespan of the caps may be reduced.

On transformers and rectifiers

Everywhere that you find information about transformers, it says "make sure that you know what you do, these things can kill you".

Well, I thought I knew, but I still managed to mess up. I didn't get killed, but I learned a bit about transformers and rectifiers.


Let me explain.

There are two basic ways of turning an AC voltage into a DC voltage. One uses a half wave rectifier, the second a full wave rectifier.

The difference is that the half way rectifier only uses the positive part of the voltage swing, whereas the full wave rectifier uses both parts by magically reflecting the negative part. The full wave rectifier requires a few extra diodes but gives a smoother DC voltage (or at least one that requires a smaller smoothing capacitor and is more efficient).

Then there are two basic transformer configurations - single and dual secondary. When the two outputs of the secondary are of equal voltage, and the "bottom" of one is connected to the "top" of the next, we call it a centre-tap transformer. This kind of transformer is often used if you want a dual voltage output, for example +15V and -15V for audio circuits.

Here is how the different transformers may be connected for a single output voltage.

First off, a single secondary, half wave rectified configuration:

Here, the lower pin of the secondary is connected to ground, and the top is connected to a smoothing cap through a power diode.


Then we have the single secondary, full wave rectified configuration:

Here, none of the secondary output pins are connected to ground. Instead, they are connected to the top and bottom of a diode bridge rectifier. Then, one of the other rectifier junctions is connected to the smoothing cap, and the last one is connected to ground.


Now, if we have a centre-tap transformer, we get to use a little trick:

Instead of using four diodes, we get away with two. Ground is connected to the centre tap.


So what if we want a dual (positive and negative) output from a centre-tap transformer? Well, just duplicate the circuit, but turn the diodes the other way around for the second half.

This looks suspiciously like the full wave rectifier for the single secondary transformer, but there is a crucial difference!

Instead of connecting the last pole of the diode bridge to ground, it is used as the point where we tap the negative voltage/connect the smoothing cap for the negative voltage.

This may seem obvious, but when I tried to use a centre-tap transformer for a single output voltage, I didn't think this part trough. I left the four diodes in and connected both the last pole of the diode bridge AND the centre-tap to ground. This immediately blew the input fuses (luckily I was using fuses) and it is easy to see why: With the diodes in place there is a direct short (well, through the diodes anyway) between the negative half wave and ground, which drew a large current.


As for my circuit design - the fact that I both have a three pin input with one pin connected to ground, and room for four diodes in the bridge rectifier, means I can use both a centre-tap and single secondary transformer - as long as I do not connect the diodes when connecting the centre tap.

fredag 8. september 2017

DCO: Slow crystal startup

I have problems with the crystal startup on the DCO. For some reason the crystal doesn't start up properly, and the Fail-Safe Clock Monitor kicks in and starts the internal oscillator, which runs at 16MHz (The external crystal runs at 32MHz). Switching over to the external crystal again after startup works fine.

Someone on the mikroe forum suggested that this was due to a too high stray capacitance on the breadboard. Today I read up on crystals and capacitors, and tested a few combinations to see if I could get it to boot up at the right speed.

First of all, in the datasheet of the crystals, the parameter C load tells what capacitance to use. For my crystals this is 18pF.

I always thought this meant that each of the two caps should be 18pF. This is definitely incorrect. Instead, the total capacitance should be 18pF. But what does this mean?

First of all, the two caps connected from the crystal to ground are in reality two caps in series between the two legs of the crystal. Two equal caps in series have a equivalent capacitance of half the capacitance of one of them. So running two 18pF caps in parallel would yield an equivalent capacitance of 9pF.

But in addition to this, the crystal sees an additional capacitance CS. CS is the stray capacitance of the circuit and the input/output capacitance of the inverter or microprocessor chip at the Crystal 1 (C1) and Crystal 2 (C2) pins, plus any parasitic capacitances (here). This is normally around 5pF but may be higher.

The total capacitance C load should then be CS + C1 * C2 / (C1 * C2), which means that C1 * C2 / (C1 * C2) = C load - CS.

C1 * C2 / (C1 * C2), as mentioned, will be half of C1 if C1 = C2.

For my crystal then, C1/2 = 18pF - 5pF = 13pF, which means C1 should be 26pF (or 27pF, which is a standard value).



So, would changing from 18pF to 27pF on the breadboard change anything?

I tried the following combinations with the following results (half frequency means the MCU fell back to the internal oscillator):

18pF: half frequency
22pF: half frequency
33pF: half frequency
36pF (two 18pF in parallel for each side): half frequency
9pF (two 18pF in series for each side): CORRECT frequency!

This is strange and interesting. At 9pF the serial equivalent is 4.5pF (leaving "room" for CS up to 12.5pF). At 18pF the serial equivalent is 9pF (with CS up to 9pF). If my reasoning is correct, the stray capacitance is more than 9pF. It does not sound implausible. I will have to retest this once I get a PCB made, in theory at least 27pF caps should be the ones to use.




fredag 18. august 2017

Program memory block size

When writing to program memory from code, it is necessary to be aware of the fact that writes happens in blocks. You cannot write a single word/instruction, instead you write what is called a row or block.

I have not tested this i practice, but this datasheet gives us the row size for the PIC16F18325 when writing through the ICP - presumably it's the same for programmatically written data as well:

"When write and erase operations are done on a row basis, the row size (number of 14-bit words) for erase operation is 32 and the row size (number of 14-bit latches) for the write operation is 32"

As each word takes up 14bits, you have to write two bytes to fill it (the two MSB are ignored). Thus, rows are 32 words but 64bytes long when dealt with from code.

PS: Before doing a write, you have to erase the memory you want to write to. Erasing flips all bits to 1 whereas writing can only flip bits to 0. If bits are not 1 when writing starts, it will not be possible to get a 1 after writing either.

Program memory size on MCUs

Funny thing: In most MCU datasheets, the program memory size is listed in KB. The PIC16F18325 for example is said to have 14KB of program memory.

Don't let this fool you! It does not mean that you can store 14KB of data/constants.

The problem is, each word (instruction) on the PIC16 is 14bits long. Storing an 8bit constant in program memory (flash/ROM) takes up 14bits of space.

So how big is the memory really? That's easy: 14KB = 14 * 1024 * 8 = 114688bits, divided by 14bits per word = 8192. Thus, the "real" memory size is 8KB - you can store 8K instructions or constants.

fredag 4. august 2017

DCO: Culprit found but not fixed

I did extensive testing of various op amps yesterday, and as suspected, the amplitude error at low frequencies is caused by the op amp. I also tried recalibrating the power supply but that had no effect whatsoever.

The results from various opamps varied wildly, and results from positive and inverting buffering configs also varied a lot.

My best hit was with a UA741, in inverting mode the amplitude was perfect across the entire frequency range! Unfortunately, it was only a lucky strike, I retried several other UA741s and the result varied from around 7 to around 13V amplitude (when the real amplitude should be 10V).

The conclusion then is that at voltages very close to zero will experience a lot of variation even between specimens of the same family.

Tested op amps

UA741 variations

I am not sure how the effects are over time and temperature, this must be tested.

If  the effects are mostly production variations, it would be possible to calibrate each DCO.

This can be done in code even if DAC lookup tables must reside in program memory due to RAM limitations (1kB of memory is required for DAC keystep and rise-per-substep tables and the MCU only has 1kB of RAM in total). The PIC16F allows programmatical/runtime writes to flash program memory, and though there is a limit to the number of times this can be done (>10 000), even a write on every system startup would probably be possible.

Hopefully though, calibration will seldom be necessary. As a nice side effect, calibration will correct variances in both charging caps and resistors as well as opamps.

Calibration

Here is how I imagine it to be done:

A reference voltage is applied to one of the MCU pins. This is used as the reference voltage of one of the internal comparators.

First, apply the lowest frequency. By increasing and lowering the DAC output voltage until the comparator changes polarity, we figure out
- if the voltage is too high or too low
- if the amplitude error is within acceptable limits

A slightly too low amplitude is acceptable but a too high amplitude is not as this will trigger the comparator during normal operations, if we choose to use it as a reset-on-frequency-change trigger. The amplitude must also be adjusted to always be slightly lower than the comparator trigger point to prevent false triggers.

We also have to consider measuring the highest frequency amplitude error to see if errors are always either high or low. For now, I'll assume that they are always one or the other.

After finding the initial error, one loops through the remaining 255 samples, starting from the bottom.

For every frequency, the DAC voltage is increased or lowered (based on what we found for the lowest frequency) until the comparator changes polarity - this gives us the "correct" value for that step. To save time, we may stop checking once we reach a frequency where the error is small enough (and lower than the comparator voltage).

We should now have a correct lookup table for key samples. All that is needed now is to calculate the interpolation lookup table, and write everything to non-volatile flash memory.

To minimise the number of recalibrations, we could let the DCO check the keysamples on startup. If they are still within limits, no recalibration is necessary.


A different approach to finding the current amplitude would be letting the DCO control a PWM-based DAC to generate the reference voltage. It could then change the reference voltage instead of DAC output value to find the amplitude. Not sure that it's a better approach though.

PS:  If the signal amplitude is 10V, using a resistor divider with R1 = 100k and R2 = 68k will get the amplitude down to 4.048V. This lets us use the internal 4.096V voltage reference with the comparator.

onsdag 2. august 2017

DCO: Switching to JFET to try to improve low frequency amplitude

To try to fix the issue I'm having where the saw wave amplitude is too low at low frequencies, I decided to redesign the core using a JFET in place of the BJT that resets the integrator.

I found no p-channel JFET in my parts box, but I had plenty of the J112 n-channel JFETs, so to make things easier I decided to go with the yusynth design.

The Yusynth design however, has a 0-5V saw wave, whereas mine is 0 to -10V. To make sure things would still work, I changed the core ever so slightly to get a 0-10V:

instead of tapping the charge voltage directly from the DAC using a positive opamp buffer, I switched to a unity gain negative amplifier. This would sink current instead of sourcing it, changing the charging direction. To make this works one also have to replace the 2n3906 PNP transistor with a 2n3904 NPN (One should also switch the polarity of the timer output, but as both a positive and negative going spike are generated, just slightly offset in time, this was not required for testing).



But testing this, I got a big surprise - the low frequency amplitude was no longer too low - it was too high! Previously I had to increase the DAC value from 60 to 80-something, now I had to reduce it from 60 to 48 (steps times 5V/65536).

This made me less certain that switching to a JFET would improve anything, but I still decided to try it.

I added an LM311 comparator, and set its negative input to 0.118V using a 120k and a 4k7 resistor. This would assure that when the positive input was just slightly higher than 0V, the output would spike up to 15V, and when the input was 0V the output would be -15V - similarly to the yusynth circuit, where the comparator outputs a negative voltage to turn off the JFET. The circuit worked instantly (!), but as suspected, nothing changed.


So, now I guess I've ruled out the reset transistor as the cause of the offset. Also, the fact that the amplitude error changes when I swap the charging polarity, makes me believe that the cap is not at fault either (though I will still check this).

That leaves either the DAC (which is unlikely for the same reason as the CAP) or the opamp buffer.

It could also be that a small difference in the power lines (measured to +15.01 and -15.00 volts) could cause this, I don't know. I will try recalibrating and also try different opamps to see if that changes anything.

For reference: Here is the original breadboarded circuit with the 0 to -10V output. I have since added the missing 2R2 resistor, however, that changed nothing. The DAC is connected where the 20k pot is in this drawing


tirsdag 1. august 2017

Yusynth VCO core discharging

I may have written about this before, but here goes:


The Yusynth saw core ramps down from 5 to 0v, then resets to 5v. the top of the charging cap is always at 5V while the bottom drops towards zero as current is sunk through the expo converter (u4).

The LM311 comparator has its positive leg grounded (when sync is not used). The LM311 is an open collector type comparator. For these, the rule, as written here, is that: 


"Current WILL flow through the open collector when the voltage at the MINUS input is higher than the voltage at the PLUS input.


Current WILL NOT flow through the open collector when the voltage at the MINUS input is lower than the voltage at the PLUS input."


When current does NOT flow, the output is pulled towards 15V via R20. When current flows, the output is pulled towards -15V which is connected to pin 1 of U5.


Pin 1 is called ground, but it can be connected to a lower voltage if necessary.


During capacitor charging, the voltage at the minus input is positive and thus higher than the positive input. In this case, current flows and the output is negative.

Once the negative input reaches 0V, for an instant, the input is lower than the voltage at the positive input, and current stops flowing. The output is then pulled towards +15V.

This would mean that as long as the output is negative, the JFET transistor is switched off, and once the output is positive, the JFET conducts, resetting the cap.

This is in accordance with what wikipedia says about an n-channel JFET:  "To switch off an n-channel device requires a negative gate-source"

 The source and drain of the transistor will always be between 0V and 5V, thus a -15V gate voltage assures that it is turned off. Similarly, source and drain will never be above 5V, so a +15V will always turn it off.

Since the source/drain may however reach 0V, the emitter of the transistor cannot be connected to ground - this would leave the comparator output and thus the JFET gate at about 0.6V, which is not enough to keep it pinched off.

DCO: comparator to reset period

I've been thinking about ways to enable frequency changes in the middle of a period without having to restart the period, which resets the phase.

My thought so far has been to use a comparator with a reference voltage set to slightly higher than the maximum amplitude of the wave, and reset the period once it triggers. That way we can reset the timer and set a new charge voltage anytime, and it will just slightly overshoot the desired amplitude. I would think that this could be a good solution, but it has some issues.

1) The amplitude may be temperature sensitive - if the capacitor charge time varies with temperature or if the charging current changes due to temperature effects on the resistor.

2) Setting such a reset point requires a trimpot and a way to check that the point is not set too low, in which case it would interfer with the normal operation of the DCO

As for 1), that is just something that has to be tested. But in case 2), it would be possible to let the microcontroller figure out the cutoff point by itself. If the MCU controls the reference voltage, it can loop through all frequencies (or at least a subset) and find the maximum amplitude during normal operation, then set the reference voltage to slightly higher than this. It would also be possible to rerun this operation later if temperature rises. The cutoff point may be found either using an analog pin, or it can be done using the comparator and gradually lowering the reference voltage until the comparator triggers.

The MCU has a built in comparator. It also has a built in DAC that can generate a reference voltage, but its resolution is only 5 bits. We need something better than that, but we do not want to add another spi controlled DAC or similar.

A possible solution: Use the built-in PWM generator in conjunction with a lowpass filter to generate a DC voltage.  This post, this article and this article has some filter suggestions.

mandag 31. juli 2017

Wave centering - bias circuit

The DCO generates a wave running from 0 to -10V. To center this, I tried using two resistors and a 1uF capacitor, followed by a buffer. This works fine for higher frequencies, but at the bottom of the frequency range we get severe distortion, turning the straight lined saw wave into a slope.

Also, this arrangement won't work for Pulse signals as the pulse width has more energy at either top or bottom.

The square and pulse waves are a bit interesting as the amplitude CV does not have to run through a VCA. Instead, the amplitude is equal to the CV. This means that subtracting half the CV from the output wave will center it.

I've come up with the following, untested (and incomplete) circuit that shows my idea:



DCO: too low amplitude at low frequencies

The DCO is nearly finished, but a somewhat serious problem remains. At low frequencies, the saw wave amplitude drops significantly - at the lowest frequency, 8.16Hz, it is almost half of the expected value.

Fortunately, this can be compensated for by increasing the capacitor charging current at the low end. Using an oscilloscope, I've measured what increase in DAC output voltage is required to get the correct amplitude. The plot of frequency vs dac increase (in dac steps, each step is 76.3 uV, which when placed across a 56k resistor equals a current of 76.3uV/56kOhm = 1.36nA per step) is like this:


It shows that as the frequency drops, a higher and higher correction is needed to reach the correct amplitude in the available time. It also shows that the correction necessary is negligible for frequencies above 300Hz.

This plot shows the expected charge current vs the required one for the same range, blue being the expected and orange the required:



I am trying to find a function that fits what I see, to make it easy to add the necessary charge voltage to the precalculated dac lookup table. I've had some success with exponential regression but it doesn't quite fit.

But what is the effect I'm seeing? Why is a larger current than expected required at low frequencies, and why does it change?

The only thing I can think of is that we have a leak somewhere - some of the charge in the cap leaks out, or some of the current goes somewhere else or is turned to heat etc. As this effect goes on for a longer time the lower the frequency, it is a reasonable assumption which fits what I see.

There are very few parts involved in the integrator. A capacitor, a transistor and a 2.2Ohm resistor which I suspect is there to limit the current during capacitor discharging.

I tried removing the resistor, nothing changed. This leaves the transistor and cap.

A BJT like the one used in the DCO has a maximum leakage current of 15nA at 30V. It will be less at lower voltages, but not necessary propotionally less, according to this post. While I haven't tried to do any calculations, this is in the same range as the currents required to correct the error.

The Yusynth VCO, which also has an integrator core, uses a n-channel JFET instead of a BJT, and specifies a high quality capacitor - styroflex or silver mica, 1%. A JFET has a much lower channel-to-gate leakage current than a BJT, so this may improve things. I will try this, but it requires a slight redesign of the circuit.

onsdag 26. juli 2017

Technics sx-k100/150/200/250

I keep forgetting which is which of these. On the Rockheim pages (https://digitaltmuseum.no/011022857628/synthesizer) they show the sx-k100 and mention that the sx-k200 was launched at the same time. Also, they say that the sx-k100 is the one used by Knutsen & Ludvigsen, but I have to check this with my photos from the exibition.

Anyway, these are the facts:

The sx-k100 and sx-k200 seem to be the analog ones. The sx-k200 has a solo synth part that the sx-k100 lacks.

The sx-k250 is labeled "PCM keyboard" in the photo of the cartridge bay here: https://www.olx.pl/oferta/keyboard-technics-sx-k250-analog-pcm-CID751-IDmTmUI.html

The sx-k200 here http://medias.audiofanzine.com/images/normal/technics-sx-k200-301220.jpg lacks that text.

The sx-k150 is sold as a PCM keyboard on Gumtree.

Conclusion: For me, the sx-k100 or sx-k200 are the ones to get.

mandag 24. juli 2017

Jupiter 8 X-mod

The Jupiter 8 has two oscillator, and the output of oscillator 2 can frequency modulate oscillator 1.

Oscillator 1 has four waveforms:
- Saw
- Triangle
- Pulse
- Square

I am not sure why both pulse and sqare are present as only one can be connected to the output at the time.

Oscillator 2 has these outputs:
- Sine - which replaces the saw form osc 1
- Triangle
- Pulse
- Noise

The x-mod input is tapped after the oscillator 2 waveform selector, to any of the osc 2 waveforms may modulate osc 1. X-mod has its own VCA The X-mod output (a current, as it is the output of an OTA) is mixed with the rest of the linear CV input, so x-mod is linear.

fredag 21. juli 2017

XM8 filters

I want the XM8 filters to be as flexible as possible. I've studied the various IR3109 based roland filter implementations and the CEM3320 ones found at Electric Druid, and found designs for state variable filters based on both.

I am thinking about having exchangable filter cassettes, possibly with two identical filters per cassette. I tried to find a common control scheme, but right now I think that just using a shift register to serially control the filters will be the most flexible - that way variations can be software controlled instead of implemented in hardware.

I also want to have two filters per voice, configured in either series or parallel - one state variable and one permanent LP.

IR3109
I've found six different implementations using the IR3109 chip or similar. The JP4/6/8, the Juno 6/60, the JX-3P and the MKS-80 all use the IR3209. The MKS-7, MKS-30 and Juno 106 use the 80017a filter chip which is basically a combination of an IR3109, two BA662 and some additional components. I have not studied the use of these in detail, just compared the resonance and control circuitry.

SH101 and MC202 also use the IR3109, I have yet to look at those.

There seems to be a progression in the circuit through the years. Exact component values varies but all except two of the implementations use the same circuit for the filter part. The resonance feedback control and the cutoff frequency control circuits are quite different between the synths.

The JP-6 and the MKS-80 stand out however. The JP-6 has a state variable filter that allows both HP, LP and BP filters - the two first 24dB and the last 12dB. It would be easy to add 12dB HP and LP too, but this has not been done. The MKS-80, weirdly enough, has the same configuration as the JP-6, but hardwired to a LP.

The JP8 and the Juno 6/60 uses the exact same filters/component values, except for a few minor differences in the resonance feedback and cutoff frequency control. The JP8 can be tapped at 12dB or 24dB whereas the Juno is 24dB only. An interesting thing to note is that the Juno 6 datasheet indicates the CV for cutoff: 0.48V/oct.

All implementations have a posistor in the control circuit to compensate for temperature variations. The JP6 and MKS-80 have a posistor in the resonance circuit too.

State variable filter
I currently consider these implementations:
- The JP-6, with the added option of 12dB HP/LP
- The Elka Synthex CEM3320 based filter
- The CEM3320 multiple identity filter
- The Wasp filter.

Permanent LP filter
- The moog ladder filter
- possibly the Juno filter, if it actually sounds different than the JP-6 filter
- Possibly a SSM2044 (SSI2144) based filter - Korg PolySix or MonoPoly
- Korg MS20
- ARP4270 (ARP 2600)
- EMS Diode ladder filter

I will start out with the JP-6 and moog ladder filter and go from there.

Interface
SVF
digital: serial input, clock, load
analog: resonance CV, cutoff CV

LP
digital, 12dB/24dB switching
analog: resonance CV, cutoff CV

tirsdag 18. juli 2017

BA662 pinout

While drawing up various uses of the Roland IR3109 VCF-chip, I needed to make an Eagle part for the OTA used in the resonance circuit. My initial circuit was the one from the Jupiter 4 service manual, and it uses a BA662, IC17:



The service manual only shows a part using four pins while the BA662 has 9:
This shows that the BA662 is actually an OTA and a buffer combined into one package. The buffer is apparently not used in the JP-4, so how is it disabled?

The Juno-6 and Juno-60 service manuals answers the question:
Pin four, the buffer control, is connected to -V and the buffer input is connected to +V. The buffer output, as expected, is not connected to anything.

Incidently, the IR3109 itself is just four OTAs, four buffers and an exponential converter connected to the control of each OTA.

onsdag 12. juli 2017

It's alive!

The XM8 just made its first ever sound - controlled by midi from a little phatty to the XM8 Voice controller, through the OMM and on through SPI to the DCO. Playing worked like a charm - pitch changes are delayed but that is to be expected since the SPI speed is set to a minimum right now. I had a lockup too, somewhere in the Voice controller code, but all in all I'm really pleased!

The tracking is awfull, I think I've used different intervals for semitones in the Voice controller code and the DCO, but it is very clearly playing semitones.

Woohooo! Videos to come.

onsdag 21. juni 2017

DCO - aribtrary reset point

I've been a bit worried about the fact that the DCO frequency may only be changed when the period reset timer runs. At low frequencies this may mean a noticeable loss of timing presision - worst case for a 20Hz signal would be 1/20 s off. At 120BMP, the duration of a 1/16th note is 1/32 second, so it will miss by a lot. If my calculations are correct, playing "flight of the bumblebee" at near-unhearably low frequencies will be impossible ;-) I am not sure how much of a problem the inaccuracy is in practice, but it is something to investigate further.

This constraint is there for a good reason, as we need a perfect match between charging voltage and reset time for the saw wave to get the correct amplitude.  If we choose to change the charge voltage at any given time, without changing the reset timer, the amplitude of the first cycle after the change will be either too high or too low.

Idea 1:
Ideally, we should change the remaining time of the reset timer too. This would be a case of subtracting the current remainder from the new period timer value, correcting for the time the calculation takes, and then updating the timer - IF the time the calculation took was less than the remaining time.

This is slightly more complicated than what it sounds like. As the current timer and the new timer may not have the same prescaler, we need to take this into account when calculating the correct reset values. We also need to make sure we don't mess up the reset pulse timer.

Idea 2:
A different approach would be to do the first reset in hardware. If we connect the saw output to a comparator, and check if the level is just slightly larger than the normal, correct amplitude, we could trigger a reset using the sync input, preventing a large amplitude error. The amplitude error that is inevitable because the reset point must be larger than the correct amplitude is hopefully small enough to be inaudible. This lets us change the charging voltage at any time and still not get a large amplitude error.

This will fix the case where the amplitude is too large, but the case where it is too small (e.g. the new charge voltage is lower) will not be fixed. To fix this, we must also reset the period timer at the same time. Doing so guarantees that the charging time is at least long enough for the new charging voltage to fully charge the cap. In most cases the charing time will be too long as it adds to the time already elapsed since the last reset, but then the previous comparator fix will reset the period at approximately the right time.

The disadvantages to this method may be:

  • Charging time may change slightly when the ambient temperature changes. Resistor values barely change so I have to check the effects on the charge capacitor.
  • The amplitude of the first period will always be slightly wrong after a frequency change. Not sure if that will be audible. It may possibly only be a problem for fast changing pitch.


Idea 3:
A third method would be to always reset the cap at the instant a frequency change occurs. The timing will then be as accurate as possible. The main disadvantages are

  • The saw wave will always start at the same position. Two DCOs running in parallel will then be in almost perfect sync.
  • A fast changing pitch will reset the timer multiple times per second, possibly hundreds or thousands of times. At low frequencies this means no saw wave runs to completion, giving us a way too low amplitude (though shifted to the maximum).


I will give the choice between 1 and 2 a more thorough thought and try to build 2 to see how it feels like. All options may be retrofitted to the current DCO even if the PCB has been created, as the comparator circuitry can be housed outside of the DCO itself..

onsdag 7. juni 2017

DCO core up and running

After spending a long time converting and optimising the DCO code for the PIC16F18325, I finally connected a DAC and tested the thing last night.

All frequency tests seemed ok, and the charge current tracked the frequency almost perfectly, charging the saw core capacitor to 5V even if frequencies changed. Only for the lowest frequency I tried (16.35Hz) did the cap not fully charge. I successfully tried frequencies up to 7000Hz. At 14000Hz the charge current was once again too low, but this was expected as the DAC output cannot reach a high enough level with the current combination of cap and charge current converter resistor (100kOhm). I tried swapping the resistor for a 56k one and the saw voltage swing doubled as expected, so a little experimenting with various resistor values will probably fix this issue.

I have had some issues with the saw core op amp oscillating. Not sure what causes it (well, I suspect it is due to the capacitor in the feedback loop), but some brands seem more susceptible to this than others.

I've tried the TL072CP and TL062CP from Texas Instruments and they both oscillate. TL072BD and 4556D from JRC work fine. Maybe the B/C difference could explain it.

The DCO uses modern, easily available components, the reset transistor is a 2N3906. The DAC currently used is a MAX541, with an SPI speed of 8MHz. The 'production version' will probably use a MAX5216 as this is way cheaper.

I was not aware that I could get such a high speed, now I consider moving the DAC update into the interrupt routine. It will probably double the time spent in the routine, but even this would only reduce the max transfer speed from the master controller to the DCO to around 950kbps, meaning we could still update the DCO 50.000 times per second (or rather, transfer new pitch values, the DCO will only update at period reset positions).

Next up is adding and testing SPI control, then recalculating the lookup tables to be centred around Cs (a C should be at 32768 = virtual 0V). Then finally breadboarding the wave shaper circuitry and deciding on voltage control and how to center the waves around 0V.

I must also decide the p-p voltage output. 12V seems to be the Juno way, this is the highest "safe" voltage possible since the saw is generated between gnd and the negative power rail (-15V). I assume that keeping the voltage as high as possible up to the point where several waves are summed is a good idea, to keep noise to a minimum.

The charge current is a bit too low at the lowest frequency





The dots above the peak of the saw wave is the reset pulse




The reset pulse gets more and more visible as the frequency increases and we zoom in

The charge current is too low above a certain frequency. This will be fixed.