Repository navigation
Accept audio submitted as a URL - #29
Merged
Merged
Conversation
Uploaded recordings arrive as URLs to a bucket object, and none of them reached transcription. - file_extension() and file_name() read the URL path rather than the raw string, so a presigned URL is no longer seen as ".wav?X-Amz-Signature=" and misrouted into the MIDI branch. Local paths parse the same way as before. - local_audio_file() downloads a URL to a temporary file and removes it afterwards. Basic Pitch reads audio through librosa, which needs a file on disk, so fixing detection alone would only move the failure. - preview.py names the recording from the URL path, so a presigned URL no longer prints its signature back to the student. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The shared deploy workflow now requires function-admin-api-key-staging (and function-admin-api-key-production for production) instead of the deprecated function-admin-api-key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read .mid/.midi paths and URLs into note data with pretty_midi instead of trying to parse the URL as JSON; preview summarises them. - Add .aac and .opus to the transcribed audio extensions. - Install ffmpeg in the image so librosa can decode m4a and aac (wav/flac/ogg/opus/mp3 are handled by libsndfile). - Test that every supported audio format decodes when ffmpeg is present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI sends answer and response as [{url, name, type, size, comment}].
Mark the first file, taking its format from the URL, name or MIME type;
treat an empty list as no notes and report unsupported files as feedback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
librosa's numba functions cache next to their source by default, which is read-only on Lambda, so transcribing audio failed with 'cannot cache function __o_fold: no locator available'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #28. Based on
main, independent of the #23/#26/#27 chain.Detection.
file_extension()andfile_name()parse the URL path instead of the raw string, so a query string or fragment no longer swallows the extension. Local paths go through the same helpers and behave exactly as before.is_audio_inputandpreview.pyboth use them, so the two no longer disagree about the same submission.Fetching. Fixing detection alone would only have moved the failure: Basic Pitch reads audio via
librosa.load, which needs a file on disk.local_audio_file()is a context manager that hands back a local path unchanged and downloads a URL to a temp file, removing it afterwards. The temp file keeps the original extension, since Basic Pitch picks its decoder from it.Preview. A presigned URL was printing its full signature back to the student through
os.path.basename. It now shows justpractice.wav.Verified end to end, not only by unit test: served
rec_1906.wavover localhost and transcribed it through a presigned-style URL — 97 notes in 8.0s, temp file cleaned up.Tests. New
audio_processing_test.pycovers the path helpers,is_audio_input, andlocal_audio_fileincluding a real download against a temporary localhost server (no external network). One preview test asserts the signature never reaches the student. 124 pass; no new lint.Deliberately not done, per "minimal for now": no caching, retries, size limit, or content-type check, and no allowlist on the fetched host. Worth noting that last one — the function now issues an HTTP GET to a URL taken from the submission, so anything that can submit can make the container fetch a URL of its choosing. Fine if submissions only ever come from the platform's own bucket, worth a follow-up if not.
🤖 Generated with Claude Code