Wideband autonomous SDR analysis engine forked from sdr-visual-suite
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

28 строки
525B

  1. package demod
  2. import "math"
  3. type CW struct{}
  4. func (CW) Name() string { return "CW" }
  5. func (CW) OutputSampleRate() int { return 48000 }
  6. func (CW) Demod(iq []complex64, sampleRate int) []float32 {
  7. if len(iq) == 0 {
  8. return nil
  9. }
  10. out := make([]float32, len(iq))
  11. bfo := 700.0
  12. phase := 0.0
  13. inc := 2 * math.Pi * bfo / float64(sampleRate)
  14. for i := 0; i < len(iq); i++ {
  15. phase += inc
  16. c := math.Cos(phase)
  17. v := iq[i]
  18. out[i] = float32(float64(real(v)) * c)
  19. }
  20. return out
  21. }
  22. func init() { Register(CW{}) }