private void modulateButton_Click(object sender, EventArgs e) { var carrierFrequency = float.Parse(carrierFrequencyTextBox.Text); var carrierAmplitude = 1.0f; var modulationFrequency = float.Parse(modulationFrequencyTextBox.Text); var modulationIndex = float.Parse(modulationIndexTextBox.Text); var carrier = new CosineBuilder() .SetParameter("min", -carrierAmplitude) .SetParameter("max", carrierAmplitude) .SetParameter("freq", carrierFrequency) .OfLength(1024) .SampledAt(16000) .Build(); var baseband = new CosineBuilder() .SetParameter("min", -modulationIndex) .SetParameter("max", modulationIndex) .SetParameter("freq", modulationFrequency) .OfLength(1024) .SampledAt(16000) .Build(); switch (_modulationMode) { case ModulationMode.Frequency: _modulated = _modulator.Frequency(baseband, carrierAmplitude, carrierFrequency); break; case ModulationMode.Phase: _modulated = _modulator.Phase(baseband, carrierAmplitude, carrierFrequency); break; default: _modulated = _modulator.Amplitude(carrier, modulationFrequency, modulationIndex); break; } modulatedPlot.Line = _modulated.Samples; modulatedPlot.Markline = baseband.Samples; }