Skip to content

Commit

Permalink
docs: readme and buncha otha stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixNgFender committed Apr 21, 2024
1 parent df5b511 commit 5149f19
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 23 deletions.
77 changes: 77 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# General
# Manually handle Node.js signals for graceful shutdowns and uncaught exceptions
NEXT_MANUAL_SIG_HANDLE=true
# Next.js server parameters
PROTOCOL=http
HOST=localhost
APP_PORT=3000


# Authentication
AUTH_COOKIE_DURATION_S=86400
# Google OAuth client ID
GOOGLE_CLIENT_ID=
# Google OAuth client secret
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/sign-in/google/callback
# GitHub OAuth client ID
GITHUB_CLIENT_ID=
# GitHub OAuth client secret
GITHUB_CLIENT_SECRET=


# Logging
APP_LOGGING=true
# Possible values are detailed in `src/config/env.ts`
LOG_LEVEL=debug


# Rate limiting
ENABLE_RATE_LIMIT=false


# Captcha
NEXT_PUBLIC_ENABLE_CAPTCHA=false
NEXT_PUBLIC_CAPTCHA_SITE_KEY=
CAPTCHA_SECRET_KEY=


# Email
ENABLE_EMAIL=false
AWS_REGION=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=


# Analytics
ENABLE_ANALYTICS=false
UMAMI_SCRIPT_URL=
UMAMI_ANALYTICS_ID=


# Database
DATABASE_LOGGING=false
DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres
REDIS_URL=redis://127.0.0.1:6379/0


# S3
S3_ENDPOINT=minio
S3_PORT=9000
S3_USE_SSL=false
S3_ACCESS_KEY=minio
S3_SECRET_KEY=miniosecret
S3_BUCKET_NAME=mu2mi-assets
S3_PRESIGNED_URL_EXPIRATION_S=900


# Replicate
# API token and webhook secret can be generated in the Replicate account settings
REPLICATE_API_TOKEN=
REPLICATE_WEBHOOK_SECRET=
MUSIC_GENERATION_MODEL_VERSION=b05b1dff1d8c6dc63d14b0cdb42135378dcb87f6373b0d3d341ede46e59e2b38
STYLE_REMIX_MODEL_VERSION=0b769f28e399c7c30e4f2360691b9b11c294183e9ab2fd9f3398127b556c86d7
TRACK_SEPARATION_MODEL_VERSION=25a173108cff36ef9f80f854c162d01df9e6528be175794b81158fa03836d953
TRACK_ANALYSIS_MODEL_VERSION=001b4137be6ac67bdc28cb5cffacf128b874f530258d033de23121e785cb7290
MIDI_TRANSCRIPTION_MODEL_VERSION=a7cf33cf63fca9c71f2235332af5a9fdfb7d23c459a0dc429daa203ff8e80c78
LYRICS_TRANSCRIPTION_MODEL_VERSION=3ab86df6c8f54c11309d4d1f930ac292bad43ace52d10c80d87eb258b3c9f79c
105 changes: 105 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Contributing to Mu2Mi

Mu2Mi welcomes contributions from the community. There are many ways to get involved!

## Provide Feedback

