Skip to content

Conversation

@jon-myers
Copy link
Contributor

Summary

  • Fixed frequency axis orientation in spectrogram data loading
  • Server data has row 0 = highest frequency, but API expects row 0 = lowest
  • This caused frequency cropping to select wrong spectrum regions (off by more than an octave)

Changes

  • Added np.flipud() in SpectrogramData.from_audio_id() after loading data from server
  • Data is now correctly oriented: row 0 = lowest frequency, matching freq_bins property ordering
  • All 36 spectrogram tests continue to pass

Impact

  • Fixes frequency alignment between spectrograms and pitch contours in visualizations
  • Users should remove any flipud() calls they were using as workarounds

Test Plan

  • All existing tests pass
  • Frequency bins now correctly correspond to data rows
  • Cropping now selects correct frequency ranges

🤖 Generated with Claude Code

The server data has row 0 = highest frequency, but freq_bins property
calculates assuming row 0 = lowest frequency. This caused frequency
cropping to select the wrong portion of the spectrum (e.g., requesting
200-400 Hz would actually return high frequencies like 2000-2400 Hz).

Now flip the data immediately after loading in from_audio_id() so:
- Row 0 = lowest frequency (matching freq_bins[0])
- Row -1 = highest frequency (matching freq_bins[-1])

This fixes frequency alignment between spectrograms and pitch contours
in visualization contexts.

Note: Visualizations using this API should remove any flipud() calls
they were using to work around this issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

📦 Test Package Built Successfully!

This PR has been automatically built and uploaded to TestPyPI for testing.

🔗 TestPyPI Link: https://test.pypi.org/project/idtap/

To test this version:

pip install --index-url https://test.pypi.org/simple/ idtap

✅ All tests passed and package builds successfully.

@jon-myers jon-myers merged commit 6870ad3 into main Nov 7, 2025
1 check passed
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.

2 participants