Skip to content

Quantization & Sampling notebook: plot_signal called with quantization_bits in the title slot (should be plot_audio) #10

Description

@jonfroehlich

Summary

In Tutorials/Signals - Quantization and Sampling.ipynb, many cells call makelab.signal.plot_signal(...) with quantization_bits passed as the third positional argument. But plot_signal's third positional parameter is title, not bit depth:

def plot_signal(s, sampling_rate, title=None, xlim_zoom=None, highlight_zoom_area=True):

So calls like:

makelab.signal.plot_signal(audio_data_16bit, sampling_rate, quantization_bits, xlim_zoom=xlim_zoom)

pass quantization_bits (an int) into the title slot. The chart title then renders as a bare number (e.g. 16) instead of a descriptive title.

Expected

The intended helper is almost certainly plot_audio, which does take quantization_bits and builds a "{bits}-bit, {rate} Hz audio" title:

def plot_audio(s, sampling_rate, quantization_bits=16, title=None, xlim_zoom=None, highlight_zoom_area=True):

(Note: plot_audio had a separate bug where it discarded its computed title — fixed in the makelab review work, see context below — so it now produces the correct title.)

Impact

  • Not a crash; the notebook still runs. The charts just show an unhelpful integer title instead of the bit-depth/sampling-rate description.
  • ~15 call sites in Tutorials/Signals - Quantization and Sampling.ipynb.

Proposed fix

Replace the affected plot_signal(..., quantization_bits, ...) calls with plot_audio(..., quantization_bits=quantization_bits, ...) (or pass an explicit title=). Then re-run the notebook (Restart & Run All, or the nbmake smoke test) to confirm titles render correctly.

Why this is a separate issue

This is a notebook-side bug. It was discovered during a review/cleanup of the makelab helper library (Tutorials/makelab/signal.py, audio.py), which was deliberately scoped to the .py files only. Filing separately so the notebook edit (which touches an nbmake-tested .ipynb) can be handled on its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions