Skip to content

Add call-and-response rework workflow, streamline README, and deprecate legacy wrappers#35

Open
velocitylord wants to merge 1 commit into
motif-improvfrom
codex/fix-chord/key-analysis-and-add-melody-predictor-naz1vf
Open

Add call-and-response rework workflow, streamline README, and deprecate legacy wrappers#35
velocitylord wants to merge 1 commit into
motif-improvfrom
codex/fix-chord/key-analysis-and-add-melody-predictor-naz1vf

Conversation

@velocitylord
Copy link
Copy Markdown
Owner

Motivation

  • Provide a presentation-ready generation workflow that produces more musical outputs by combining an intact original phrase with a predictor-generated response.
  • Reduce repository clutter and focus documentation on the core, demo-relevant pipelines while preserving the key/chord analysis functionality.

Description

  • Add 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 for responseKeyShift and rhythmBlend, and export of MIDI + analysis JSON (global key, bar timeline, call/response spans, generation settings).
  • Deprecate older tooling by replacing Scripts/keyShiftAndRegenerateMelody.wls with a one-line deprecation stub and turning Scripts/rework_with_prettymidi.py into a short-exit wrapper pointing users to the new scripts.
  • Streamline README.md to highlight the core demo workflow (makeDataset, trainRnn, reinterpretPhraseWithHarmony, and the new callAndResponseRework) and provide concise example invocations for the presentation path.
  • Small cleanups and conservative defaults maintained/refined in Scripts/reinterpretPhraseWithHarmony.wls (argument validation, harmony/key detection, conservative maxPitchDelta/keepOriginalProb/timingBlend behavior, and stable analysis export).

Testing

  • Ran python -m py_compile Scripts/rework_with_prettymidi.py which succeeded.
  • Verified repository changes and references with a grep scan rg -n "keyShiftAndRegenerateMelody|rework_with_prettymidi|callAndResponseRework|reinterpretPhraseWithHarmony" README.md Scripts which succeeded.
  • Attempted to validate Wolfram script behavior with wolframscript but the wolframscript binary is not available in this environment, so runtime integration tests for .wls scripts could not be executed here.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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"]];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant