Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChromaContext" /> class.
        /// </summary>
        /// <param name="algorithm">The algorithm to use, see <see cref="ChromaprintAlgorithm" /> (default = TEST2)</param>
        /// <param name="fftService">The FFT service.</param>
        public ChromaContext(ChromaprintAlgorithm algorithm, IFFTService fftService)
        {
            this.algorithm = (int)algorithm;

            var config = FingerprinterConfiguration.CreateConfiguration(algorithm);
            this.fingerprinter = new Fingerprinter(config, fftService);
        }
Exemplo n.º 2
0
        public Fingerprinter(FingerprinterConfiguration config, IFFTService fftService)
        {
            m_image = new Image(12);
            if (config == null)
            {
                config = new FingerprinterConfigurationTest1();
            }
            m_image_builder     = new ImageBuilder(m_image);
            m_chroma_normalizer = new ChromaNormalizer(m_image_builder);
            m_chroma_filter     = new ChromaFilter(config.FilterCoefficients, m_chroma_normalizer);
            m_chroma            = new Chroma(MIN_FREQ, MAX_FREQ, FRAME_SIZE, SAMPLE_RATE, m_chroma_filter);
            //m_chroma.set_interpolate(true);

            // TODO: inject IFFTService
            m_fft = new FFT(FRAME_SIZE, OVERLAP, m_chroma, fftService);
            if (config.RemoveSilence)
            {
                m_silence_remover           = new SilenceRemover(m_fft);
                m_silence_remover.Threshold = config.SilenceThreshold;
                m_audio_processor           = new AudioProcessor(SAMPLE_RATE, m_silence_remover);
            }
            else
            {
                m_silence_remover = null;
                m_audio_processor = new AudioProcessor(SAMPLE_RATE, m_fft);
            }
            m_fingerprint_calculator = new FingerprintCalculator(config.Classifiers);
            m_config = config;
        }
