Exemplo n.º 1
0
        public void Start(DetectionAlgorithm algorithm)
        {
            if (algorithm == DetectionAlgorithm.AUTOCORRELATION)
            {
                ptracker = new PitchTracker();
                ptracker.PitchDetected += ptracker_PitchDetected;
                ptracker.SampleRate = _microphone.SampleRate;
            }
            else if (algorithm == DetectionAlgorithm.YIN)
            {
                yin = new Yin(_microphone.SampleRate, _bufferSize/4);
            }

            _microphone.Start();
        }
Exemplo n.º 2
0
        public void Start(DetectionAlgorithm algorithm)
        {
            if (algorithm == DetectionAlgorithm.AUTOCORRELATION)
            {
                ptracker = new PitchTracker();
                ptracker.PitchDetected += ptracker_PitchDetected;
                ptracker.SampleRate     = _microphone.SampleRate;
            }
            else if (algorithm == DetectionAlgorithm.YIN)
            {
                yin = new Yin(_microphone.SampleRate, _bufferSize / 4);
            }

            _microphone.Start();
        }
Exemplo n.º 3
0
        public List <ImageDetection> RunDetector(Func <FitsImage, List <ImageDetection> > Detector, FitsImage Image, string DetectorName, DetectionAlgorithm Algo)
        {
            var Detections = Detector(Image);

            if (Detections.Count > MaxDetections)
            {
                LogMessage(DetectorName, "Too many detections. Check detector settings.");
                return(new List <ImageDetection>());
            }
            foreach (var d in Detections)
            {
                if (d.TryFetchProperty(out PairingProperties pp))
                {
                    pp.Algorithm = Algo;
                }
                else
                {
                    d.AppendProperty(new PairingProperties()
                    {
                        Algorithm = Algo
                    });
                }
            }

            AllDetections.AddRange(Detections);
            AllDetectionCenters.AddRange(Detections.Select((x) => x.Barycenter.EP));
            LogHookDetection(DetectorName, Detections.Count);
            return(Detections);
        }