Giter VIP home page Giter VIP logo

windfisch / analog-synth Goto Github PK

View Code? Open in Web Editor NEW
25.0 2.0 2.0 6.21 MB

A low-cost semimodular analog synthesizer

Home Page: https://windfis.ch/analog-synth/analog-synth.html

License: GNU General Public License v3.0

GDB 0.20% Makefile 5.47% C 34.21% Gnuplot 1.36% Python 30.57% C++ 0.05% Rust 26.20% Logos 0.10% Shell 1.84%
analog-synthesizer modular synthesizer electrical-engineering opencm3 rust kicad midi audio music

analog-synth's Introduction

Analog Synthesizer Project

This project attempts to build a low-cost analog synthesizer based on well-available components like LM324 or TL084 op-amps, which is easy to understand and learn.

The goal is a semimodular synthesizer which is compatible to existing other systems, where possible. The following features are planned:

  • two 1-Volt-per-octave voltage controlled oscillators (VCO) with triangle, PWM-able square, and sawtooth waveforms
  • the option to use them as digital controlled oscillators (DCO)
  • a voltage controlled filter (VCF)
  • a voltage controlled amplifier (VCA)
  • digital or analog envelope generators
  • analog waveshaping and distortion circuits
  • USB or MIDI interface based on a STM32 microcontroller

For the sake of simplicity, the following trade-offs are being made:

  • exact component selection is traded for automatic or semiautomatic tuning where possible:
  • no exact 1-volt-per-octave frequency behaviour: The VCO's frequency response is not 100% perfect. While commercial synthesizers offer complex analog compensation circuitry, this project will measure the frequency deviation and compensate for it in software at the stage of the MIDI-to-Control-Voltage interface.
  • no voltage controlled analog envelopes: These are complicated to build, and the difference to digital envelopes or LFOs is not noticeable.

Required Hardware

So far, apart from standard resistors and capacitors, the synth uses LM324 op amps, and BC547 / 2N3904 bipolar-junction-transistors and 2N7000 MOSFETs.

The control logic and its firmware is currently based upon a STM32F103 based "blue pill" board, which can be sourced for less than 2 EUR from your favourite chinese seller. (Note: look for those boards with a rectangular white reset switch, not a flat round one.) Previous versions were developed for the STM32F411 discovery board, which should still work after adjusting the Makefile.

Repo Contents

under simulation/, some circuitry was tested (using the KiCAD SPICE simulation).

Most importantly, simulation/vco shows a functional exponential VCO. There are detailed annotations on which part serves which purpose.

simulation/software/ contains tooling to do transient simulation on parts of the synth with different control voltages and to further analyze the results.

Under measure_vco/ you can find the tooling and test results for measuring the pitch deviation of the VCO.

hardware/ contains the actual hardware boards and drafts:

Setup

To build libopencm3:

git submodule update --init
make -j8 -C libopencm3

If you're using a STM32F411 board, you must adjust measure_vco/firmware/Makefile and use the DEVICE=stm32f411re instead of the DEVICE=stm32f103c8t line.

To measure the vco frequency response:

cd measure_vco/firmware
make

then do whatever is neccessary to flash the program onto your board. For the blue pill board, putting it into bootloader mode by jumpering BOOT0 to 1, resetting, and calling stm32flash -w dac_test.bin /dev/ttyUSB0 does the job, while for my STM32F411-discovery, which has a non-standard blackmagic firmware on the STLINK chip, it is:

arm-none-eabi-gdb dac_test.elf # make sure it loads the .gdbinit file
load
run

Connect the pins correctly, then record the output with an UART adapter (or using the blackmagic uart device).

Licensing

All software, firmware and schematics are released under the terms of the GPL3 license. Note that this does not include the simulation/**/*.lib files needed for simulation. Vendor licensing as noted in the respective files applies.

analog-synth's People

Contributors

spitfirex avatar windfisch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

analog-synth's Issues

Design a voice supplement board

Features:

  • mix 2-3 VCO signals
  • 1-3x sync circuitry
  • 1-3x square_ctl buffering
  • 1x VCA
  • 1x VCF (+feedback)
  • MCP4822
  • sub oscillator
  • layout board (stackable!) with separate grounds. they are joined in the main board.

Triangle output is dirty

The triangle signal seems to have a small square signal superimposed. Maybe this is crosstalk from the comparator?

Add sync circuitry to vco-mkII

Sync works by manually applying 99%-duty-cycle PWM signals to the sync pin. Add circuitry to create these pulses from any input

Keep SPI bus busy

Use DMA to initiate dummy transfers so the SPI bus never becomes idle.

Trying to tackle #24

SPI clock noise

The filter overlays the filtered signal with a nasty 1kHz signal. The SPI dacs update with 1kHz update rate. Changing this changes the hum.

Since SPICLK is running at 5MHz, and since touching the SPICLK pin with a large metal mass (such as a wirecutter) leads to amore pronounced hum.

This also happens with a proper 7805-7905-battery-based power supply, so likely not a virtual GND problem.

wrapping the filter in (grounded) aluminum foil strongly reduces the hum.

Seems like we have built a radio station :(

Add square ring modulator

The sawtooth waveform is generated using "binary ring modulation" (i.e. by inverting the triangle's wave every half period).
Add an XOR gate (i.e., a digital multiplier) to allow binary ring modulation from outside.
Add a switch to switch between sawtooth and ring-modulated triangle.

create final schematics (with less calibration potis)

  • VCO: remove var_vsrc, hard-wire schmitt_feedback and maybe even the tune poti
  • voice board: get rid of all the trim potis; no filter overdrive (vca is enough)
  • main board: figure out how to create the supply voltages
  • put everything together, or at least put voltage converters on each board; or proper power distribution wiring.

Frequency analysis tooling

Features:

  • Input: raw USART output or code-point / frequency lists.
  • automatic DAC wiggle compensation
  • automatic codepoints-per-octave determination (with outlier rejection!)
  • plotting
  • quality assessment scores

PWM ratio affects pitch

Applying a LFO on the PWM ratio (regardless of whether the PWM signal is actually used or not) of VCO mk I slightly changes the pitch periodically.

Possible causes:

  • GND is not perfect and thus is affected by the duty cycle / output signal of the comparator (see #13)
  • OpAmp cross talk

Possible solutions:

  • fix dirty ground wiring
  • Change OpAmp
  • Compensate using lin.pitchmod

proper MIDI controls

Control all firmware features through midi control messages:

  • detune VCOs against each other
  • LFO waveform, frequency, (digital amplitude)
  • envelope ADSR, curve, parameters
  • load and save patches

check voice board and main board

voice board:

  • square_ctl buffering
  • clamping
  • sync pulse generation, see #18
  • VCF: broken, see #19
  • VCA
  • mixer
  • expo converter
  • Vctl generation

main board:

  • power generation
  • power distribution
  • STM32
  • DACs

voice board DAC overload

The MCP4822 DAC is overloaded by the two 1k potis, yielding to negative steps in the frequency response:

Calibration data:
        0       10408324
        1       10412592        (+4268)
        2       10412996        (+404)
        3       10430552        (+17556)
        4       10461995        (+31443)
        5       10476525        (+14530)
        6       10471559        (+-4966)
        7       10485320        (+13761)
        8       10514117        (+28797)
        9       10531170        (+17053)
        10      10524266        (+-6904)
        11      10541212        (+16946)
        12      10571562        (+30350)
        13      10583441        (+11879)
        14      10582638        (+-803)
        15      10595078        (+12440)
        16      10623439        (+28361)
        17      10636119        (+12680)
        18      10629779        (+-6340)
        19      10646368        (+16589)
        20      10677762        (+31394)
        21      10690974        (+13212)
        22      10693401        (+2427)
        23      10703692        (+10291)
        24      10736802        (+33110)
        25      10750990        (+14188)
        26      10746097        (+-4893)
        27      10762025        (+15928)
        28      10793420        (+31395)
        29      10809007        (+15587)
        30      10806801        (+-2206)
        31      10821489        (+14688)
        32      10855301        (+33812)
        33      10868995        (+13694)
        34      10862854        (+-6141)
        35      10880101        (+17247)
        36      10909879        (+29778)
        37      10921666        (+11787)
        38      10920217        (+-1449)
        39      10935907        (+15690)
        40      10967428        (+31521)
        41      10980510        (+13082)
        42      10976635        (+-3875)
        43      10992054        (+15419)
        44      11022933        (+30879)
        45      11040306        (+17373)
        46      11036704        (+-3602)
        47      11054103        (+17399)
        48      11084608        (+30505)
        49      11102217        (+17609)
        50      11093039        (+-9178)
        51      11113498        (+20459)
        52      11140161        (+26663)
        53      11157024        (+16863)
        54      11152067        (+-4957)
        55      11165635        (+13568)
        56      11198119        (+32484)
        57      11214475        (+16356)
        58      11210262        (+-4213)
        59      11227953        (+17691)
        60      11257944        (+29991)
        61      11273733        (+15789)
        62      11267439        (+-6294)
        63      11283385        (+15946)

Unsoldering them and directly plugging the DAC's output into a 100k-impedance input solves this:

Calibration data:
        0       7560015
        1       7626153 (+66138)
        2       7685447 (+59294)
        3       7756073 (+70626)
        4       7815846 (+59773)
        5       7886242 (+70396)
        6       7946359 (+60117)
        7       8016541 (+70182)
        8       8074533 (+57992)
        9       8144614 (+70081)
        10      8204225 (+59611)
        11      8275233 (+71008)
        12      8334513 (+59280)
        13      8405362 (+70849)
        14      8467101 (+61739)
        15      8537092 (+69991)
        16      8596833 (+59741)
        17      8666389 (+69556)
        18      8725609 (+59220)
        19      8795968 (+70359)
        20      8854710 (+58742)
        21      8923339 (+68629)
        22      8981727 (+58388)
        23      9050377 (+68650)
        24      9110157 (+59780)
        25      9179110 (+68953)
        26      9238462 (+59352)
        27      9306614 (+68152)
        28      9367830 (+61216)
        29      9434346 (+66516)
        30      9494924 (+60578)
        31      9560891 (+65967)
        32      9622665 (+61774)
        33      9689127 (+66462)
        34      9748980 (+59853)
        35      9815773 (+66793)
        36      9876657 (+60884)
        37      9942616 (+65959)
        38      10003955        (+61339)
        39      10068704        (+64749)
        40      10130663        (+61959)
        41      10196342        (+65679)
        42      10256692        (+60350)
        43      10321702        (+65010)
        44      10382945        (+61243)
        45      10447593        (+64648)
        46      10508283        (+60690)
        47      10573012        (+64729)
        48      10634293        (+61281)
        49      10699242        (+64949)
        50      10759150        (+59908)
        51      10823672        (+64522)
        52      10884100        (+60428)
        53      10948259        (+64159)
        54      11010203        (+61944)
        55      11074036        (+63833)
        56      11136111        (+62075)
        57      11199193        (+63082)
        58      11259225        (+60032)
        59      11323721        (+64496)
        60      11383613        (+59892)
        61      11447449        (+63836)
        62      11507102        (+59653)
        63      11570118        (+63016)

Signal leaks through the closed VCA

Leaking occurs even with the signal not being routed into the transistor's base terminal oO?
Leaking is stronger when a useless film capacitor is connected to the signal on the one side, floating on the other

Design a control prototype board

Features:

  • Blue Pill socket
  • 1-3x MCP4822
  • 1-2x BU2505FV (plus 10x low pass filter)
  • 4-16 signal shifters (0-5V to -2.5-2.5V for LFOs)
  • Virtual ground generation
  • Linear voltage regulator
  • Capacitors
  • LEDs. everyone loves them

Automatic DAC steppiness compensation learning

The DAC creates step-like artifacts every 64 code points.

  • they can be removed quite easily
  • find an automatic way to remove them during self calibration
  • do use this compensation strategy

evaluate vcf component values

write spice scripts to plot frequency response vs values of the amplifier's input impedance, the total current, the supply voltages and the cebter voltage of the amplifier

High frequency trim

Find out how to use the high frequency trim diode-resistor-combinations to resolve the volt-per-octave-tracking inaccuracy described here

Build metal enclosure

Figure out whether the buzz goes away, when putting

  • the main board or
  • the voice board or
  • both
    into a metallic enclosure (or wrapped in aluminum foil)

trying to tackle #24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.