home.social

#fmsynthesis — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #fmsynthesis, aggregated by home.social.

  1. New FM synth added to the Mercury Playground @mercury, coded with a single AudioWorkletProcessor inside a ToneAudioNode from ToneJS

    mercury-playground.cc/#Ly8gPT0

    It's a basic FM with a single modulator-(envelope)->carrier setup, and can be extended with extra voices and detuning to run 2-3 or more operators.

    Syntax: `new synth fm index() ratio() fmShape()`

    Some tutorials available on the website

    #mercurylivecoding #fmsynthesis #webaudio #audioworkletprocessor #javascript #mercury #browserbased

  2. Klaus P. Rausch provides you with information about his book „DX Story“:
    mis.backintimerecords.de/dx-st
    FM synthesis - the magic formula for the #sound of the #80s

    #fmsynthesis #dx7

  3. I’m continuing my look into the ESP32 and PWM. This time I’m adding in some analog control to introduce an element of frequency modulation to the synthesis.

    • Part 1 – All the theory and research around PWM and the ESP32.
    • Part 2 – Generating different waveforms on multiple channels.
    • Part 3 – Introducing analog control and frequency modulation.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers, see the Getting Started pages.

    Parts list

    • ESP32 WROOM Module
    • 3x 1kΩ resistor
    • 2x 10kΩ potentiometers
    • 1x 10uF electrolytic capacitor
    • 2x 100nF capacitor
    • 1x TRS socket
    • Breadboard and jumper wires

    The Circuit

    This expands on the previous circuit to allow me to feed back the output of one of the PWM channels into an analog input controlling the other.

    It also allows the use of two potentiometers to control the frequencies independently.

    It’s not very easy to see what is going on with the Fritzing diagram, but there are essentially four circuits in play here.

    The first is the PWM filter and audio output stage from parts 1 and 2. This takes the 0-3V3 PWM signal and turns it into a more audio friendly +/- 800mV (ish) signal.

    The second is the PWM filter stage but without the voltage divider to reduce the pp voltage and without the coupling capacitor to remove the DC offset. The output of this is therefore a waveform with a 0-3V3 sweep. I’m leaving it like this as I want to be able to use it as a control voltage for an analog input stage, which brings me on to…

    The third is a simple potentiometer connected to one of the analog inputs.

    The last is another potentiometer input but that can also be modulated by the output of the second PWM signal – the 0-3V3 one.

    Now I think I’m ok to connect the output of the PWM stage to the input in the way shown above, but at this stage it might be a good time to remind you I’m not an electronics person and it is best to assume I don’t know what I’m doing. I’m using cheap development boards and effectively throw-away amplification, so am feeling quite free to experiment.

    I don’t believe there is any way to connect a high signal source to a low signal sink without going through a resistor to limit current, so I think this is ok for this kind of experiment. Basically I don’t think I’m slowly cooking my ESP32, but don’t take my word for it…

    Naturally if this was accepting any kind of input signal from elsewhere some kind of protection circuitry would be required and I’ve given no consideration here to things like impedance. This is me messing around – nothing more, but if you can see something wrong in what I’m saying feel free to let me know in the comments.

    ESP32 GPIO Usage:

    • GPIO13 – Sine wave output – connected to the audio output.
    • GPIO12 – Saw wave output – not used above.
    • GPIO14 – Triangle wave output – connected to the analog input for the sine wave.
    • GPIO27 – Square wave output – not used above.
    • GPIO39 – Analog input to control triangle/square wave frequency.
    • GPIO36 – Analog input to control sine/saw wave frequency.

    The Code

    This is still using four separate PWM outputs but I’ve added in potentiometer control for them in pairs. As described above there is one pot to control the frequency of the sine/saw waves and one for the frequency of the triangle/square waves. But as also already stated, the sine/saw frequency can also be modulated by the triangle wave output.

    The key feature to get this working is to use an analog reading as an input to the setFreq() function from before for the individual channels.

    My loop, which was previously empty, now looks like this.

    #define NUM_ADC_PINS 2
    int adc_pins[NUM_ADC_PINS] = {36, 39};
    uint16_t adcval[NUM_ADC_PINS];

    void loop () {
    for (int i=0; i<NUM_ADC_PINS; i++) {
    uint16_t algval = analogRead(adc_pins[i]);
    if (algval != adcval[i]) {
    setPotFreq(i, algval);
    }
    adcval[i] = algval;
    }
    }

    I’ve just added in some mapping via the setPotFreq() function to determine which PWM pins are associated with which potentiometer.

    int pot2pwm[NUM_PWM_PINS] = {0,0,1,1};

    void setPotFreq (int pot, unsigned freq) {
    for (int i=0; i<NUM_PWM_PINS; i++) {
    if (pot2pwm[i] == pot) {
    setPwmFreq(i, freq);
    }
    }
    }

    To change which PWM channels map to which pots, just update the pot2pwm[] array of values. To have four pots and each channel independent is just a case of adding the two extra pins to the adc_pins[] array and then updating pot2pwm to be {0,1,2,3}.

    I’ve not gone that far as I wasn’t too fussed about adding the extra circuitry required – my solderless breadboard is getting a little crowded as it is.

    I’m using the “simple” analogRead() functionality which is fully Arduino compatible, albeit with a higher resolution (12-bits). The ESP32 also has the option for a faster, continuous reading of the ADCs via a “Continuous mode driver”. More details can be found here. I did wonder about experimenting with that at some point. It is interesting to consider if that could sample at a similar frequency to the PWM output, giving the possibility of some kind of audio processing, but that is a set of experiments for another day.

    I’ve also seen mention of using the I2S driver with the ADC or DAC, but I must admit I don’t quite understand what is being said there. Another thing added to the “to be read/researched” pile.

    But I’ve kept it simple for now and that seems to have done the trick.

    Find it on GitHub here.

    Closing Thoughts

    As can be seen in the video it is possible to get quite an interesting range of sounds out of this already!

    The obvious question in all this is why the external electrical feedback from one wave output to the other? That is the kind of thing that can be relatively simply done in software. Indeed, the Mozzi FM synthesis code I used in ESP32 and Mozzi does exactly that and more!

    In truth, I quite liked the idea of having more of a “virtual modular” feel in that the ESP32 can have several functions, in this case control voltage inputs and voltage-to-digitally controlled oscillators, that could be patched together using jumper wires.

    I’m not sure where I’m going next, but an obvious next step might be some kind of envelope generation using the DAC outputs to modulate the PWM audio.

    I really ought to do some proper thinking about those component values though. The filters are working at the frequencies I’m messing around with at the moment, but I’ve not really done any proper calculations to see what the optimal values ought to be. And it would be useful to include a little protection on the inputs and possibly some buffering on the outputs. At best I’m being rather simplistic and somewhat optimistic in my approach so far.

    But this is the point (as I’ve said before) where I really need some kind of audio experimenters PCB, which I’m already sort of chewing over in the background. Watch this space.

    Kevin

    https://diyelectromusic.wordpress.com/2024/04/03/esp32-and-pwm-part-3/

    #dds #esp32 #fmSynthesis #pwm #wavetable

  4. Space Harrier Theme on Japanese Master System Hardware
    Fact 1: the Japanese version of the Master System had an add on that provided FM synthesis sound synthesis, and greatly improved its music. Many US-released games have support for the add-on, but it was never released over here so that featur
    setsideb.com/space-harrier-the
    #retro #audio #bios #fmsynthesis #markiii #mastersystem #retro #sega #sms #spaceharrier #startup #video #youtube

  5. Arduino Audio and MIDI Frameworks

    I’ve been collecting bookmarks for interesting Arduino audio projects for a while now, and having now played with the XIAO SAMD21 I started looking back over my list for other things to try.  One thing that occurred to me is that there are a now a number of more powerful audio frameworks available for a range of microcontrollers, so in this post I’m doing an introductory “look see” at some of them, largely as “notes to self” to come back to them for some more detailed projects in the future.

    Note: Many of these require a 32-bit processor, which is one of the reasons I’ve not looked at them so far.

    Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

    If you are new to microcontrollers, see the Getting Started pages.

    Mozzi

    I’ve spent quite a bit of time with Mozzi of course, the synthesis library for Arduino that supports a large range of microcontrollers, including the “original” 8-bit Arduino ATmega328P, so I won’t go over that again here.

    For a starting point with Mozzi, see: Arduino PWM MIDI Synthesis with Mozzi.  For using Mozzi on a 32-bit SAMD processor, there is more here and here.

    But Mozzi isn’t the only game in town, especially if we’re expanding out to 32-bit microcontrollers.

    The Arduino Sound Library

    https://www.arduino.cc/reference/en/libraries/arduinosound/

    This is an official Arduino library that supports SAMD21 based microcontrollers using an I2S digital to analog converter. It is designed for the MKR series of official Arduino boards.

    Interestingly it appears to only support I2S audio devices for sound input and output.  That seems like a little bit of a missed opportunity to me in that the SAMD21 has a built-in DAC, but I guess analogWrite() deals with access to the DAC relatively easily.

    It is designed for official Arduino SAMD architecture boards – so those in the MKR series.  It might work on other SAMD architecture boards, I haven’t looked into it in detail.

    Phil Schatzmann’s Arduino Audio Tools

    https://github.com/pschatzmann/arduino-audio-tools

    This is a suite of open source code for audio stream processing, providing a range of audio sources (e.g. microphones, Internet streams, files, sensors, and so on) and sinks (e.g. DACs, PWM audio, MP3, codecs, audio modules, etc).

    It can be used to build audio players, processors, effects, file processors, audio visualisers, networked audio tools, and so on.

    I believe it supports the following microcontroller architectures:

    • ESP32 (S and C variants)
    • ESP8266
    • RP2040 (MBED and non-MBED)
    • AVR
    • STM32
    • SAMD

    It supports several audio output boards too, including: ESP32-A1S based boards (ES8388 or AC101 codecs); VS1053 modules; and WM8960 modules.

    I believe this is a library for audio processing, not necessarily audio synthesis.

    Marcel Licence’s ML Synth Tools

    https://github.com/marcel-licence/ML_SynthTools

    This is a comprehensive synth library for producing synthesizers, organs and effects.  Most of the code is open source, but there are certain key elements that are provided only in pre-built library form.

    It provides libraries for the following microcontrollers:

    • ESP32
    • ESP8266
    • XIAO SAMD21
    • Teensy 4.1
    • Daisy Seed
    • Raspberry Pi Pico RP2040
    • STM32F407

    As well as the synthesizer core oscillators there are modules for arpeggiators, effects, meters, scopes, and MIDI file playing.  Here are some example builds using the library:

    Although it isn’t fully open source, this non-the-less looks like it would be worth taking a more detailed look.  The provided videos of Marcel playing are particularly excellent.

    MIDI Controller Libraries

    There are a number of Arduino libraries for building MIDI controllers. Here are a selection of some that I’ve found so far.

    OpenDesk MIDI Platformhttps://github.com/shanteacontrols/OpenDeck

    This is a set of firmware and two official PCB designs for MIDI controllers. In addition to the official boards, it also supports many microcontrollers, including:

    • Arduino Mega 2560
    • Arduino Nano 33 BLE
    • Raspberry Pi Pico
    • XIAO RP2040
    • Teensy++ 2.0

    And many others. It includes a web-based configuration utility for defining the MIDI commands for the controls.  Official boards are available on Tindie and you can read more about them here: https://shanteacontrols.com/.

    It supports a range of buttons, encoders, potentiometers, force sensitive resistors, certain touchscreens and can provided feedback using LEDs and displays.

    Control Surfacehttps://github.com/tttapa/Control-Surface

    This is a general purpose library for building MIDI input and output control devices.  It supports a wide range of microcontrollers, including:

    • AVR (Uno, Mega, Leonardo).
    • Arduino Nano Every and 33.
    • Teensy.
    • ESP8266
    • ESP32
    • Raspberry Pi Pico

    It supports a range of MIDI transports, including serial, USB, “direct serial” (using Hairless MIDI) and MIDI BLE. It also supports a range of buttons, potentiometers, rotary encoders, switches, keyboard matrices, and so on and can provide visual feedback using a range of LEDS and displays.  It has built-in support for multiplexers, shift registers and LED drivers.

    It includes a huge number of example projects to browse.

    MIDIPalhttps://github.com/pichenettes/midipal

    This is a “MIDI Swiss Army Knife” that, with the additional of a display and rotary encoder, can provide a wide range of MIDI processing functions.  It includes an editor application for programming MIDI filters.

    This is a “native” AVR application, not for the Arduino environment.

    Notes and Volts MIDI Controllerhttps://www.notesandvolts.com/2016/04/arduino-midi-controller-buttons.html

    This is provided for completeness as it is a fairly common codebase for people to find and use with an Arduino. It supports a range of potentiometers and buttons and makes the task of configuring them as a MIDI control device relatively straight forward.

    Closing Thoughts

    As I say, this post is really almost a bit of a “to-do list” of things that look interesting and that I might try to take a more detailed look at, at some point.

    If you have experience of any of these frameworks or libraries; or have suggestions of others that might be worth a look, do let me know in the comments!

    Kevin

    #ArduinoAudioTools #ControlSurface #dac #esp32 #fmSynthesis #i2s #midi #midiController #MIDIPal #MLSynthTools #mozzi #OpenDesk #pwm #rp2040 #samd21 #synthesis #xiao
  6. Recreating the Sounds of the ’90s With a YM3812 Synthesizer - One reason the x86 PC became the dominant game platform in the early 1990s was the... - hackaday.com/2022/12/07/recrea #euroracksynth #musicalhacks #fmsynthesis #ym3812 #opl2