Skip to content

Added Graphic EQ and Compressor#1972

Open
keebsxd wants to merge 20 commits intojeffvli:developmentfrom
keebsxd:development
Open

Added Graphic EQ and Compressor#1972
keebsxd wants to merge 20 commits intojeffvli:developmentfrom
keebsxd:development

Conversation

@keebsxd
Copy link
Copy Markdown

@keebsxd keebsxd commented Apr 20, 2026

Uses MPV playback. 12 Band EQ and a simple Compressor with some basic presets.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
feishin Ready Ready Preview, Comment Apr 22, 2026 6:32am

Copy link
Copy Markdown
Collaborator

@kgarner7 kgarner7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See required changes. Note that I will not approve this unless it is also supported for web player (the most common player).

Comment thread githubssh.pub Outdated
Comment thread .github/workflows/feishintest.yml Outdated
Comment thread package.json Outdated
keebsxd added 2 commits April 20, 2026 16:15
shouldnt have this in here anyways. Already a lint test action exists. Was just using it do demo a flag
@keebsxd
Copy link
Copy Markdown
Author

keebsxd commented Apr 20, 2026

Working on adding Web player functionality. I will request another review when appropriate

Extends the existing EQ and compressor feature (previously MPV-only)
to also work with the Web Audio player backend.

Changes:
- types.ts: extend WebAudio type with optional dsp field containing
  preampGain (GainNode), eqFilters (BiquadFilterNode[]), and
  compressor (DynamicsCompressorNode)
- audio-players.tsx: build Web Audio DSP chain on AudioContext creation,
  inserting preamp, peaking EQ filters, and DynamicsCompressorNode
  between the existing gain nodes and context.destination; nodes are
  initialised from persisted settings so filters are active immediately
  on first playback without requiring the settings panel to be opened
- eq-settings.tsx: applyFilters now branches on player type; MPV path
  unchanged (lavfi filters via IPC), Web Audio path updates AudioParam
  values directly on the live DSP nodes for glitch-free real-time
  adjustment; EQ and compressor panels are now visible and functional
  for both player backends; subtitle labels updated to reflect the
  active backend
…ation

- Fix perfectionist/sort-imports ordering in audio-players.tsx and eq-settings.tsx
- Fix perfectionist/sort-objects: move compressor before equalizer in dsp object
- Fix perfectionist/sort-union-types: move null before object type in WebAudio dsp field
- Fix react-hooks/immutability: access WebAudioContext directly via useContext
  instead of reading dsp nodes from useWebAudio hook return value, which was
  incorrectly flagged as a hook-return mutation
- Fix prettier formatting throughout applyFilters callback
@keebsxd
Copy link
Copy Markdown
Author

keebsxd commented Apr 20, 2026

Added Web player EQ

@kgarner7
Copy link
Copy Markdown
Collaborator

Thanks! The web audio implementation actually works really well. It looks like for MPV, the ranges have too high of a collision, tested by just turning up all the knobs to +12. In web audio, this just makes the whole thing loud, but with MPV the audio is very distorted.

@keebsxd
Copy link
Copy Markdown
Author

keebsxd commented Apr 21, 2026

I'll do some investigating and see what I can do about the clipping but I suspect there won't be much as clipping is expected and the same thing happens with VLC and other players that use the FFMPEG backend

Distortion occurred when boosting EQ bands in the MPV player because

FFmpeg's equalizer lavfi filter has no built-in gain limiting signal

values exceeding 0 dBFS were hard clipped at the integer conversion

stage in MPV's audio output pipeline.

Fix: prepend a volume filter before the EQ band chain with a

compensated gain value calculated as (preamp - maxBandBoost), where

maxBandBoost is the highest positive band gain across all active bands.

This ensures the input signal always has sufficient headroom to

accommodate the largest band boost without clipping.

Preamp behaviour is now consistent with hardware EQs and VLC:

- Positive preamp raises the pre-EQ input level and is visible to

  the user when bands are flat

- Negative preamp adds additional headroom on top of auto-protection

- Auto-protection is proportional to the largest band boost only,

  not additive with the preamp value (previous implementation

  incorrectly included preamp in totalBoost, causing positive preamp

  values to be fully cancelled by the compensation)

This limitation does not affect the Web Audio player, which processes

audio entirely in 64-bit float with no integer conversion between

nodes and therefore cannot hard clip at intermediate stages.
@keebsxd
Copy link
Copy Markdown
Author

keebsxd commented Apr 21, 2026

Thanks! The web audio implementation actually works really well. It looks like for MPV, the ranges have too high of a collision, tested by just turning up all the knobs to +12. In web audio, this just makes the whole thing loud, but with MPV the audio is very distorted.

I pushed some updates to fix the EQ on MPV to prevent distortion. Its consistent with how VLC handles EQ and Compression.

Feature should now be complete unless bugs are found.

@kgarner7
Copy link
Copy Markdown
Collaborator

Thanks. Last two points (although you'll have to ask @jeffvli to help review those):

  1. When switching between mpv to web audio, it looks like the equalizer is only applied after you make a change.
  2. The behavior of the equalizer feels rather different between web audio and MPV. In web audio, if I increase one of the frequencies, that region gets louder and the rest is (mostly) not impacted. In MPV, while I don't hear distortion anymore, the effect appears to be make everything else quieter instead when increasing. Decreasing however appears to have the proper effect.

@keebsxd
Copy link
Copy Markdown
Author

keebsxd commented Apr 22, 2026

I've changed the behaviour of the preamp

Thanks. Last two points (although you'll have to ask @jeffvli to help review those):

1. When switching between mpv to web audio, it looks like the equalizer is only applied _after_ you make a change.

2. The behavior of the equalizer feels rather different between web audio and MPV. In web audio, if I increase one of the frequencies, that region gets louder and the rest is (mostly) not impacted. In MPV, while I don't hear distortion anymore, the effect appears to be make _everything else_ quieter instead when increasing. Decreasing however appears to have the proper effect.

This should be fixed now. I cant seem to replicate your issue with the EQ not being auto applied? Check the new version and let me know

@jeffvli
Copy link
Copy Markdown
Owner

jeffvli commented Apr 29, 2026

Could you refactor the EQ settings component and anywhere else that you're using custom inputs to use the existing components instead?

This includes the VerticalSlider, HSlider, and Toggle components that already have existing wrapped components available. You will need to rebase development onto your branch as the newly commited Mantine v9 upgrade now includes vertical sliders natively.

Using your custom components means that they do not follow the existing app theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants