From 4bf1ddbca19c6c0c2d8790f730410fefe73139f9 Mon Sep 17 00:00:00 2001 From: Boof2015 <75185879+Boof2015@users.noreply.github.com> Date: Thu, 7 May 2026 17:11:08 -0400 Subject: [PATCH] Improve spectrogram --- src/renderer/components/ScopeModule.tsx | 1 + .../components/ScopeSettingsSection.tsx | 16 +++++++ src/renderer/visualizers/Spectrogram.ts | 46 ++++++++++++++----- src/types/settings.ts | 5 +- src/types/spectrogram.ts | 15 ++++++ 5 files changed, 70 insertions(+), 13 deletions(-) diff --git a/src/renderer/components/ScopeModule.tsx b/src/renderer/components/ScopeModule.tsx index e817c61..67cf657 100644 --- a/src/renderer/components/ScopeModule.tsx +++ b/src/renderer/components/ScopeModule.tsx @@ -248,6 +248,7 @@ export function scopeSettingsToOptions( backgroundColor: t.background, fftSize: s.fftSize, scrollSpeed: s.scrollSpeed, + contrast: s.contrast, clarityMode: s.clarityMode, scaleMode: s.scaleMode, colorScheme: s.colorScheme, diff --git a/src/renderer/components/ScopeSettingsSection.tsx b/src/renderer/components/ScopeSettingsSection.tsx index 6e9189f..b4372e8 100644 --- a/src/renderer/components/ScopeSettingsSection.tsx +++ b/src/renderer/components/ScopeSettingsSection.tsx @@ -2,6 +2,11 @@ import { useState, type CSSProperties, type JSX, type ReactNode } from 'react' import type { ScopeKind } from '../../types/scope' import { SCOPE_LABELS } from '../../types/scope' import type { ScopeSettings } from '../../types/settings' +import { + MAX_SPECTROGRAM_CONTRAST, + MIN_SPECTROGRAM_CONTRAST, + SPECTROGRAM_CONTRAST_STEP, +} from '../../types/spectrogram' import { DEFAULT_VU_REFERENCE_DBFS, VU_REFERENCE_MAX_DBFS, @@ -531,6 +536,17 @@ export default function ScopeSettingsSection({ fullWidth={false} onChange={(value) => onUpdate('spectrogram', { scrollSpeed: value })} /> + + onUpdate('spectrogram', { contrast: value })} + /> ) })()} diff --git a/src/renderer/visualizers/Spectrogram.ts b/src/renderer/visualizers/Spectrogram.ts index 9749aef..3be7c26 100644 --- a/src/renderer/visualizers/Spectrogram.ts +++ b/src/renderer/visualizers/Spectrogram.ts @@ -5,8 +5,10 @@ import { FrameScheduler } from './frameScheduler' import { VisualizerFrameLoop } from './visualizerFrameLoop' import { DEFAULT_SPECTROGRAM_CLARITY_MODE, + DEFAULT_SPECTROGRAM_CONTRAST, DEFAULT_SPECTROGRAM_SCALE_MODE, DEFAULT_SPECTROGRAM_SCROLL_SPEED, + clampSpectrogramContrast, clampSpectrogramScrollSpeed, isSpectrogramClarityMode, isSpectrogramScaleMode, @@ -30,6 +32,7 @@ export interface SpectrogramOptions { minDecibels?: number maxDecibels?: number scrollSpeed?: number + contrast?: number clarityMode?: SpectrogramClarityMode scaleMode?: SpectrogramScaleMode colorScheme?: 'heat' | 'mono' @@ -45,6 +48,7 @@ type ResolvedSpectrogramOptions = Required