# Infinite Sound Generate infinite music by describing it with text powered by Stable Audio Open and a simple local UI. Your prompt, your vibe, your AI-generated audio. **Runs entirely on your own computer.** --- ## Features - Infinite audio: Looped and crossfaded seamless output. - Custom prompt: Describe the vibe, setting, or instruments you want. - Local, fast, and hackable: Runs on Mac/Windows/Linux (MPS, CUDA or CPU). - Save generated clips. - GUI made with PyWebview. --- ## Requirements - Python 3.10 or higher (3.11+ recommended) - [Poetry](https://python-poetry.org/) or `pip` - Internet connection (first run/model download) - Hugging Face account & access token (free: https://huggingface.co/settings/tokens) --- ## Setup 1. **Clone this repository** ```bash git clone https://giers10.uber.space/giers10/infinite-sound cd infinite-sound ``` 2. **Install dependencies** ```bash pip install -r requirements.txt ``` *(Or with poetry: `poetry install`)* 3. **Get access to the model & authenticate (one-time Hugging Face login):** - Go to [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens), click "New token", select **Read**, and copy it. - Go to [stabilityai/stable-audio-open-small](https://huggingface.co/stabilityai/stable-audio-open-small) and click **“Access repository”**/**“Agree and access”** to accept the license. - **Authenticate in your terminal:** Run: ```sh huggingface-cli login ``` Paste your token and press Enter. You should see “Token is valid”. *(This is required before first run!)* > **Tip:** If you skip the `huggingface-cli login` step, the program will not be able to download or load the model and will throw a 401 error. > *You may need `ffmpeg` installed for `pydub` to work. On Mac: `brew install ffmpeg`. On Windows: download from [ffmpeg.org](https://ffmpeg.org/download.html) and add to PATH.* --- ## Usage ```bash python infinite-sound.py ``` On first run, the script will automatically download the AI model (ca 2 GB) from Hugging Face. ### Controls - **Play/Pause:** Start or stop the infinite music loop. - **Prompt:** Enter any text (e.g., "medieval tavern, rain outside, soft lute"). - **Volume:** Set the output volume. - **Record toggle:** Enable/disable saving each generated clip. Audio clips are saved in the `clips/` folder if recording is enabled. --- ## FAQ & Troubleshooting **Q: I get a black window, and nothing loads!** A: Make sure you have a working version of `pywebview` and a supported browser backend (see below). **Q: “Model load failed” or “Invalid HuggingFace token”?** A: Double-check you pasted a correct access token and accepted the model license on Hugging Face. **Q: Which browser/desktop backends are supported?** A: `pywebview` uses system-native browser engines. On Mac, you need Python installed via Homebrew or python.org for best results. **Q: How do I speed up generation?** A: Use a GPU (MPS on Mac, CUDA on Nvidia). This is automatic if you have the hardware and drivers. --- ## Credits - [Stable Audio Open](https://huggingface.co/stabilityai/stable-audio-open-small) - PyWebView, PyTorch, Hugging Face Hub, and you! --- ## License MIT ## Author [Victor Giers](https://www.victorgiers.com/)