Skip to content

feat(makie): implement spectrogram-mel#8422

Merged
MarkusNeusinger merged 6 commits into
mainfrom
implementation/spectrogram-mel/makie
Jun 3, 2026
Merged

feat(makie): implement spectrogram-mel#8422
MarkusNeusinger merged 6 commits into
mainfrom
implementation/spectrogram-mel/makie

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 3, 2026

Implementation: spectrogram-mel - julia/makie

Implements the julia/makie version of spectrogram-mel.

File: plots/spectrogram-mel/implementations/julia/makie.jl

Parent Issue: #4672


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jun 3, 2026

AI Review - Attempt 1/3

Image Description

Light render (plot-light.png): Warm off-white background (#FAF8F1) — correct. Title "C Major Scale · spectrogram-mel · julia · makie · anyplot.ai" in dark #1A1A17, clearly readable. Axis labels "Time (s)" and "Frequency (Hz)" dark and legible. Y-axis tick labels (50, 100, 200, 500, 1k, 2k, 4k, 8k) in INK_SOFT tone, all readable. Colorbar labeled "Power (dB)" with readable tick labels. The heatmap uses a blue (#4467A3 end) to green (#009E73 end) gradient: dark blue for the noise floor (~−80 dB) and bright green for signal peaks (~0 dB). Eight distinct note blocks are visible over 4 seconds; harmonic structure is concentrated below ~1 kHz, and the ascending/descending C major scale pattern is clearly discernible. All text is readable against the light background. Legibility verdict: PASS.

Dark render (plot-dark.png): Warm near-black background (#1A1A17) — correct. Title in light off-white, clearly readable against the dark background. Axis labels and tick labels in light grey (INK_SOFT #B8B7B0), all readable. Colorbar labels light-colored and readable. No dark-on-dark failures. Data colors are identical to the light render — same blue-to-green gradient; the note pattern and harmonic structure are visually identical. Legibility verdict: PASS.

Score: 85/100

Category Score Max
Visual Quality 27 30
Design Excellence 12 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 6 10
Total 85 100

Visual Quality (27/30)

  • VQ-01: Text Legibility (7/8) — All font sizes explicitly set (titlesize=20, labels=14, ticks=12); both themes readable; −1 for tight top margin leaving minimal breathing room between title and heatmap top edge
  • VQ-02: No Overlap (6/6) — No overlapping text; tick labels well-spaced; colorbar labels clear
  • VQ-03: Element Visibility (6/6) — Excellent contrast from dark blue noise floor to bright green signal peaks; 8 note blocks and harmonic structure clearly visible
  • VQ-04: Color Accessibility (2/2) — Blue-to-green gradient is CVD-safe; adequate luminance difference across full dB range
  • VQ-05: Layout & Canvas (3/4) — Good canvas utilization; colorbar well-positioned; −1 for tight top margin between title and plot top edge
  • VQ-06: Axis Labels & Title (2/2) — Time (s), Frequency (Hz), Power (dB) — all descriptive with units
  • VQ-07: Palette Compliance (1/2) — Uses the two correct Imprint palette stops (#4467A3 and #009E73) but in reversed direction: cgrad([#4467A3, #009E73]) instead of the canonical imprint_seq direction cgrad([#009E73, #4467A3]); backgrounds and chrome tokens are all correct

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (4/8) — Well-configured scientific presentation with correct Imprint colormap and theme tokens; does not rise above a well-configured library default
  • DE-02: Visual Refinement (4/6) — Grid correctly disabled (appropriate for heatmap); all four spines kept (correct for enclosed heatmap type); colorbar width 20px is narrow; missing explicit top-padding refinement
  • DE-03: Data Storytelling (4/6) — C major scale ascending/descending creates a clear, recognizable musical narrative; 8 note segments visible with harmonic depth; goes beyond raw data display

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct mel-spectrogram as 2D heatmap with mel-scaled frequency axis
  • SC-02: Required Features (4/4) — dB scale, sequential colormap, time x-axis, mel Hz y-axis labels, colorbar — all present
  • SC-03: Data Mapping (3/3) — Time on x, Frequency (Hz) on y, Power (dB) as color — all correct
  • SC-04: Title & Legend (3/3) — "C Major Scale · spectrogram-mel · julia · makie · anyplot.ai" — correct format with descriptive prefix

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Mel-scaled frequency axis, time evolution, harmonic structure, ADSR envelope dynamics, realistic note transitions
  • DQ-02: Realistic Context (5/5) — C major scale: classic, universally recognized musical pattern; neutral domain
  • DQ-03: Appropriate Scale (4/4) — SR=22050 Hz, 4s duration, 128 mel bands, dB range −80 to 0 — all standard audio engineering values

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — Linear: constants → helpers → synthesis → plot → save; no classes or functions
  • CQ-02: Reproducibility (2/2) — Random.seed!(42) set
  • CQ-03: Clean Imports (2/2) — CairoMakie, Colors, Random — all used
  • CQ-04: Code Elegance (2/2) — Clean Julia idioms; ADSR envelope concise; harmonic synthesis loop clear
  • CQ-05: Output & API (1/1) — Saves plot-$(THEME).png with px_per_unit=2

Library Mastery (6/10)

  • LM-01: Idiomatic Usage (4/5) — Uses heatmap!, Figure grid layout, Colorbar attachment, ax.yticks assignment, cgrad — all idiomatic Makie patterns
  • LM-02: Distinctive Features (2/5) — Uses Makie grid layout (fig[1,2]), cgrad, colorant"" literals; no truly distinctive Makie feature leveraged (custom recipes, WilkinsonTicks, explicit colorbar tick customization, etc.)

Score Caps Applied

  • None

Strengths

  • Fully spec-compliant mel-spectrogram with correct plot type, data mapping, and all required features (dB scale, mel Hz labels, colorbar)
  • Excellent synthesized C major scale data with realistic ADSR envelopes and harmonic overtone series — creates an immediately recognizable musical pattern in the spectrogram
  • Perfect palette/theme tokens applied throughout (INK, INK_SOFT, PAGE_BG) with full dark-mode readability — no dark-on-dark failures
  • Clean idiomatic Makie code: KISS structure, explicit font sizing, grid-off heatmap with correct 4-spine enclosure for the enclosed heatmap type

Weaknesses

  • Colormap direction is reversed from the canonical imprint_seq definition — code uses cgrad([colorant"#4467A3", colorant"#009E73"]) (blue→green = low→high power) instead of the canonical cgrad([colorant"#009E73", colorant"#4467A3"]) (green→blue); change to match the standard direction
  • Top margin between title and heatmap is very tight — the plot area starts almost immediately below the title with minimal breathing room; add top padding (e.g., rowgap!(fig.layout, 10) or increase Figure top margin via Figure(figure_padding=(10,10,20,10), ...))
  • LM-02 low: implementation does not leverage any truly distinctive Makie feature beyond basic heatmap + grid layout; consider using WilkinsonTicks for the colorbar, explicit ticks on the Colorbar, or a custom Colorbar styling with highclip/lowclip indicator colors

Issues Found

  1. VQ-07 PARTIAL: Colormap uses reversed imprint_seq direction
    • Fix: Change cgrad([colorant"#4467A3", colorant"#009E73"]) to cgrad([colorant"#009E73", colorant"#4467A3"]) to match the canonical imprint_seq definition (green→blue)
  2. VQ-05/VQ-01 MINOR: Tight top margin between title and heatmap top edge
    • Fix: Add rowgap!(fig.layout, 1, 8) or set Figure(figure_padding=(10, 10, 20, 10)) to give the title more breathing room
  3. LM-02 LOW: No distinctive Makie features beyond basic heatmap
    • Fix: Add WilkinsonTicks(5) on the colorbar or use highclip/lowclip colors on the Colorbar to indicate clipping at −80 dB and 0 dB boundaries

AI Feedback for Next Attempt

Three targeted fixes: (1) Reverse the colormap stops to match imprint_seq: cgrad([colorant"#009E73", colorant"#4467A3"]) — green→blue maps low→high power; (2) Add explicit top padding so the title has breathing room above the heatmap — try Figure(figure_padding=(10, 10, 20, 10)) or rowgap!; (3) To improve LM-02, add highclip = colorant"#009E73" and lowclip = colorant"#4467A3" on the Colorbar to visually indicate the dB clipping boundaries, which is a distinctive Makie-native feature. These three changes should push the score above 90.

Verdict: REJECTED

@github-actions github-actions Bot added quality:85 Quality score 85/100 ai-rejected Quality not OK, triggers update labels Jun 3, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Jun 3, 2026
Attempt 1/3 - fixes based on AI review
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented Jun 3, 2026

🔧 Repair Attempt 1/4

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jun 3, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): Warm off-white (#FAF8F1) background — correct for the light theme, not pure white. Title "C Major Scale · spectrogram-mel · julia · makie · anyplot.ai" rendered in dark #1A1A17 ink at titlesize=20; clearly readable. Axis labels "Time (s)" and "Frequency (Hz)" in dark ink with units. Y-axis tick labels show perceptually meaningful Hz landmarks (50, 100, 200, 500, 1k, 2k, 4k, 8k) in INK_SOFT dark grey. Colorbar on the right shows "Power (dB)" label and -80 to 0 dB range. The heatmap uses the imprint_seq gradient (green #009E73 at low power → blue #4467A3 at high power). Eight distinct vertical bands correspond to the 8 notes of the C major scale, with brighter green energy concentrated in the lower frequency region (100–1k Hz). All text is clearly readable against the warm off-white surface. No elements clipped.

Dark render (plot-dark.png): Warm near-black (#1A1A17) background — correct for the dark theme, not pure black. Title in light #F0EFE8 text, clearly readable against the dark surface. Axis labels and tick labels use INK_SOFT light grey (#B8B7B0) — all legible. Colorbar label and tick values are similarly light. The heatmap colors are identical to the light render — same green-to-blue imprint_seq gradient, same spectral pattern. Brand green #009E73 remains clearly visible on the dark surface. No dark-on-dark failures; every chrome element correctly adapts to the dark theme. No elements clipped.

Both paragraphs are required. A review that only describes one render is invalid.

Score: 88/100

Category Score Max
Visual Quality 29 30
Design Excellence 12 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 7 10
Total 88 100

Visual Quality (29/30)

  • VQ-01: Text Legibility (7/8) — All font sizes explicitly set; title, labels, and ticks readable in both themes; minor: colorbar tick labels slightly small but acceptable
  • VQ-02: No Overlap (6/6) — No overlapping text or data elements; colorbar well-separated
  • VQ-03: Element Visibility (6/6) — Heatmap gradient clearly distinguishable; spectral bands visible in both themes
  • VQ-04: Color Accessibility (2/2) — imprint_seq (green→blue) is CVD-safe; no red-green sole signal
  • VQ-05: Layout & Canvas (4/4) — Canvas gate passed (3200×1800); title ~60% width; colorbar well-proportioned
  • VQ-06: Axis Labels & Title (2/2) — "Time (s)" and "Frequency (Hz)" with units; title format correct with descriptive prefix
  • VQ-07: Palette Compliance (2/2) — imprint_seq used for continuous heatmap; backgrounds #FAF8F1/#1A1A17; both renders theme-correct

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (5/8) — Professional polish with Imprint sequential colormap; ADSR synthesis adds musical realism; clean layout; above default but no standout focal-point design emphasis
  • DE-02: Visual Refinement (3/6) — Grid disabled (correct for heatmap); 4-spine frame acceptable for enclosed heatmap per style guide exception; colorbar width optimized at 28pt
  • DE-03: Data Storytelling (4/6) — 8 distinct temporal note bands clearly visible; mel-scale gives perceptually meaningful axis; musical context provides narrative above default

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) — Correct mel-spectrogram with frequency warped to mel scale
  • SC-02: Required Features (4/4) — Sequential colormap, dB scale, colorbar in dB, mel-scale y-axis with Hz labels, time x-axis — all present
  • SC-03: Data Mapping (3/3) — X=time(s), Y=mel-scaled frequency with Hz labels, color=power(dB) — all correct
  • SC-04: Title & Legend (3/3) — "C Major Scale · spectrogram-mel · julia · makie · anyplot.ai" correct format; colorbar serves as legend

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — Mel filterbank, harmonic overtones, ADSR envelope, dB normalization — covers all mel-spectrogram aspects
  • DQ-02: Realistic Context (5/5) — Synthesized C major scale is realistic and musically neutral; appropriate audio ML context
  • DQ-03: Appropriate Scale (4/4) — 22050 Hz, 128 mel bands, 4 seconds, -80 to 0 dB range — all standard parameters

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — No functions or classes; clean sequential script
  • CQ-02: Reproducibility (2/2) — Random.seed!(42) present
  • CQ-03: Clean Imports (2/2) — Only CairoMakie, Colors, Random — all actually used
  • CQ-04: Code Elegance (2/2) — Clean implementation, no fake UI, appropriate complexity
  • CQ-05: Output & API (1/1) — Saves as plot-$(THEME).png with px_per_unit=2

Library Mastery (7/10)

  • LM-01: Idiomatic Usage (4/5) — heatmap!, Colorbar, Axis used idiomatically; WilkinsonTicks for auto tick selection; cgrad for colormap
  • LM-02: Distinctive Features (3/5) — WilkinsonTicks (Makie-specific auto-ticks), highclip/lowclip colormap clamping, cgrad gradient, colorant literal syntax — good Makie-specific usage above default

Score Caps Applied

  • None

Strengths

  • Correct imprint_seq colormap (green→blue) used for continuous heatmap data
  • Proper mel-scale frequency axis with perceptually meaningful Hz tick labels (50–8k)
  • Full theme-adaptive chrome with all INK/INK_SOFT tokens correctly wired to title, labels, spines, and colorbar
  • Synthesized C major scale with ADSR envelope and 14 harmonic overtones — realistic and domain-appropriate audio
  • WilkinsonTicks for clean colorbar tick selection, highclip/lowclip for colormap clamping (idiomatic Makie)
  • Correct canvas 3200×1800 (size=(1600,900) + px_per_unit=2)
  • dB normalization with peak at 0 dB and -80 dB floor — matches spec requirements exactly

Weaknesses

  • All 4 spines are shown (topspinecolor and rightspinecolor set) — acceptable for heatmaps per style guide exception but removing top/right (topspinevisible = false, rightspinevisible = false) would be cleaner
  • DE-01: Design is functional and polished but not highly sophisticated — no annotation layer or focal-point emphasis to guide the viewer through the musical pattern
  • DE-02: No further visual refinement applied beyond clean colormap and disabled grid

Issues Found

  1. DE-01 MODERATE: Good polish but lacks focal-point design to guide viewer through the C major scale pattern
    • Fix: Consider adding subtle vertical separators or note-onset markers to emphasize the 8-note temporal structure
  2. DE-02 MINOR: Top/right spines visible where style guide prefers L-shaped frame
    • Fix: Add topspinevisible = false, rightspinevisible = false (remove the topspinecolor/rightspinecolor settings)

AI Feedback for Next Attempt

Implementation is very strong overall. To improve: (1) remove top/right spines (topspinevisible = false, rightspinevisible = false) to match the L-shaped frame style guide preference — the 4-spine heatmap exception is acceptable but the L-frame looks cleaner; (2) consider adding subtle annotation or visual emphasis to highlight the note-onset boundaries and help viewers read the musical pattern — even simple vertical dashed lines at note transitions would add storytelling value.

Verdict: APPROVED

@github-actions github-actions Bot added quality:88 Quality score: 88/100 ai-approved Quality OK, ready for merge and removed quality:85 Quality score 85/100 labels Jun 3, 2026
@MarkusNeusinger MarkusNeusinger merged commit 786903a into main Jun 3, 2026
@MarkusNeusinger MarkusNeusinger deleted the implementation/spectrogram-mel/makie branch June 3, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge ai-attempt-1 First repair attempt quality:88 Quality score: 88/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant