jdxi_editor.audio.audio_analyser ================================ .. py:module:: jdxi_editor.audio.audio_analyser .. autoapi-nested-parse:: Turn the newest samples into one snapshot, off the capture callback. The worker thread reads the ring. The window only ever reads :meth:`AudioAnalyser.latest_snapshot`. Classes ------- .. autoapisummary:: jdxi_editor.audio.audio_analyser.AudioAnalyser Module Contents --------------- .. py:class:: AudioAnalyser(ring: jdxi_editor.audio.audio_buffer.SampleRing, sample_rate: int = SAMPLE_RATE, columns: int = WAVEFORM_COLUMNS) Coordinates the three measurements and publishes the latest snapshot. .. py:attribute:: ring .. py:attribute:: sample_rate :value: 48000 .. py:attribute:: columns :value: 480 .. py:attribute:: timebase_ms :value: 20 .. py:attribute:: vu .. py:attribute:: spectrum .. py:attribute:: _snapshot :type: Optional[jdxi_editor.audio.audio_snapshot.AudioSnapshot] :value: None .. py:attribute:: _consumed :value: 0 .. py:attribute:: _last_time :type: Optional[float] :value: None .. py:attribute:: _stop .. py:attribute:: _thread :type: Optional[threading.Thread] :value: None .. py:method:: set_sample_rate(sample_rate: int) -> None The rate the input actually opened at. Call while stopped: the timebase window and the spectrum's frequency axis are both measured in samples. :param sample_rate: int Hz :return: None .. py:method:: set_timebase(timebase_ms: int) -> None How much of the waveform the oscilloscope shows. :param timebase_ms: int one of the waveform timebases :return: None .. py:method:: latest_snapshot() -> Optional[jdxi_editor.audio.audio_snapshot.AudioSnapshot] The newest snapshot, or None before the first block. :return: Optional[AudioSnapshot] .. py:method:: analyse_available(now: Optional[float] = None) -> Optional[jdxi_editor.audio.audio_snapshot.AudioSnapshot] Measure whatever has arrived since the previous call. :param now: Optional[float] monotonic seconds, for tests :return: Optional[AudioSnapshot] .. py:method:: start() -> None Analyse on a background thread at the display rate. :return: None .. py:method:: stop() -> None Stop the background thread. :return: None .. py:method:: _loop() -> None .. py:method:: _since(previous: int) -> tuple[numpy.ndarray, int]