Electric Potato
Well-known member
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:
https://vimeo.com/160510378
Comparison 2:
test sketch for those interested:
-epot
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:
https://vimeo.com/160510378
Comparison 2:
test sketch for those interested:
Code:
#include <Audio.h>
#include <SPI.h>
#include <Wire.h>
#include <SD.h>
//objects
AudioSynthWaveformSineModulated carrier1;
AudioEffectEnvelope carrier1Env;
AudioSynthWaveformSine mod1;
AudioMixer4 masterMix;
AudioOutputAnalog dac;
//connections
AudioConnection c1(carrier1,carrier1Env);
AudioConnection c2(carrier1Env,0,masterMix,0);
AudioConnection c3(mod1,carrier1);
AudioConnection xx(masterMix,dac);
float amp = 0.0;
void setup(){
AudioMemory(20);
carrier1.amplitude(1.0);
carrier1.frequency(220);
mod1.amplitude(0.0);
mod1.frequency(440);
carrier1Env.noteOn();
}
void loop(){
delay(250);
amp+=.05;
if(amp>1.0) amp = 0;
mod1.amplitude(amp);
}
Last edited: