infinifi is a cosy little website that plays calm, gentle lo-fi music in the background to help you relax and study!
infinifi works by continuously generating 5 1-minute lofi music clips in the background using Meta's MusicGen model. Each clip is generated using a slightly different prompt to provide music clips with different, but still cosy vibes.
the frontend is written using pure HTML/CSS/JS with no external dependencies. it queries /current.mp3
to obtain the current lofi music clip. after the clip ends, it re-queries again, which will return a different clip. since each clip is completely different, the frontend applies a fade-in and fade-out effect at the start and the end of each clip.
infinifi consists of two parts, the inference server and the web server. the two servers are connected via a websocket connection. whenever the web server requires new audio clips to be generated, it sends a "generate" message to the inference server, which triggers the generation on the inference server. when the generation is done, the inference server sends back the audio in mp3 format back to the web server over websocket. once the web server receives the mp3 data, it saves them locally as mp3 files.
you are welcome to self host infinifi. to get started, make sure that:
then follow the steps below:
torch==2.1.0
requirements-inference.txt
and requirements-server.txt
python inference_server.py
fastapi run server.py --port ${ANY_PORT_NUMBER}
you can also run the inference server and the web server on separate machines. to let the web server know where to connect to the inference server, specify the INFERENCE_SERVER_WS_URL
environment variable when running the web server:
INFERENCE_SERVER_WS_URL=ws://2.3.1.4:1938 fastapi run server.py --port ${ANY_PORT_NUMBER}
if you have any feature idea, feel free to use the issue tracker to let me know!