Exemplo n.º 3
0
        public Fingerprinter(FingerprinterConfiguration config, IFFTService fftService)
        {
            m_image = new Image(12);
            if (config == null)
            {
                config = new FingerprinterConfigurationTest1();
            }
            m_image_builder = new ImageBuilder(m_image);
            m_chroma_normalizer = new ChromaNormalizer(m_image_builder);
            m_chroma_filter = new ChromaFilter(config.FilterCoefficients, m_chroma_normalizer);
            m_chroma = new Chroma(MIN_FREQ, MAX_FREQ, FRAME_SIZE, SAMPLE_RATE, m_chroma_filter);
            //m_chroma.set_interpolate(true);

            // TODO: inject IFFTService
            m_fft = new FFT(FRAME_SIZE, OVERLAP, m_chroma, fftService);
            if (config.RemoveSilence)
            {
                m_silence_remover = new SilenceRemover(m_fft);
                m_silence_remover.Threshold = config.SilenceThreshold;
                m_audio_processor = new AudioProcessor(SAMPLE_RATE, m_silence_remover);
            }
            else
            {
                m_silence_remover = null;
                m_audio_processor = new AudioProcessor(SAMPLE_RATE, m_fft);
            }
            m_fingerprint_calculator = new FingerprintCalculator(config.Classifiers);
            m_config = config;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChromaContext" /> class.
        /// </summary>
        /// <param name="algorithm">The algorithm to use, see <see cref="ChromaprintAlgorithm" /> (default = TEST2)</param>
        /// <param name="fftService">The FFT service.</param>
        public ChromaContext(ChromaprintAlgorithm algorithm, IFFTService fftService)
        {
            this.Algorithm  = (int)algorithm;
            this.fftService = fftService;

            var config = FingerprinterConfiguration.CreateConfiguration(algorithm);

            this.fingerprinter = new Fingerprinter(config, fftService);
        }
Exemplo n.º 5
0
        public FFT(int frame_size, int overlap, IFFTFrameConsumer consumer, IFFTService fftService)
        {
            m_window        = new double[frame_size];
            m_buffer_offset = 0;
            m_buffer        = new short[frame_size];
            m_frame         = new FFTFrame(frame_size);
            m_frame_size    = frame_size;
            m_increment     = frame_size - overlap;
            m_consumer      = consumer;

            Helper.PrepareHammingWindow(ref m_window, 0, frame_size);
            for (int i = 0; i < frame_size; i++)
            {
                m_window[i] /= short.MaxValue;
            }

            m_lib = fftService;
            m_lib.Initialize(frame_size, m_window);

            m_input = new short[frame_size];
        }
Exemplo n.º 6
0
        public FFT(int frame_size, int overlap, IFFTFrameConsumer consumer, IFFTService fftService)
        {
            m_window = new double[frame_size];
            m_buffer_offset = 0;
            m_buffer = new short[frame_size];
            m_frame = new FFTFrame(frame_size);
            m_frame_size = frame_size;
            m_increment = frame_size - overlap;
            m_consumer = consumer;

            Helper.PrepareHammingWindow(ref m_window, 0, frame_size);
            for (int i = 0; i < frame_size; i++)
            {
                m_window[i] /= short.MaxValue;
            }

            m_lib = fftService;
            m_lib.Initialize(frame_size, m_window);

            m_input = new short[frame_size];
        }
 public DerivedSpectrumService(IFFTService fftService, ILogUtility logUtility)
     : base(fftService, logUtility)
 {
 }
 internal SpectrumService(IFFTService fftService, ILogUtility logUtility)
 {
     this.fftService = fftService;
     this.logUtility = logUtility;
 }
 public SpectrumService(IFFTService fftService)
     : this(fftService, DependencyResolver.Current.Get<ILogUtility>())
 {
 }
Exemplo n.º 10
0
 public SpectrumService(IFFTService fftService)
 {
     this.fftService = fftService;
 }
Exemplo n.º 11
0
 internal SpectrumService(IFFTService fftService, ILogUtility logUtility)
 {
     this.fftService = fftService;
     this.logUtility = logUtility;
 }
Exemplo n.º 12
0
 public SpectrumService(IFFTService fftService)
     : this(fftService, DependencyResolver.Current.Get <ILogUtility>())
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromaContext" /> class.
 /// </summary>
 /// <param name="fftService">The FFT service.</param>
 public ChromaContext(IFFTService fftService)
     : this(ChromaprintAlgorithm.TEST2, fftService)
 {
 }
 public SimpleSpectrumService(IFFTService fftService)
 {
     this.fftService = fftService;
 }
Exemplo n.º 15
0
 private SpectrumService(IFFTService fftService, ILogUtility logUtility, IAudioSamplesNormalizer audioSamplesNormalizer)
 {
     this.fftService             = fftService;
     this.logUtility             = logUtility;
     this.audioSamplesNormalizer = audioSamplesNormalizer;
 }
Exemplo n.º 16
0
 internal SpectrumService(IFFTService fftService, ILogUtility logUtility, IAudioSamplesNormalizer audioSamplesNormalizer)
 {
     this.fftService = fftService;
     this.logUtility = logUtility;
     this.audioSamplesNormalizer = audioSamplesNormalizer;
 }
Exemplo n.º 17
0
 public SpectrumService(IFFTService fftService)
     : this(fftService, DependencyResolver.Current.Get<ILogUtility>(), DependencyResolver.Current.Get<IAudioSamplesNormalizer>())
 {
 }
Exemplo n.º 18
0
 public FFTController(ISignalGeneratorService signalGenerator,
                      IFFTService fftService)
 {
     _signalGenerator = signalGenerator;
     _fftService      = fftService;
 }
 public DerivedSpectrumService(IFFTService fftService, ILogUtility logUtility)
     : base(fftService, logUtility)
 {
 }
Exemplo n.º 20
0
 public SpectrumService(IFFTService fftService)
     : this(fftService, DependencyResolver.Current.Get <ILogUtility>(), DependencyResolver.Current.Get <IAudioSamplesNormalizer>())
 {
 }
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChromaContext" /> class.
 /// </summary>
 /// <param name="fftService">The FFT service.</param>
 public ChromaContext(IFFTService fftService)
     : this(ChromaprintAlgorithm.TEST2, fftService)
 {
 }
 public AdafruitLedService(ICommunicationService communicationService, IFFTService fftService)
 {
     this.communicationService = communicationService;
     this.fftService           = fftService;
 }