AmbiRead is a web application that generates ambient background music for different scenes in a book. It uses the Replicate API to generate music and outlines for the scenes based on the provided prompts.
This project was created for the DIGCRE course at HSLU.
The application consists of the following main components:
- Frontend: The user interface where users can select a book, navigate through its pages, and listen to the generated ambient music.
- Backend: Handles the API requests to generate music and outlines using the Replicate API.
- Book Selection: Users select a book from the available options.
- Scene Description Generation: For each page of the book, a scene description is generated.
- Music Generation: The scene description is sent to the backend, which uses the Replicate API to generate ambient music.
- Music Playback: The generated music is played in the background as the user reads the book.
First, you need to have Node.js and NPM installed on your computer. You can download them from here.
Then follow these steps:
-
Clone this repository:
git clone <repository-url> cd <repository-directory>
-
Install the dependencies:
npm install
-
Create a file
.env.local
containing this line:REPLICATE_API_TOKEN=<add token here>
-
Run the development server:
npm run dev
Now you should be able to access the page on http://localhost:3000.
- app/generate-music/route.js: Handles the music generation requests.
- app/generate-outline/route.js: Handles the outline generation requests.
- app/page.js: The main page component where users can interact with the application.
- app/layout.js: The root layout component.
- app/globals.css: Global CSS styles.
- app/page.module.css: CSS module for styling the main page.
- package.json: Contains the project dependencies and scripts.
- README.md: Project documentation.
REPLICATE_API_TOKEN
: The API token for accessing the Replicate API.
- next: The Next.js framework.
- react: The React library.
- react-dom: The React DOM library.
- replicate: The Replicate API client.
npm run dev
: Runs the development server.npm run build
: Builds the application for production.npm run start
: Starts the production server.npm run lint
: Runs the linter.