Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: Teensy FM Synthesis Problems, not enough modulation

Threaded View

  1. #1

    Teensy FM Synthesis Problems, not enough modulation

    Hey gang,

    I've been trying to implement some algorithms from yamaha's DX7 on Teensy 3.1 using its sineModulated object but have had difficulty getting
    the correct results. After a lot of testing, it seems like there is something off in the way that the Audio library is computing the modulations on its 'AudioSynthWaveformSineModulated' object. I have attached two videos which attempt to illustrate this problem. Comparison 2 is probably the most informative, as it demonstrates the expected results of fm modulation contrasted with the current output the Audio library is producing. With a simple modulator to carrier routing, you should be able to easily visualize how the mod signal is carving out new peaks and valleys in the carrier waveform, but in Teensy 3.1 it is changing the waveform in a weird way. I assume that the problem is occurring in 'synth_sine.cpp' and/or 'synth_sine.h' but am not sure what exactly to fiddle around with. From an acoustic perspective, the result of modulating a sineModulated object does sound fm-synthy up to a point, but it can't even come close to generating the full range of higher frequency harmonics (demonstrated in Comparison 1).

    I've attached a barebones test sketch for anyone who wants to investigate this, just so you don't have to set up the audio connections yourself, but I should emphasize that this appears to be a fundamental problem with the library code, not anything relating to a particular sketch. Anyway, I hope someone can straighten this out, because a pocket sized FM synth would be pretty badass.

    Comparison 1:
    Comparison 2:

    test sketch for those interested:
    #include <Audio.h>
    #include <SPI.h>
    #include <Wire.h>
    #include <SD.h>
    AudioSynthWaveformSineModulated carrier1;
    AudioEffectEnvelope             carrier1Env;
    AudioSynthWaveformSine          mod1;
    AudioMixer4                     masterMix;
    AudioOutputAnalog               dac;
    AudioConnection                 c1(carrier1,carrier1Env);
    AudioConnection                 c2(carrier1Env,0,masterMix,0);
    AudioConnection                 c3(mod1,carrier1);
    AudioConnection                 xx(masterMix,dac);
    float amp = 0.0;
    void setup(){
    void loop(){
      if(amp>1.0) amp = 0;
    Last edited by Electric Potato; 03-31-2016 at 03:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts