Giter Club home page Giter Club logo

synthianova's Introduction

Synthia Nova

An AI songwriter with personality

(The song below was entirely written by Synthia Nova, and performed by Suno AI. Read below for more info!)

Phoenix.Rise.-.Synthia.Nova.mp4

Installation

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.)

Usage

Check the synthianova_example.py file to see an example usage. But here's the basics:

  1. Import the SynthiaNova class from synthianova.py.
  2. 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.
  3. You can call SynthiaNova.set_model(model) to change the GPT model used. It defaults to gpt-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.
  4. 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.
  5. 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's formatted_lyrics property, while the original lyrics remain untouched versions of what the AI output.
  6. You can call SynthiaNova.get_songs() to get the full dict of all songs in memory. But more likely, you'll want to call SynthiaNova.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.

Human-Like Memory

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.)

Use with Suno Chirp

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.

Modifying Synthia Nova

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.

Usage/Cost Notes

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.

synthianova's People

Contributors

icemetalpunk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.