Add call-and-response rework workflow, streamline README, and deprecate legacy wrappers#35
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 343cb39dc8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| anchorPitch = anchor[[4]] + responseKeyShift; | ||
| anchorData = {anchor[[1]] - If[i == 1, callMelody[[1, 1]], callMelody[[i - 1, 1]]], anchor[[2]], anchor[[3]]}; | ||
| predResult = Quiet@Check[predictor[<|"Notes" -> rewriteNotes, "NoteData" -> NumericArray[rewriteData, "Real32"]|>], $Failed]; | ||
| predPitch = If[predResult === $Failed || FailureQ[predResult] || !NumericQ[predResult["NotesPred"]], anchorPitch, predResult["NotesPred"]]; |
There was a problem hiding this comment.
Avoid double-transposing fallback response pitches
In the predictor-failure path, predPitch is set to anchorPitch, and anchorPitch already has responseKeyShift applied. The later call chooseConstrainedPitch[predPitch + responseKeyShift, ...] therefore applies the key shift a second time whenever responseKeyShift != 0, so failed predictions produce systematically over-shifted notes instead of the intended transposition. This is most visible when the model occasionally returns non-numeric output or throws, because the fallback melody drifts sharper/flatter than requested.
Useful? React with 👍 / 👎.
Motivation
Description
Scripts/callAndResponseRework.wls, a Wolfram script that implements a bar-structured flow where bars 1–2 keep the original melody and bars 3–4 are generated as a harmony-aware predictor response, with options forresponseKeyShiftandrhythmBlend, and export of MIDI + analysis JSON (global key, bar timeline, call/response spans, generation settings).Scripts/keyShiftAndRegenerateMelody.wlswith a one-line deprecation stub and turningScripts/rework_with_prettymidi.pyinto a short-exit wrapper pointing users to the new scripts.README.mdto highlight the core demo workflow (makeDataset,trainRnn,reinterpretPhraseWithHarmony, and the newcallAndResponseRework) and provide concise example invocations for the presentation path.Scripts/reinterpretPhraseWithHarmony.wls(argument validation, harmony/key detection, conservativemaxPitchDelta/keepOriginalProb/timingBlendbehavior, and stable analysis export).Testing
python -m py_compile Scripts/rework_with_prettymidi.pywhich succeeded.rg -n "keyShiftAndRegenerateMelody|rework_with_prettymidi|callAndResponseRework|reinterpretPhraseWithHarmony" README.md Scriptswhich succeeded.wolframscriptbut thewolframscriptbinary is not available in this environment, so runtime integration tests for.wlsscripts could not be executed here.Codex Task