Skip to content

anildukkipatty/pitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pitch

Pitch-shift the audio of any media file by semitones. Works with MP4, MP3, WAV, and anything else ffmpeg supports.

Available as a CLI tool and a web UI.

Prerequisites

  • Node.js >= 18
  • ffmpeg installed and in PATH (optional: ffmpeg with librubberband for higher quality)

Install

npm install
npm run build

CLI Usage

# Via tsx (development)
npm run dev -- input.mp4 -s +3

# Via built JS
node dist/index.js input.mp4 -s +3 -o output.mp4

# Or link globally
npm link
pitch input.mp4 -s -2

CLI Options

Flag Description
-s, --semitones <n> Pitch shift in semitones (-24 to +24, supports decimals)
-o, --output <path> Output file path (default: <input>.pitch+N.<ext>)

Web UI

npm start
# → http://localhost:3000

Pick a file, set the semitones with the slider, and hit "Pitch Shift". The result downloads directly in the browser.

The port is configurable via the PORT environment variable:

PORT=8080 npm start

Project Structure

src/
  index.ts     CLI entry point (commander)
  server.ts    Web server (node:http, no deps)
  pitch.ts     Core pitch-shift logic
  ffmpeg.ts    ffmpeg detection, probing, execution
  utils.ts     Helpers (semitone math, path generation)
public/
  index.html   Web UI (self-contained, inline CSS/JS)

How It Works

  1. Calculates the frequency ratio from semitones: 2^(semitones/12)
  2. If ffmpeg has librubberband, uses rubberband=pitch=<ratio> (best quality, preserves tempo)
  3. Otherwise, falls back to asetrate + aresample + atempo filter chain
  4. Video streams are copied without re-encoding (-c:v copy)

TODO

See TODO.md for planned improvements.

About

Pitch-shift the audio of any media file — from the terminal or the browser. A lightweight CLI + web UI powered by ffmpeg. Upload a file, dial in the semitones, and download the result. No accounts, no cloud processing, no dependencies beyond Node.js and ffmpeg.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors