#ChatGPT music exploration - more help wanted

76 messages · Page 1 of 1 (latest)

finite lantern
#

Currently exploring prompts that produces notes (not lyrics) with ChatGPT. So far it seems to produce some motifs semi-competently, but I think it could be expanded. More details, including outputs, in the replies.

#

Interpretations
Interpreting the AI output requires the user to match the 1st note given in a measure to the 1st time value given in a measure. The time value indicates what beat the note is on.

I've used MuseScore, a powerful opensource program to write out two outputs I've made.

An issue right now is that the AI can say, "I want this note here!", but it can't say the duration of the note. In my visualizations, I assume the most logical duration and try to keep most interpretation out of it (though there are some cosmetic things that don't truly impact the rhythm).

Limitations
In addition to the above, the AI can't really express most musical terms:

Dynamics - or how musicians measure volume - is not in there, because dynamics change over the course of multiple notes. The system the AI uses to express notes can't really handle this. This is just one of many things left out.

The AI itself also seems to have trouble making varied music. In the "wind" example above, it repeats the same ideas over and over again. In fact, they repeated so much that, for the sake of space, I just put in the musical markings to repeat the music twice
( It looks like this :|| )
Sometimes, it straight up just repeats the same note over and over again per measure.


#

Actual Outputs:

#

(these were some of the better ones)

left frigate
#

You say "An issue right now is that the AI can say, "I want this note here!", but it can't say the duration of the note.

If I understand your prompt:

"When something is a whole number, it is a quarter note. When there is a decimal, it is an eighth note. Understand that eighth notes are divisions of quarter notes - eighth notes are FASTER than quarter notes. Using increments of .25 or .75 are also valid - for example, 3.75, or 2.25, or 1.25, or 2.75 is a valid beat."

I see a definition for quarter and eighth notes.

I propose: ! to indicate half notes. $ to indicate three quarter notes, and @ to indicate whole notes. They'd need to be defined, but could be done in relation to quarter notes.

Except I barely read code or music. Not sure the idea would work. Or how it could be improved. But I swear, it looks like you might have the framework already there?

#

"Sometimes, it straight up just repeats the same note over and over again per measure."

here is maybe WHY:

[Understood, a tempo of 120 BPM it is. I will now proceed to create a musical sequence using the provided template, aiming to create a cheerful and upbeat mood:

M1: | C> C> C> C> - 1.0 1.5 2.0 2.5 |
M2: | D> D> D> D> - 3.0 3.5 4.0 4.5 |
M3: | E> E> E> E> - 1.0 1.5 2.0 2.5 |
M4: | F> F> F> F> - 3.0 3.5 4.0 4.5 |

In this sequence, I have used the notes C, D, E, and F in ascending order to create a happy and uplifting melody. To add a bit of variation, I have used an accent mark on each note to give it more emphasis, and I have spread them across two measures. The Y values follow the rule of ascending numerical order, with each note falling on a quarter or eighth note. The result is a simple yet joyful sequence that could be used in a variety of contexts, from video games to commercials.

I hope this composition meets your expectations. If you have any further requests or revisions, please let me know and I'll be happy to make adjustments as needed.]

#

it may HELP to inform it in the prompt how humans interpret the same note repeated like that. Also it may be reaching for a whole note and LACK that capacity, so it strives for it with multiple quarternotes

still zinc
finite lantern
# left frigate You say "An issue right now is that the AI can say, "I want this note here!", bu...

The problem there is that the AI really has no understanding of time.

Here's a problematic output that would be possible:

Measure 1 : | A& A& A& A& - 1.0 2.0 3.0 4.0 |

If "&" means a whole note, and a whole note is 4 beats, 4 of them just can't fit into the 4-beat measure. (4x4 = 16, 16 > 4). Obviously, the AI doesn't know about this. It just wants the Y numbers to go up in order like a happy little AI.

finite lantern
left frigate
#

We can explain with words, even. If it uses a whole note, then it can't have 4 notes in a measure. it gets 4 beats to split between all the notes, be it 8 quarters, or 2 halfs, or any other.

it totally can understand that concept. What I'm unsure about is how to write that into your prompt, because I don't understand the whole prompt.

But I swear, the bot will get the idea of 1 measure can hold 1 whole note, show me 'A& 1.0-4.0' (or maybe you prefer 'A& 1.0' and you have whatever reads it know this goes through the 4.0?) and that's the whole measure 1.

Should work, just I'm not sure how to rewrite the prompt because I don't understand the whole prompt

finite lantern
#

That's the huge limitation with my prompt, because technically the Notes and Timing are separate. So unless we can find a way to get it to cross reference:

a) the position of the note
with
b) the duration of the note
with
c) the duration of the other notes

then it can't really work. Because, again, it's just picking notes at random(?) and assigning time values (ascending) to them.

The only way around this is to ditch the idea of measures all together. If it generates music in MIDI (which is literally just note + note position + note duration) then we won't need to care about if the measure is too full for more music. Then, we can just take that MIDI output and listen to it as-is, or convert that back to notation.

But that's a project for another day. its getting quite late where I am, so I'll be heading to bed lol. I'll see you guys tomorrow.

left frigate
finite lantern
#

no problemo. Have a great day / night

rugged shore
#

in my understanding, removing the "measure n:" may bring in some variety, because the AI has set a specific temparature (how much different the generation becomes over time), and because the pattern changes with the "n" in measure the punishment may not be strong enough for repeating notes, but that's just an idea

it may also help to use the OpenAI playground and fiddle there with some options - such as frequency penalty

note that you probably still have around 18$ credits for the Playground and will be used as payment, though it will probably not run out quickly

https://platform.openai.com/playground?model=text-ada-001

Your used credits can be seen here:
https://platform.openai.com/account/usage

note: The Playground is not optimized for human conversation. The models are generative models, meaning they will complete (or continue, in a matter of fact) your text.
Imagine you write "So many people to greet. He"
It may complete your text to "So many people to greet. Hello"
Therefore you must optimize your prompt, too.

It may also help to use different models, such as the Davinci model (strongest), because they may handle your prompt better.

Have fun "hacking" :)

The example used above is for high-level education purpose. The AI will probably never add "ello" to the H in "So many people to greet. H", because it does not know what "H" is and can not change an existing token to another. But I don't know much about OpenAI's approach of handling it, and theoretically it might be possible. As I said, simple educational example.

strong flame
#

Maybe this is useful: It seems to be able to directly generate midi files:

#

It doesn't always come out the same though. Not sure how you save that or import that into a music program.

finite lantern
#

Huh, that's interesting

forest lily
#

hey

odd gust
#

Hi!!

#

I found something amazing that'll help you greatly at making generated music!

#

There's this python library called music21. It can make MIDI stuff and even export it as a mscz or XML file.

#

Search Tonesavvy counterpoint

#

you'll get all counterpoint rules.

#

Then ask it to make a random standard counterpoint generator with music21 and all the standard rules you copy pasted.

#

Ask it to make it so the number of measures and melodies can be changed in the code.

#

And you get a counterpoint machine that can make counterpoint with 11 voices or something, idk.

#

Maybe you should also ask it to make it so that there are rythmics motifs and they are used to answer each other.

#

You can also do this with strict counterpoint I guess.

drifting thorn
#

How can I turn the measures that chatGPT gives me into actual music sheets?

odd gust
#

Well, if it uses music21 in a python code, it will automatically convert it to xml!!

#

Or midi or musescore!

#

Isn't that amazing?

drifting thorn
#

It truly is some amazing stuff

drifting thorn
odd gust
#

No, you must ask chatGPT to make the thing as a python script that uses music21 with it being exported into a musecore file at the end and then run it and just open the file you obtain in musescore I guess?

#

Is it working?

drifting thorn
#

It gave me a python script now

odd gust
#

Amazing!

#

Run it!

#

If there's a problem, you can just ask chatGPT what's wrong.

#

I believe you have to install some things like music21?

drifting thorn
#

yes

#

I don't have music21 installed yet, can I just install it and copy-paste the script into there?

odd gust
#

yes

drifting thorn
#

Oh I need to download python first too

#

TypeError Traceback (most recent call last)

<ipython-input-1-9311b79bc127> in <module>
22 measure = music21.stream.Measure(number=i+1)
23 num_notes = music21.common.toRoman(i+1) # number of notes in the measure
---> 24 measure_notes = [pitches[j % len(pitches)] for j in range(num_notes)]
25 measure_times = times[:num_notes]
26 for pitch, time in zip(measure_notes, measure_times):

TypeError: 'str' object cannot be interpreted as an integer

odd gust
#

That's an error message, not a file

#

Ask chatGPT what's wrong.

#

Or just tell it it says that and to fix it

#

reading it, it seems like it simply lacks:
num_notes = int(num_notes)

#

between line 24 and 23

left frigate
#

Encouraging folks to offer screenshots of what works and doesn't. That can help the more inept of us (me! me! Maybe some others too happy_avocado) better follow along and see what success looks like

odd gust
#

I'm pretty sure it's already done.

#

Music21 allows you to do like almost anything.
The program to make counterpointed melody already works. Just some details here and there we can ask chatGPT to change.

#

Just telling chatGPT the list of avoid notes in jazz impro, jazz techniques and chords that work together, you'll be able to make a jazz solo generator.

#

Surprising you all didn't hear about it. It's THE code-to-midi thing.

#

And I mean, directly making it into a musescore file? Awesome!!

#

I just don't get why he suddenly left just after I told him the error skeletonconfused

drifting thorn
odd gust
sage violet
#

@finite lantern can you send the link to your musescore profile or a link to the scores?

left frigate
jaunty sequoia
#

How to turn it into mp3?

rugged shore
#

Bumping for interest – did anyone manage to get useable music tracks? Would love to play around with this if so!

late zinc
#

this seems fairly complicated. much easier solution: ask ChatGPT "can you generate a short piece of Mozart-style music in MGS/MML (Music Game System) format? MGS format looks similar to this: ```
;[name=Short Piece]
#opll_mode 1
#tempo 120
#title { "Short Piece" }

; Define instruments
@v10 = { ; Piano
; TL FB
24, 7,
; AR DR SL RR KL MT AM VB EG KR DT
7, 4, 0, 0, 0, 1, 0, 0, 1, 0, 0,
10, 7, 1, 1, 0, 1, 0, 1, 0, 0, 0 }

; Main melody
9ABC [
; Piano
9 @10v10o4l8
9 c4d4e4f4g4a4b4c5```
" and then play them back on an MGS/MML player This approach sort of works, with the following four caveats: (A) ChatGPT sometimes join up the last few lines and you need to manually insert newlines before the 9's, (B) if I ask for more instruments ChatGPT usually mess up the values in the instrument definition, using invalid parameters, (C) I need to include the code sample to make ChatGPT sufficiently remember the MGS/MML format (and it still sometimes mess up) - and while I could get it to output MML note strings without that, I don't know anything that will play plain MML note strings and (D) ChatGPT seems to output more or less the same music all the time, no matter what genre I ask it to do, and that music is unfortunately not particularly good.