{"id":21891687,"url":"https://github.com/kbve/lofifocus-docker","last_synced_at":"2025-10-15T23:31:55.932Z","repository":{"id":191675701,"uuid":"685148515","full_name":"KBVE/lofifocus-docker","owner":"KBVE","description":"https://github.com/KBVE/lofifocus-chrome-extension","archived":false,"fork":false,"pushed_at":"2023-08-31T15:59:33.000Z","size":15520,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-16T15:12:30.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://lofifocus.kbve.com/#","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KBVE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-30T16:07:12.000Z","updated_at":"2024-04-02T02:24:22.000Z","dependencies_parsed_at":"2023-08-31T04:11:49.882Z","dependency_job_id":null,"html_url":"https://github.com/KBVE/lofifocus-docker","commit_stats":null,"previous_names":["kbve/lofifocus-docker"],"tags_count":0,"template":false,"template_full_name":"KBVE/nodepy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KBVE%2Flofifocus-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KBVE%2Flofifocus-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KBVE%2Flofifocus-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KBVE%2Flofifocus-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KBVE","download_url":"https://codeload.github.com/KBVE/lofifocus-docker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244900079,"owners_count":20528622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T12:41:47.353Z","updated_at":"2025-10-15T23:31:50.894Z","avatar_url":"https://github.com/KBVE.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://cdn.discordapp.com/attachments/1047967719745667123/1146199674655608902/image.png\" data-canonical-src=\"https://cdn.discordapp.com/attachments/1047967719745667123/1146199674655608902/image.png\" width=\"200\" /\u003e\n\n---\n\nDemo: https://lofifocus.kbve.com/#\n\nChrome Extension Repo: https://github.com/KBVE/lofifocus-chrome-extension\n\nDownload Chrome Extension: https://github.com/KBVE/lofifocus-chrome-extension/releases/latest\n\nCustom Trained LoFi Model: https://storageapi.webenclave.com/hackathon/lm_final.pt\n\nAI Voice Generation via ElevenLabs: https://storageapi.webenclave.com/hackathon/ElevenLabs_2023-08-29T22_11_24_Charlotte_pre_s50_sb75_b_m1.mp3\n\nSongs Generated using facebook/musicgen-small:\n\nhttps://storageapi.webenclave.com/hackathon/77896957728656.wav\n\nhttps://storageapi.webenclave.com/hackathon/89748590695969.wav\n\nhttps://storageapi.webenclave.com/hackathon/32174022274771.wav\n\nCustom Model with Multi-Band Diffusion:\n\nhttps://storageapi.webenclave.com/hackathon/1693443008707.wav\n\nhttps://storageapi.webenclave.com/hackathon/1693446342975.wav\n\nhttps://storageapi.webenclave.com/hackathon/1693446441558.wav\n\n---\n# Video \nYoutube video: https://www.youtube.com/embed/szN4w4cd02s?si=cd0fz-zlLhpL_sYR\n\n---\n\n# Lofi Focus\n\n- [Video](#video)\n- [Lofi Focus](#lofi-focus)\n  - [Overview](#overview)\n  - [Benefits of LoFi Music](#benefits-of-lofi-music)\n  - [Audiocraft to the Rescue](#audiocraft-to-the-rescue)\n  - [Why Download Our Chrome Extension](#why-download-our-chrome-extension)\n  - [How to Install Our Chrome Extension](#how-to-install-our-chrome-extension)\n  - [Features](#features)\n  - [Implementation](#implementation)\n  - [Our Custom Model](#our-custom-model)\n  - [Goals](#goals)\n  - [Technologies Used](#technologies-used)\n  - [High Level Design](#high-level-design)\n- [API Documentation](#api-documentation)\n  - [Flask API](#flask-api)\n  - [N8N API](#n8n-api)\n- [Contributions](#contributions)\n- [Citations](#citations)\n\n## Overview\n\nLofi Focus is a chrome extension that automatically generates lo-fi music when browsing articles, blogs, and other sites. The ambient, chilled-out sounds create an enjoyable atmosphere to help users focus while reading.\n\nLofi music, as explored in Justin Wang's study \"Lofi hip-hop radio: Beats to relax/study to\" offers a therapeutic escape for its listeners. The genre serves as a coping mechanism for stress and anxiety, with research suggesting that such music impacts the autonomic nervous system, potentially reducing subconscious stress levels (wang2020lofi, Page 5). Additionally, lofi provides solace during personal losses, with its comforting visuals and tones resonating with the emotions of its audience (wang2020lofi, Page 12). Many also use lofi as calming background music for various tasks, from studying to relaxation (wang2020lofi, Page 12). Furthermore, its nostalgic connection to late '90s and early 2000s anime offers a unique blend of soothing genres, providing listeners with a familiar yet calming auditory experience (wang2020lofi, Page 4).\n\n## Benefits of LoFi Music\n\n- Improves focus and concentration - The chill, repetitive beats help tune out distractions and keep you in a flow state. The lack of jarring changes also avoids breaking focus.\n- Reduces stress and anxiety - The ambient sounds lower heart rate and have a calming effect on the mind and body.\n- Enhances productivity - By helping you focus and relax, lo-fi enables you to work and study more efficiently for longer periods.\n- Sets a peaceful mood - The mellow, nostalgic sounds induce feelings of tranquility and relaxation.\n- Provides unobtrusive background music - As there are no attention-grabbing vocals, it subtly enhances an environment without being distracting.\n- Inspires creativity - The simple compositions are unintimidating and let your mind wander productively.\n- Helps with sleep and relaxation - The soothing tracks are great for relaxing the body and quieting the mind before sleep.\n- Fosters pleasant memories and nostalgia - For many, it evokes nostalgia from times spent studying or relaxing to music.\n\n## Audiocraft to the Rescue\n\nWith Audiocraft we can:\n\n- Create fully AI-generated LoFi tracks tailored to specific use-cases\n- Produce High-quality audio\n- Create endless unique music\n- Train new models tailored to LoFi\n\n## Why Download Our Chrome Extension\n\n- Improve focus and concentration when reading\n- Make reading more enjoyable and relaxing\n- Boost productivity\n- Avoid listening fatigue\n- Portability\n- Ease of use\n- Less anxiety\n- Nostalgia\n\n## How to Install Our Chrome Extension\n\n1. Download the extension files here: https://github.com/KBVE/lofifocus-chrome-extension/releases/latest\n   - You will need to download the files that make up the chrome extension, usually as a zip folder from the developer. This includes the manifest.json file, HTML/CSS/JS assets, and any images or resources.\n2. Unzip the folder containing the extension source files to a location on your computer. You should now have a folder that contains a popup.html, manfiest.json, and several other files.\n3. Open Google Chrome and navigate to `chrome://extensions` in the address bar.\n4. Enable Developer Mode.\n5. Click the \"Load Unpacked\" button and select the folder containing your extracted extension files. This will install the extension in developer mode.\n6. For easy access, click the puzzle icon for your extensions and pin your newly installed extension. This will make it appear as an icon in your browser toolbar.\n\n## Features\n\n- Analyzes webpage content\n- Generates a unique, customized lofi track for that page using AI music generation\n- Allows users to adjust volume, pause, start, play, re-generate Lo-Fi Music\n\n## Implementation\n\n- Built as a Chrome browser extension for ease of use\n- Uses JavaScript content scripts to analyze webpages and play lofi audio\n- Leverages AudioCraft's MusicGen AI model to generate the lofi tracks\n- Polished UI allows easy control over the music generation\n\n## Our Custom Model\nWe collected a dataset of original non-copyright lofi music. This gave us access to a large corpus of high-quality training data without any copyright issues.\n\nWe split the lofi songs into 30 second audio clips and paired each clip with a text prompt describing the mood, instruments, tempo and other qualities of that segment. Examples include \"slow chill hip hop beat with mellow piano and vinyl crackle\" and \"upbeat lofi with energetic drums and warm bassline\".\n\nWe formatted this dataset into the required .wav and .txt file pairs that musicgen_trainer expects. The text prompts would guide the model to learn the nuances of lofi hip hop.\n\nWe then ran musicgen_trainer on this dataset, configuring it to use the small architecture for optimization purposes. We trained for 100 epochs with a learning rate of 1e-5 and batch size of 4.\n\nDuring training, musicgen_trainer used the audio/text pairs to fine-tune MusicGen on lofi music. The pre-trained weights were specialized to generate high quality lofi given descriptive prompts.\n\nAfter training finished, we saved the best performing model checkpoint. We now have a MusicGen variant skilled at generating original lofi tunes according to textual descriptions.\n\n## Goals\n\n- Help people focus and be more productive when reading on the web\n- Provide an ambient audio environment that blocks distracting sounds\n- Make reading more enjoyable and relaxed through chill tunes\n- Give users more options to customize their browsing experience\n\n## Technologies Used\n\n- Audiocraft Music Generation\n- Audiocraft Multi-Band Diffusion\n- Audiocraft Audio Write\n- ChatGPT 3.5-turbo\n- JsonLink\n- Local Tunnel\n- ElevenLabs AI Voice Generation\n- Min.io S3 Storage\n- Python - Poetry - Flask API\n- Node.js - Yarn\n- HTML, CSS (Tailwind)\n- Plasmo Browser Extension Framework\n- Appwrite Backend as a Service\n- Docker - Portainer - Coolify\n- Github Actions (CI/CD)\n- N8N Workflow Automation Tool\n\n## High Level Design\n\n- [x] User visits webpage\n\n- [x] User opens extension\n\n- [x] Browser extension loads ElevenLabs voice clip and says \"Please wait patiently while your LoFi track is loading... We are fetching the contents of the page, generating the necessary prompts, and guiding Audiocraft to generate you ambient and chilled-out LoFi music to create an enjoyable atmosphere to help you focus while reading. Sit back... Relax... and focus on your breathing for next several seconds...\"\n\n- [x] Lofi Focus sends current URL to N8N workflow\n\n- [x] N8N calls JsonLink API to extract URL metadata\n\n- [x] JsonLink returns page metadata to N8N\n\n- [x] N8N sends metadata to ChatGPT API\n\n- [x] ChatGPT generates personalized lofi music prompts\n\n- [x] N8N parses the prompts\n\n- [x] N8N sets generation parameters (prompt, sampling, top_k, MBD, etc)\n\n- [x] N8N calls custom AudioCraft REST API (Python Flask)\n\n- [x] Flask app runs locally and exposes API via LocalTunnel\n\n- [x] Flask app receives inputs and invokes AudioCraft generation\n\n- [x] AudioCraft generates track using MusicGen + RTX 4090 GPU (CUDA)\n\n- [x] Flask API returns .wav file to N8N\n\n- [x] N8N uploads .wav to S3 storage (Min.io)\n\n- [x] N8N sends audio URL to Lofi Focus\n\n- [x] Lofi Focus plays the generated track\n\n# API Documentation\n\n## Flask API\n\nPOST - `https://.../generate_music`\n\n```json\n{\n  \"model_name\": \"facebook/musicgen-small\",\n  \"duration\": 15,\n  \"prompt\": \"LoFi Hip-Hop\",\n  \"strategy\": \"loudness\",\n  \"sampling\": true,\n  \"top_k\": 0,\n  \"top_p\": 0.9,\n  \"temperature\": 0.9,\n  \"use_diffusion\": false\n}\n```\n\n## N8N API\n\nPOST - `https://.../generate-music`\n\n```json\n{\n\t\"url\": \"https://medium.com/@KimWitten/stop-trying-to-manage-your-time-a07b6e45cec8\",\n  \"use_custom\": true, /* optional */\n\t\"use_diffusion\": true, /* optional */\n  \"duration\": 15 /* optional */\n}\n```\n\n# Contributions\n\nhttps://github.com/h0lybyte - Docker, Portainer, Appwrite\n\nhttps://github.com/BChip - Audiocraft, Flask API, N8N Workflow, Eleven\nLabs Voice AI, Documentation\n\nhttps://github.com/Ziggy9263 - Chrome Extension\n\nhttps://github.com/ZachHandley - Custom Audiocraft Model for LoFi\n\nhttps://github.com/8gratitude8 - Presentation, Static Site, Prompt Engineering\n\nhttps://github.com/ernivani - Chrome Extension\n\n# Citations\n\n```\nhttps://ojs.stanford.edu/ojs/index.php/theword/article/view/1705/1326\n@article{wang2020lofi,\n  title={Lofi hip-hop radio: Beats to relax/study to},\n  author={Wang, Justin},\n  journal={The Word: Tha Stanford Journal of Student Hiphop Research},\n  volume={1},\n  number={1},\n  pages={10--23},\n  year={2020}\n}\n\n```\n\n```\n@article{copet2023simple,\n      title={Simple and Controllable Music Generation},\n      author={Jade Copet and Felix Kreuk and Itai Gat and Tal Remez and David Kant and Gabriel Synnaeve and Yossi Adi and Alexandre Défossez},\n      year={2023},\n      journal={arXiv preprint arXiv:2306.05284},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbve%2Flofifocus-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkbve%2Flofifocus-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbve%2Flofifocus-docker/lists"}