Using Cursor to Generate Harmony Audio Code

Cursor has been very popular recently. Even those who do not understand programming can communicate with it using natural language and write very professional code.

After communicating with it for several hours, I had it write a piece of code that can generate harmony audio. Perhaps in the future, by inputting a score for a quartet, the code will be able to sing a beautiful four-part harmony.

Below is the process of our communication in very natural language.

Using Cursor to Generate Harmony Audio Code

So, it wrote the following code, which can be considered version 1.0:

Using Cursor to Generate Harmony Audio Code

After finishing, it seriously provided a description: “This code does the following: defines a generate_note function to generate notes of specified frequency and duration. Defines a create_harmony function that creates a basic note and its major triad (root, major third, and perfect fifth). Creates a simple harmony sequence containing four chords. Exports the generated audio sequence as an MP3 file.”

After running the code it wrote, an audio file named “harmony.mp3” was produced.

To be honest, this so-called “harmony” sounded terrible and had no harmony effect at all. So, I communicated with it repeatedly for many times.

Using Cursor to Generate Harmony Audio Code

After several hours, it completed the following code and outputted a more ideal sound effect of C major, D minor, E minor, and F major chords on the piano.

Using Cursor to Generate Harmony Audio Code

This version 2.0 has made significant progress compared to the previous version 1.0. Next, we discussed the possibility of the system recognizing sheet music and outputting harmonious music. In the end, it stated:

Using Cursor to Generate Harmony Audio Code

With its thoughtful encouragement, I became eager to try my hand at image processing and music generation.

Leave a Comment