Пример #1
0
 def _init(self):
     self.buffer = Buffer(self.audio_source.get_sample_rate(),
                          buffer_duration=1.0)
     self.spectrum_freq = self.audio_source.get_sample_rate(
     ) * np.fft.rfftfreq(self.buffer.buffer_len)
     self.spectrum_semitones_from_c0 = np.log2(
         self.spectrum_freq / FREQ_C0) * 12.0
Пример #2
0
 def _init(self):
     self.spectrum_analyzer = SpectrumAnalyzer(
         self.audio_source.get_sample_rate())
     self.pitch_tracker = PitchTracker()
     self.buffer = Buffer(self.audio_source.get_sample_rate(),
                          buffer_duration=20.0)
     self.note_tracker = NoteTracker()
Пример #3
0
class NotesTranscriber(SingleSourceApplication):
    def __init__(self, audio_source, update_output=update_console_output, **kvargs):
        super().__init__(audio_source, update_output, **kvargs)

    def _init(self):
        self.rms_processor = RmsProcessor()
        self.sound_splitter = SoundSplitter()
        self.band_peak_finder = BandPeakFinder(self.audio_source.get_sample_rate(), bands=SIX_STRINGS_GUITAR_BANDS)
        self.buffer = Buffer(self.audio_source.get_sample_rate(), buffer_duration=20.0)

    def _run_once(self, signals):
        signals.update(self.buffer.process(**signals))
        signals.update(self.rms_processor.process(**signals))
        signals.update(self.sound_splitter.process(**signals))
        signals.update(self.band_peak_finder.process(**self.remap(signals, {"source_signal": "split_sound"})))
Пример #4
0
class SongAnalyzer(SingleSourceApplication):
    def __init__(self,
                 audio_source,
                 update_output=update_console_output,
                 **kvargs):
        super().__init__(audio_source, update_output, **kvargs)

    def _init(self):
        self.buffer = Buffer(self.audio_source.get_sample_rate(),
                             buffer_duration=20.0)
        self.harmony_analyzer = HarmonyAnalyzer(
            self.audio_source.get_sample_rate())

    def _run_once(self, signals):
        signals.update(self.buffer.process(**signals))
        signals.update(self.harmony_analyzer.process(**signals))
Пример #5
0
class DefaultPlayerApplication(SingleSourceApplication):
    def __init__(self, audio_source, update_output, **kvargs):
        super().__init__(audio_source, update_output, **kvargs)

    def _init(self):
        self.buffer = Buffer(self.audio_source.get_sample_rate(),
                             buffer_duration=1.0)
        self.spectrum_freq = self.audio_source.get_sample_rate(
        ) * np.fft.rfftfreq(self.buffer.buffer_len)
        self.spectrum_semitones_from_c0 = np.log2(
            self.spectrum_freq / FREQ_C0) * 12.0

    def _run_once(self, signals):
        signals.update(self.buffer.process(**signals))
        spectrum = np.abs(np.fft.rfft(signals["buffered_signal"]))

        signals.update({
            "spectrum":
            spectrum,
            "spectrum_freq":
            self.spectrum_freq,
            "spectrum_semitones_from_c0":
            self.spectrum_semitones_from_c0
        })
Пример #6
0
class NotesTranscriber(SingleSourceApplication):
    def __init__(self,
                 audio_source,
                 update_output=update_console_output,
                 monophonic=False,
                 **kvargs):
        super().__init__(audio_source, update_output, **kvargs)
        self.monophonic = monophonic

    def _init(self):
        self.spectrum_analyzer = SpectrumAnalyzer(
            self.audio_source.get_sample_rate())
        self.pitch_tracker = PitchTracker()
        self.buffer = Buffer(self.audio_source.get_sample_rate(),
                             buffer_duration=20.0)
        self.note_tracker = NoteTracker()

    def _run_once(self, signals):
        signals.update(self.buffer.process(**signals))
        signals.update(self.spectrum_analyzer.process(**signals))
        if self.monophonic:
            signals["pitches"] = signals["pitches"][0:1]
        signals.update(self.pitch_tracker.process(**signals))
        signals.update(self.note_tracker.process(**signals))
Пример #7
0
 def _init(self):
     self.buffer = Buffer(self.audio_source.get_sample_rate(),
                          buffer_duration=20.0)
     self.harmony_analyzer = HarmonyAnalyzer(
         self.audio_source.get_sample_rate())
Пример #8
0
 def _init(self):
     self.rms_processor = RmsProcessor()
     self.sound_splitter = SoundSplitter()
     self.band_peak_finder = BandPeakFinder(self.audio_source.get_sample_rate(), bands=SIX_STRINGS_GUITAR_BANDS)
     self.buffer = Buffer(self.audio_source.get_sample_rate(), buffer_duration=20.0)