element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Blog A subtractive music synth fully implemented in FPGA
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mdicosmo
  • Date Created: 15 May 2019 8:55 PM Date Created
  • Views 8699 views
  • Likes 12 likes
  • Comments 4 comments
  • direct digital synthesis (dds)
  • electronic music
  • programmablelogicch
  • 8-bit music
  • audio synthesis
  • music production
  • dds
  • synth diy
  • fpga
  • vhdl
  • xilinx;
  • music
Related
Recommended

A subtractive music synth fully implemented in FPGA

mdicosmo
mdicosmo
15 May 2019

From:

https://thetinysynth.wordpress.com/

The Tiny Synth, with its synthesis core measuring only 1.5×1.5mm, is probably the smallest subtractive synthesizer out there. Based on the Artix7 device from the latest Xilinx FPGA family, it provides a total of seven oscillators, three LFOs (Low-Frequency Oscillators), two envelope generators, tremolo and vibrato effects and an SVF (Static Variable Filter) with resonance and frequency control.

imageThe Artix7 device, the core of The Tiny Synth.

 

Modern FPGAs require several power supplies and they come in BGA packages which makes them not very well suited for DIY projects. In order to simplify the design and make a proof of concept, I decided to use the commercial evaluation board AES-A7EV-7A50T-G (currently obsolete) based on the XC7A50T device providing plenty of computational power. A very simple double layer PCB was developed to address the specific features needed by the synth such as MIDI interface and user controls. The connection with the evaluation board is done through two PMOD connectors.

imageCustom PCB for synth interface

Hardware block diagram

The figure below shows the simplified high-level block diagram of the tiny synth. The main component is the Artix7 FPGA, where the actual digital synthesis including mixing and filtering, take place. The user interface consists of 16 potentiometers and 5 switches (4 mounted). The potentiometers are acquired using two 8-channels serial ADC (AD7888) and they are divided into five different groups; four used to control the oscillator mixer, eight for the two envelope generators (Attack, Decay, Sustain, Release) and the remaining four for the output filter control (Resonance and Frequency) and LFOs (Rate and Depth). The MIDI interface consists of the standard 5-pin DIN connector and the classic 6N138 optocoupler circuit. A 16-bits DAC is used to transform the output digital signal into an analog signal at the refresh rate of around 200kHz.

imageBlock Diagram

 

Inside the FPGA

The figure below shows the simplified block diagram of the VHDL program for one single voice. Polyphony is obtained by instantiating as many voice blocks as required and mixing them together before the DAC driver.

imageFirmware Block Diagram

 

The following sections describe the main blocks of the program.

MIDI interface

MIDI, Musical Instrument Digital Interface, is the standard protocol used for communication between any modern musical device. The physical layer is a simple serial asynchronous data link with every communication packet consisting of a status byte and a variable number of data bytes. The MIDI interface is fully implemented in VHDL as a simple UART module with an additional message dispatcher. Only a limited set of status messages are implemented:

  • Note On Event ( 1001nnnn )
  • Note Off Event ( 1000nnnn )
  • Control Change ( 1011nnnn )
  • Pitch Band ( 1110nnnn )

 

When a key is pressed, the Note ON event message is received and the two following data bytes (pitch and velocity) are stored in the program. The pitch data controls the oscillator frequency, while the velocity is used to scale the output signal through the NCA (Numeric Controlled Amplifier). A very important feature that was added after testing the MIDI module with commercial controllers and software was the Running Status mode, particularly useful for arpeggios. In this mode, the midi controller “compresses” MIDI transmissions sharing the same status byte. For instance, if three keys are pressed, only one status byte NOTE ON will be issued, followed by six data bytes corresponding to the key and velocity of the three notes.

Oscillators and mixing

The Tiny Synth provides seven oscillators: Sine, Triangular, Square, Sawtooth, Noise, PWM, and a Sub-Oscillator. The signal generation is based on the DDS (Direct Digital Synthesis), a well-known synthesis method based on storing the waveform values of a period in memory tables and reading through them at discrete rates defined by an NCO (Numerically Controlled Oscillator). 
Using a look-up table, the pitch value received by the MIDI module is first decoded into the corresponding M increment which is then used to control the NCO. The formula below shows the relationship between the output signal frequency (fo), the DDS clock frequency (fc) and the size of the memory table (2^n). The size of the wavetable is 4096 and the values are calculated using a simple Matlab script.

imageThe DDS “Tuning equation”

 

 

The PWM waveform, instead, is obtained comparing the sawtooth wave generated using DDS with the output value of the LFO. This results in a pulse signal with a variable duty cycle. The Sub Oscillator is generated subtracting one decade from the pitch value received from the MIDI module and instantiating a second square wavetable.

imagePWM signal generation from sawtooth

 

The noise generator is based on a PRNG (Pseudo Random Number Generator), implemented using an LFSR (Linear Feedback Shift Register) in VHDL. The shift register is 16 bits wide which gives acceptable randomness to the signal.

imageView of a 4 bits LFSR

 

The oscillators output signals are then routed to the mixer module where they are mixed together before going to the filter section.