You might find things that can be improved while you are using Mu2Mi. You can help by [submitting an issue](https://github.com/FelixNgFender/Mu2Mi/issues/new) when:

- Mu2Mi crashes, or you encounter a bug that can only be resolved by refreshing the browser.
- An error occurs that is unrecoverable, causes data integrity problems or loss, or generally prevents you from using Mu2Mi.
- A new feature or an enhancement to an existing feature will improve the utility or usability of Mu2Mi.

Before creating a new issue, please confirm that an existing issue doesn't already exist.

## Participate in the Community

You can engage with the community by:

- Helping other users on [Discord](https://discord.gg/7BkTD7RNRG).
- Improving documentation
- Participating in general discussions about open source, music, and AI
- Authoring new Mu2Mi features

## Contributing Code

You can contribute to Mu2Mi by:

- Enhancing current functionality
- Fixing bugs
- Adding new features and capabilities

Before starting your contribution, especially for core features, I encourage you to reach out to me on [Discord](https://discord.gg/7BkTD7RNRG). This allows me to ensure that your proposed feature aligns with the project's roadmap and goals. Developers are the key to making Mu2Mi the best tool it can be, and I value input from the community.

I look forward to working with you to improve Mu2Mi.

### Steps to Contribute Code

Follow the following steps to ensure your contribution goes smoothly.

1. Fork the repository to your GitHub account.
2. Clone the forked repository to your local machine.
3. Create a new branch for your feature or bug fix.
4. Commit your changes to your branch.
5. Push your changes to your fork on GitHub.
6. Create a pull request to the main repository.
7. Wait for the maintainers to review your pull request.
8. Make any necessary changes to your pull request.
9. Once your pull request is approved, it will be merged into the main repository.
10. Celebrate your contribution to Mu2Mi!

### Development Environment

#### Prerequisites

- Node.js v21.6.1
- Docker
- Docker Compose

#### Setting Up Your Development Environment

Mu2Mi is built with Next.js, PostgreSQL, Minio, and Redis. The development environment is orchestrated with Docker Compose. To set up your development environment:

1. Have the required dependencies installed on your machine and the repository cloned.
2. Create a `.env` file in the root directory of the project. Use the `.env.example` file as a template and fill out the values required. The `.env.example` file has some default values that you can use. Rate limiting, captcha, email, and analytics are disabled by default in development. You can view the [environment variable schema](src/config/env.ts) to see which are required for booting up the Next.js server.

```bash
cp .env.example .env
```

3. Run `make up` to start the development environment. *Quick tip: The `Makefile` and `compose.yaml` files are used to manage the development environment and contain other useful commands*.
4. Run `npm i` to install the project dependencies.
5. Run `npm run dev` to start the development server.
6. Visit `http://localhost:3000` in your browser to view the application.
7. Run `make down` to stop the development environment.
8. (Optional) Run `make clean` to remove all persistent Docker volumes and images.

#### Testing Track Processing Functionality

To test out track processing functionality that uses Replicate service, you will need to have Replicate API token and webhook secret, which can be generated in your Replicate account settings, configured as environment variables in your `.env` file. And you will also need to set up tunnels using either [ngrok](https://ngrok.com/) or [localtunnel](https://localtunnel.github.io/www/). The two tunnels needed should be set up for the following ports:

- 3000 (Next.js)
- 9000 (Minio)

Once the tunnels are set up, update these variables in your `.env`:

- `PROTOCOL` to `https`
- `HOST` to the Next.js tunnel URL
- `APP_PORT` to `443` for `https` connection
- `S3_ENDPOINT` to the Minio tunnel URL
- `S3_PORT` to `443` for `https` connection
- `S3_USE_SSL` to `true` for `https` connection

You may also need to restart the Next.js server to apply the changes.

### Codebase Overview

#### Data Access Layer

Exported functions in the `src/models` directory are ready to be consumed in Route Handlers, Server Actions, and Server Components. They act as a data access layer and interact with the database.

#### Data Fetching and Mutation

Server Components get their data from queries in `queries.ts` files, re-export queries from `actions.ts` to get them inside the `'use server'` boundary, which enables the use of `useQuery` and `useMutation` hooks in Client Components. Route Handlers should be wrapped with `withErrorHandling` in [the error module](src/lib/error.ts) to handle errors.

Server Actions in `actions.ts` files. Server Actions should be wrapped with either `action` or `authAction` in [the safe-action module](src/lib/safe-action.ts) to handle errors and add the current user and session to the context.
96 changes: 73 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,86 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
<div align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/FelixNgFender/Mu2Mi/raw/main/src/app/opengraph-image.png">
<img alt="Mu2Mi logo" src="https://github.com/FelixNgFender/Mu2Mi/raw/main/src/app/opengraph-image.png" width="100%">
</picture>
</div>

## Getting Started
<br><br>

First, run the development server:
<div align="center">

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Issues - Mu2Mi](https://img.shields.io/github/issues/FelixNgFender/Mu2Mi)](https://github.com/FelixNgFender/Mu2Mi/issues)
![GitHub Release](https://img.shields.io/github/v/release/FelixNgFender/Mu2Mi)

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
![Lint](https://github.com/FelixNgFender/Mu2Mi/actions/workflows/lint.yml/badge.svg)

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
</div>

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
<h1 align="center">The Open Source AI Musical Toolkit</h1>
<div align="center">
Mu2Mi is an open source, AI-powered toolkit for all your musical needs. Remove vocals, isolate instruments, transcribe lyrics and instruments, generate and remix songs.
</div>
</br>

## Learn More
<p align="center">
<a href="https://github.com/FelixNgFender/Mu2Mi/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=%F0%9F%90%9B+Bug+Report%3A+">Report Bug</a>
·
<a href="https://github.com/FelixNgFender/mu2mi/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.md&title=%F0%9F%9A%80+Feature%3A+">Request Feature</a>
·
<a href="https://discord.gg/7BkTD7RNRG">Join Our Discord</a>
·
<a href="https://twitter.com/felixcantcode">Twitter</a>
</p>

To learn more about Next.js, take a look at the following resources:
<!-- TODO: Replace with GIF demo -->
<div align="center"><img src="https://github.com/FelixNgFender/Mu2Mi/raw/main/demo.png" width="80%" ></div>

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
## Features

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
- **Music Generation**: Craft unique compositions from text or melodies.
- **Style Remix**: Remix and reimagine a track in various music styles.
- **Track Separation**: Isolate vocals and instruments within a track.
- **Track Analysis**: Analyze the tempo, key, and structure of a musical piece.
- **MIDI Transcription** : Convert audio to MIDI data.
- **Lyrics Transcription**: Transcribe lyrics of any language from audio recordings into text and translate lyrics of any language to English.
- **Audio Preview**: Preview audio files in the browser.
- **MIDI Preview**: Preview MIDI files in the browser.
- **Track Download**: Download processed tracks in a zip.
- **Track Sharing**: Share tracks with others through a public link.

## Deploy on Vercel
## Contributing

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Navigate to the [contributing guide](CONTRIBUTING.md) to get started.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
## Self-Hosting

To self-host Mu2Mi, follow the instructions in the [self-hosting guide](SELF_HOSTING.md).

## Credits

Major thanks to the following open-source projects for making this possible:

- [Next.js](https://github.com/vercel/next.js)
- [MusicGen](https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md)
- [BTC](https://github.com/jayg996/BTC-ISMIR19)
- [Demucs](https://github.com/facebookresearch/demucs)
- [All-In-One Music Structure Analyzer](https://github.com/mir-aidj/all-in-one#all-in-one-music-structure-analyzer)
- [PyTSMod](https://github.com/KAIST-MACLab/PyTSMod)
- [Basic Pitch](https://github.com/spotify/basic-pitch)
- [Whisper](https://github.com/openai/whisper)
- [Waveform Playlist](https://github.com/naomiaro/waveform-playlist)
- [magenta-js](https://github.com/magenta/magenta-js/tree/master/music)

## License

This repository contains Mu2Mi, covered under the [MIT License](LICENSE), except where noted.

## Code of Conduct

This project has adapted the Code of Conduct from the [Contributor Covenant](https://www.contributor-covenant.org/). For more information see the [Code of Conduct](CODE_OF_CONDUCT.md) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Questions

For more information on how to use, develop, and self-host Mu2Mi, join our community on
[Discord](https://discord.gg/7BkTD7RNRG).
5 changes: 5 additions & 0 deletions SELF_HOSTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Self-Hosting Mu2Mi

Full self-hosting capability is on the roadmap for Mu2Mi. The only online dependency left are the AI models currently served by [Replicate](https://replicate.com).

In the meantime, you can run Mu2Mi locally for development purposes. To do so, follow the steps detailed in the [Development Environment](CONTRIBUTING.md#development-environment) section of the contributing guide.
Binary file added demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5149f19

Please sign in to comment.