Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new spectrum bin selection in WaveformView maps the lowest band to DC (bin 0) and hard-codes a 20kHz range, which can produce incorrect rendering behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the audio spectrum pipeline and UI rendering to improve spectrum visualization, and bumps the release/version metadata to v0.1.1.
Changes:
- Move frequency-band projection responsibility to
WaveformViewby returning raw positive-frequency FFT bins from the playback engine. - Update spectrum drawing to use a dB-based normalization curve (instead of direct linear clamping).
- Bump project and packaging versions from 0.1.0 → 0.1.1.
File summaries
| File | Description |
|---|---|
src/main/java/club/muimi/kimusic/view/component/WaveformView.java |
Changes spectrum band mapping (log-frequency style) and renders bars/peaks using dB normalization. |
src/main/java/club/muimi/kimusic/service/playback/JavaSoundPlaybackEngine.java |
Returns raw FFT bins (positive frequencies) instead of pre-aggregated 64-band spectrum. |
pom.xml |
Bumps Maven project version to 0.1.1. |
.github/workflows/release.yml |
Updates packaging artifact names and jpackage --app-version to 0.1.1. |
Review details
Suppressed comments (1)
.github/workflows/release.yml:67
- Same hard-coded version issue in the Linux packaging step: deriving the version from the pushed tag reduces manual updates and keeps artifact names consistent with the release tag.
cp staging/input/Kimusic.jar release/Kimusic-0.1.1.jar
jpackage --type deb --name Kimusic --app-version 0.1.1 --input staging/input --main-jar Kimusic.jar --main-class club.muimi.kimusic.Launcher --dest release
jpackage --type app-image --name Kimusic --app-version 0.1.1 --input staging/input --main-jar Kimusic.jar --main-class club.muimi.kimusic.Launcher --dest staging
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+66
to
+69
| double normalized = (double) index / spectrum.length; | ||
| double freq = 20.0 * Math.pow(20000.0 / 20.0, normalized); | ||
| int source = (int) (freq / (20000.0 / values.length)); | ||
| source = Math.min(values.length - 1, Math.max(0, source)); |
Comment on lines
+323
to
333
| // Return the positive-frequency FFT bins. WaveformView owns the only | ||
| // frequency-band projection so logarithmic scaling is not applied twice. | ||
| int usableBins = fftSize / 2; | ||
| for (int band = 0; band < spectrum.length; band++) { | ||
| double fromRatio = band / (double) spectrum.length; | ||
| double toRatio = (band + 1) / (double) spectrum.length; | ||
| int from = Math.max(1, (int) Math.round(Math.pow(fromRatio, 2) * usableBins)); | ||
| int to = Math.max(from + 1, (int) Math.round(Math.pow(toRatio, 2) * usableBins)); | ||
| double peak = 0; | ||
| for (int bin = from; bin < Math.min(to, usableBins); bin++) { | ||
| peak = Math.max(peak, Math.hypot(real[bin], imaginary[bin])); | ||
| } | ||
| float[] spectrum = new float[usableBins]; | ||
| for (int bin = 1; bin < usableBins; bin++) { | ||
| double magnitude = Math.hypot(real[bin], imaginary[bin]); | ||
| // Keep a little over-range so the view can normalize all bands against | ||
| // the current maximum instead of flattening clipped peaks. | ||
| spectrum[band] = (float) Math.max(0, Math.min(4, | ||
| Math.log10(1 + peak * 18) / Math.log10(19))); | ||
| spectrum[bin] = (float) Math.max(0, Math.min(4, | ||
| Math.log10(1 + magnitude * 18) / Math.log10(19))); | ||
| } |
Comment on lines
+36
to
+38
| Copy-Item staging/input/Kimusic.jar release/Kimusic-0.1.1.jar | ||
| jpackage --type exe --name Kimusic --app-version 0.1.1 --input staging/input --main-jar Kimusic.jar --main-class club.muimi.kimusic.Launcher --icon logo.ico --dest release --win-shortcut --win-menu | ||
| jpackage --type msi --name Kimusic --app-version 0.1.1 --input staging/input --main-jar Kimusic.jar --main-class club.muimi.kimusic.Launcher --icon logo.ico --dest release --win-shortcut --win-menu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.