ADSR Envelope Generator

The ADSR (Attack, Decay, Sustain, Release) Amplitude Modulation Envelope is an essential component in any modern synthesizer which emulates the natural sound variation of musical instruments. The ADSR module is implemented as a VHDL block using a simple FSM (Finite State Machine), represented by the diagram below. The basic principle of this module is to use a varying counter to generate the envelope shape and to use it to modulate the voice output. The NOTE_ON event triggers the transition from the INIT state to the ATTACK state. In the ATTACH state, the counter is increased of a quantity proportional to the attack value. Right before the counter overflows, the FSM goes into the DECAY state. This time, the same counter is decreased of the decay value until the sustain value is reached. Once in SUSTAIN mode, the FMS waits the key to be released (NOTE_OFF event) to proceed in the RELEASE state. In the RELEASE state, the counter is decreased until it gets to zero. If the key is released before the SUSTAIN state is reached, the FMS will jump into the RELEASE state. The generated output counter is then multiplied by the signal coming out of the mixer block generating the final modulation.

 

image

Output filter

The output filter is considered by many people as the most critical component of a synthesizer. It defines ultimately its final frequency content and usually distinguishes one synth from another. Many different filtering architectures and techniques for audio applications have been developed in the past decades. All these share the common need of controlling Resonance and Cut-off frequency in an independent way. The topology chosen for the tiny synth project is a second order low pass SVF (State Variable Filter), a quite known architecture for audio engineers which was originally developed in analog. The equivalent digital state variable filter was described in Hal Chamberlin’s Musical Applications of Microprocessors. The figure below shows the digital implementation of the Chamberlin SVF filter. The Filter was developed in VHDL using signed arithmetic.

imageThe Chamberlin State Variable Filter

 

NCA

The NCA (Numeric Controlled Amplifier) is the last block in the voice signal path. It first scales the signal with respect to the key velocity and then it modulates the output signal using the NCA ADSR envelope signal. This is done by multiplying the signal by the velocity value (of ADSR signal) and normalizing it by shifting the result.

Resource utilization and conclusions

The figure below shows the resource utilization after synthesis reported by Vivado. It is not surprising that the most used resources are BRAM and DSP modules. In fact, the BRAM is heavily used for the DDS wavetables (no compression applied) while the DSPs are required for filter calculation and NCA. Obviously, these resources are proportional to the number of instantiated voices. These resources could be relaxed by using code optimization techniques as well as resource sharing.

As an example, the SVF stage designed in a parallel form and therefore requiring three DSP modules per voice (three multiplications) could be designed in serial by sharing one DSP module. This would result in a drop of DSP modules by 66%.

At the beginning of the project, I decided to explore the capabilities of the DDS as a synthesis method. The drawback of this approach is that it requires a significant amount of memory to store the wavetables. However, the same oscillators (except the sinewave) could be implemented using simpler combinational and sequential logic. This would result in a significant decrease in BRAM utilization despite an increase of FFs (Flip Flops).

 

imageResource utilization summary (Vivado)

 

The project explored the possibility to fully implement a subtractive synthesizer in an FPGA. At the time the project was started, there was no commercial FPGA-based synth available on the market. Today, the first FPGA-based synths have been introduced with the Novation PEAK and the Waldorf Kyra being the two main products. While the first is based on a hybrid approach (digital oscillators, analog filter) the Kyra seems to be the first full FPGA synth based on DDS and virtualization of analog filtering. What is clear is that FPGAs will definitely find a place in the market for digital synths.

  • Sign in to reply

Top Comments

  • jc2048
    jc2048 over 6 years ago +3
    Nice project. Why do you call it 'additive' in the title when your text describes it as subtractive?
  • mdicosmo
    mdicosmo over 6 years ago in reply to jc2048 +3
    Jon I wrote it too quickly, of course it’s subtractive as explained later. I will fix the title. Thank you very much !
  • alisterw
    alisterw over 6 years ago +3
    Great! Neat project. I believe ' The NCA (Numeric Controlled Oscillator)' should be a Numerically Controlled Amplifier. So it gives an envelope to the output amplitude. I have some old AY-3-8910s in a…
  • mdicosmo
    mdicosmo over 6 years ago in reply to alisterw

    Nice catch Al, sorry for the typo, fixed. image

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • alisterw
    alisterw over 6 years ago

    Great! Neat project.

    I believe 'The NCA (Numeric Controlled Oscillator)' should be a Numerically Controlled Amplifier.

    So it gives an envelope to the output amplitude. I have some old AY-3-8910s in a drawer and these do something similar.

    A comment online is that even though these chips are no longer made, an unofficial VHDL description is available for FPGAs.

    ( Please excuse cut and paste changing the type size!)

     

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mdicosmo
    mdicosmo over 6 years ago in reply to jc2048

    Jon image I wrote it too quickly, of course it’s subtractive as explained later. I will fix the title. Thank you very much !

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • jc2048
    jc2048 over 6 years ago

    Nice project. Why do you call it 'additive' in the title when your text describes it as subtractive?

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube