3 ms·
I've tried every way I can think of to get an LLM to generate valid code to do this, but everything seems to require manual intervention. I've tried giving it e
by th0ma5 1y ago
I've tried every way I can think of to get an LLM to generate valid code to do this, but everything seems to require manual intervention. I've tried giving it explicit examples, I've tried begging, I've tried bribing, and I've tried agreeing on the prompt first, and there doesn't seem to be a way for me to get valid code out for this simple idea from any of Claude, Gemini, Chat GPT, etc.
> Write a concise Python function `generate_scale(root: int, scale_type: str) -> list[int]` that returns a list of MIDI note numbers (0-127 inclusive) for the given `root` note and `scale_type` ("major", "minor", or "major7"). The function should generate all notes of the specified scale across all octaves, and finally filter the results to include only notes within the valid MIDI range.
... So I typed all of the above in and it basically said don't ever try to use an LLM for this, it doesn't know anything about music and is especially tripped up by it. And then it gave me an example that should actually work and then didn't. It's wild because it gets the actual scale patterns correct.