(The song below was entirely written by Synthia Nova, and performed by Suno AI. Read below for more info!)
Phoenix.Rise.-.Synthia.Nova.mp4
First, clone the repo into an empty directory and install the Python requirements:
mkdir synthia_nova
cd synthia_nova
git clone https://github.com/IceMetalPunk/SynthiaNova.git .
pip install -r requirements.txt
Then make sure you have an OpenAI API key. The easiest way to use it is to put it in a .env
file and then follow the synthianova_example.py
code to see how to load the key. That .env
file would look something like this:
OPENAI_KEY=<OpenAI_Key_Goes_Here>
(The .env
file is already included in this repo's .gitignore
, so if you do this, you can fork the repo and not worry about your OpenAI API key leaking.)
Check the synthianova_example.py
file to see an example usage. But here's the basics:
- Import the SynthiaNova class from
synthianova.py
. - Initialize an instance of the class, passing in your API key. You may optionally also pass the filename of the JSON file that songs will be saved to (default is just
songs.json
). If that file already exists, all songs will automatically be loaded from it into memory. - You can call
SynthiaNova.set_model(model)
to change the GPT model used. It defaults togpt-4-1106-preview
. NOTE: It must be a model that supports Function Calling! Check the OpenAI documentation on Function Calling to see which ones qualify. Using an invalid model will not work. - Call
SynthiaNova.write_song()
to generate a new song. This will return the title of the song when it's done, and store the rest of the song info in memory. The AI is encouraged to generate songs that are different from all previously generated songs in memory. - After generating as many songs as you want, you can call
SynthiaNove.process_songs()
to enforce proper formatting on all songs. This means tagging verses vs chorus, ensuring final punctuation is followed by line breaks, and ensuring each section is broken into quatrain stanzas as best as possible. The formatted songs are set on each song object'sformatted_lyrics
property, while the originallyrics
remain untouched versions of what the AI output. - You can call
SynthiaNova.get_songs()
to get the full dict of all songs in memory. But more likely, you'll want to callSynthiaNova.save_songs()
, which will save all songs in memory to the JSON file you initialized the class with. This will overwrite that file if it exists, but since SynthiaNova auto-loads existing songs on init, you shouldn't lose any songs from this process.
As of the September 11, 2023 update, Synthia Nova now has human-like memory! Using semantic search (via the sentence-transformers and FAISS libraries/models), she will look up the 5 most relevant memories from "her life" that fit the song's topic. If she can't find 5 decently relevant ones, she'll be prompted to make one up that fits the subject, which she'll then store for lookup during future songwriting.
This means she'll have a consistent memory of "her life" throughout all her songs, and will be able to use those memories for inspiration in the song lyrics. The result? Her songs now feel even more specific and personal, more real, and once she builds enough memories, she'll automatically be able to reference the same events across songs, like a human would.
Additionally, her semantically searchable memory also means she can now explain the meaning/inspiration behind all her songs! If you call SynthiaNova.explain_song()
and pass the title of a song from her songs.json (case-insensitive, but otherwise must match exactly), she can recall up to the top 5 relevant memories and return them. The memories are all formatted as descriptive, natural-language paragraphs (they're generated by GPT initially), so the explanations sound just like a human's response about their inspirations.
Disclaimer: This shouldn't need to be said, but just in case... the memories are all imaginary, invented by GPT. Do not take them as events that actually happened in anyone's life. Synthia Nova is an AI, a simulation of a human personality, not a real embodied being with all these actual experiences to remember. (I really should NOT need to say this.)
This framework was designed with Suno Chirp in mind. You should be able to copy/paste the song genre/style (with an added "female vocals" specified, if needed) directly into Chirp, and you should also be able to copy the formatted lyrics in one stanza at a time (or more; that's your preference).
Really, copying the text into Chirp and curating the clips it generates should be the only human input needed to get great, original songs, written by Synthia Nova and performed by Chirp.
I encourage anyone to feel free to modify the prompts in the SynthiaNova class to suit your needs, or to experiment. There is only one thing I insist on if you do so: Do not call your version Synthia Nova! The name "Synthia Nova" refers to this original framework, and also to the personality this framework tries to keep consistent via its GPT prompt engineering. You can call your modified version anything else.
Obviously, this will use your GPT account, and you will incur any costs from that accordingly. One important note is that, because the prompt for each new song includes an injected list of all previous song topics (to encourage variety), the more songs you generate, the more tokens you will use for each generation, thus technically costing you more.
That said, the subject strings are intentionally kept short, and in all my testing I've used less than $2, so it shouldn't be too bad compared to your usual ChatGPT / GPT API usage.