Phasemodulation changes amplitude

Status
Not open for further replies.

janv

New member
Hi,

I searched around but couldn't find any info on this topic. When I modulate a AudioSynthWaveformModulated sine wave phase, for some reason the amplitude changes as well. I traced it back that altering the frequency of a sine also changes its amplitude (see commented piece in the main loop). Is this a bug?
I use a teensy 4.1 with audio shield.

unmodulated sine:
wave1.jpg

modulated sine:
wave2.jpg

Code:
#include <Audio.h>
#include <EEPROM.h>
#include <SD.h>
#include <SerialFlash.h>
#include <SPI.h>
#include <Wire.h>

AudioOutputI2S           i2s1;           //xy=640,161
AudioControlSGTL5000     sgtl5000_1;     //xy=517,297
AudioSynthWaveformModulated opMod = AudioSynthWaveformModulated();
AudioSynthWaveformModulated opCar = AudioSynthWaveformModulated();
AudioConnection          patchCord1(opMod, opCar);
AudioConnection          patchCord2(opCar, 0, i2s1, 0);
AudioConnection          patchCord3(opCar, 0, i2s1, 1);

int modPin         = 25;

void setup() {
  pinMode(modPin, INPUT);

  AudioMemory(10);

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.6);

  opMod.phaseModulation(180);
  opCar.phaseModulation(180);
  opMod.begin(WAVEFORM_SINE);
  opCar.begin(WAVEFORM_SINE);
  opMod.frequency(880);
  opCar.frequency(440);
  opMod.amplitude(1);
  opCar.amplitude(1);
}



void loop() {
  
  AudioNoInterrupts();
  opMod.amplitude((float)analogRead(modPin)/1023);

  //opMod.amplitude(0);
  //opCar.frequency(analogRead(modPin));
  AudioInterrupts();
  delay(100);
 
}
 
I did another test today to check the peak of the signal going in the audio shield (the peak module in the Audio lib). This does output '1' as is supposed to happen. I don't understand why I am seeing this on my scope, is the equalizer of the sound shield by default turned on?
 
Status
Not open for further replies.
Back
Top