Ejemplo n.º 1
0
 public static Signal DeModulate(Signal PassBand, float carrier_frequency, float threshold = 0)
 {
     Signal ccarrier = new Sinusoidal(carrier_frequency, 0, -1, 1, PassBand.Samples.Length); // generate coherent carrier
     Signal demod = ccarrier * PassBand; // multiply the carrier and the passband signal
     var s = demod.Samples.Split((int)PassBand.SamplingRate);
     bool[] bits = new bool[s.Count()];
     int j = 0;
     foreach (var item in s)
     {
         var sm = item.Sum();
         bits[j] = sm > threshold;
         j++;
     }
     return new BinaryData(bits, demod.Samples.Length);
 }
Ejemplo n.º 2
0
 public static Signal BFSK_DeModulate(Signal passband, float f1, float f2, float threshold = 10)
 {
     Sinusoidal c = new Sinusoidal(f1, 0, passband.SamplingRate, 1, passband.Samples.Length);
     Signal demod = passband * c;
     var s = demod.Samples.Split((int)passband.SamplingRate);
     bool[] bits = new bool[s.Count()];
     int j = 0;
     foreach (var item in s)
     {
         var sm = item.Sum();
         bits[j] = sm > threshold;
         j++;
     }
     return new BinaryData(bits, demod.Samples.Length);
 }
Ejemplo n.º 3
0
 public static Signal Modulate(Signal Baseband, float CarrierFrequency, float CarrierAmplitude = 1)
 {
     Signal Carrier = new Sinusoidal(CarrierFrequency, 0, Baseband.SamplingRate, 1, Baseband.Samples.Length);
     return Baseband * Carrier;
 }