Skip to content

Bug: Fix critical audio processing bugs #6

Description

@Leostrange

Critical bugs found in code analysis

Bug 1 — SegmentSlicer: hardcoded MP3 format (ignores user selection)

File: app/src/main/java/com/example/vocalremover/data/SegmentSlicer.kt
Segment output filenames are hardcoded to .mp3 regardless of user-selected format in ProcessingConfig.
Fix: Use config.format.extension instead of hardcoded "mp3".

Bug 2 — WaveformCanvas: wrong segment time-to-X calculation

File: app/src/main/java/com/example/vocalremover/ui/components/WaveformCanvas.kt
The formula (segment.start / (duration / 1000f)) * size.width is incorrect — segments are in seconds, duration in milliseconds.
Fix: Use (segment.start * 1000f / duration) * size.width

Bug 3 — ResultsScreen: segments never passed from MainViewModel

File: app/src/main/java/com/example/vocalremover/ui/screens/ResultsScreen.kt
segments: List<Segment> = emptyList() — always empty, waveform never shows vocal regions.
Fix: Pass segments from ViewModel state through Screen.Results and into ResultsScreen.

Bug 4 — MediaExtractorWaveformGenerator: incorrect signed PCM parsing

File: app/src/main/java/com/example/vocalremover/data/waveform/MediaExtractorWaveformGenerator.kt
Manual bit manipulation for 16-bit PCM is error-prone. Use ByteBuffer.getShort() instead.

Acceptance Criteria

  • Segments export in the format selected by user (MP3/WAV/FLAC/OGG)
  • Waveform highlights vocal regions correctly
  • Segments are visible on waveform in ResultsScreen
  • Waveform amplitudes are rendered correctly

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions