Warning
this project was written with ai based on a proof of concept python file
CodecMerger is a web-based tool that allows users to merge multiple audio files directly in their browser. It aims to provide a simple drag-and-drop interface for combining audio tracks, leveraging client-side processing for speed and privacy. The core audio processing logic for aligning, mixing, and normalizing audio is inspired by concepts from a Python proof-of-concept.
The application is built with Svelte and Vite, using ffmpeg.wasm for all in-browser audio manipulation tasks. bun is used as the JavaScript runtime, bundler, and package manager.
- Client-Side Processing: All audio processing happens in the user's browser; no files are uploaded to a server.
- Drag & Drop Interface: Easily add audio files to be processed.
- Multi-Format Support: Leverages
ffmpeg.wasmto support a wide range of audio codecs and containers. - Audio Alignment: (Planned) Implements techniques to align audio signals for coherent mixing.
- Audio Mixing: (Planned) Combines multiple audio tracks into one.
- Normalization: (Planned) Normalizes the final mixed audio to a standard peak level.
- Configurable
ffmpeg.wasm: Option to toggle multi-threadedffmpeg.wasmexecution. - GitHub Pages Deployment: Automated deployment pipeline using GitHub Actions.
- Frontend: Svelte, SvelteKit
- Build Tool: Vite
- Audio Processing:
ffmpeg.wasm(@ffmpeg/ffmpeg,@ffmpeg/coreor@ffmpeg/core-mt,@ffmpeg/util) - Runtime & Package Manager: Bun
- Styling: Plain CSS (as per
+page.svelte) - Linting/Formatting: ESLint, Prettier
- Version Control: Git, GitHub
- Deployment: GitHub Pages, GitHub Actions
- Bun (JavaScript runtime, bundler, package manager)
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git # <-- Update this URL cd your-repo-name
-
Install dependencies using Bun:
bun install
To start the development server:
bun run devThis will typically open the application in your web browser at http://localhost:5173.
To create a production build of the application:
bun run buildThe output files will be generated in the build directory. This command is also used by the deployment script.
To preview the production build locally (after running bun run build):
bun run previewThis project is configured for automated deployment to GitHub Pages using a GitHub Actions workflow (.github/workflows/deploy.yml).
How it works:
- On pushes to the
mainbranch (or your configured default branch), the GitHub Action will:- Checkout the code.
- Set up Bun.
- Install dependencies.
- Update
svelte.config.jsandvite.config.tswith the correct repository name for thebasepath (using theGITHUB_REPOSITORYvariable). - Build the SvelteKit application in production mode (which uses
@sveltejs/adapter-static). - Upload the build artifact.
- Deploy the artifact to GitHub Pages.
Repository Configuration for GitHub Pages:
- In your GitHub repository settings, under "Pages":
- Set "Source" to "GitHub Actions".
Base Path Configuration:
The svelte.config.js and vite.config.ts files are configured to set the correct base path for GitHub Pages deployment. The workflow automatically updates a placeholder REPLACE_WITH_YOUR_REPO_NAME with your actual repository name. If you manually changed this placeholder to your repository name, the script will still run but won't find the placeholder to replace, which is fine.
Example (svelte.config.js):
paths: {
base: process.env.NODE_ENV === 'production' ? '/your-repo-name' : '',
}Example (vite.config.ts):
const repoName = 'your-repo-name';
// ...
base: mode === 'production' ? `/${repoName}/` : '/',ffmpeg.wasmcan utilizeSharedArrayBufferfor multi-threaded performance (@ffmpeg/core-mt).SharedArrayBufferrequires specific HTTP headers for cross-origin isolation:Cross-Origin-Opener-Policy: same-originCross-Origin-Embedder-Policy: require-corp
- The
vite.config.tsincludes these headers for the local development server. - GitHub Pages does not allow setting custom HTTP headers. This means the multi-threaded version of
ffmpeg.wasmmight not work as expected or at all when deployed to GitHub Pages.- The application includes a toggle for multithreading. It is advisable to test this behavior on the deployed GitHub Pages site.
- If multithreading is essential and does not work on GitHub Pages, consider alternative hosting platforms that allow custom headers (e.g., Netlify, Vercel, Cloudflare Pages) or investigate service worker-based solutions for COOP/COEP headers.
This project exclusively uses bun as its JavaScript runtime, bundler, and package manager.
- DO NOT use
npm,npx,yarn, or any other package managers. - All scripts and commands should be executable via
bun(e.g.,bun install,bun run dev). - The lockfile is
bun.lockb.
This README was generated with assistance from an AI pair programmer.