Skip to content

karaoke from youtube into multiple semitones

Notifications You must be signed in to change notification settings

sandipndev/accorde

Repository files navigation

Accorde

A simple web app that splits a youtube karoke video into multiple semitones

Process

How do we calculate the Pitch? Pitch = 2 ^ (n/12) where n is the number of semitones to tweak. For example, if we want to do +1 ST: then Pitch = 2 ^ (1/12) Another example, to do +1 ST: then Pitch = 2 ^ (-1/12)

TL;DR:

yt-dlp -x --audio-format mp3 -o "%(title)s.%(ext)s" <YOUTUBE_LINK>
ffmpeg -i <FILENAME> -filter:a "rubberband=pitch=<PITCH>" output.mp3

Plan:

mutation create_process(URL: YoutubeLink!)
-----------------------------------
(Sanitize Input)
Spawn: Create Download Job
Returns ProcessID

query get_process(id: ProcessID!)
----------------------------
Returns Status of Job

===========================================

Download Job:
yt-dlp -x --audio-format mp3 -o "%(title)s.%(ext)s" <YOUTUBE_LINK>
Spawn: Create STs Job
Update State

STs Job:
ffmpeg -i <FILENAME> -filter:a "rubberband=pitch=<PITCH>" output.mp3
Update State

Docker Compose to run this directly

services:
  server-pg:
    image: postgres:15.5
    ports: [ 5433:5432 ]
    environment: [ POSTGRES_USER=user, POSTGRES_PASSWORD=password, POSTGRES_DB=pg ]
    healthcheck: { test: ["CMD-SHELL", "pg_isready"], interval: 5s, timeout: 30s, retries: 5 }

  accorde:
    image: sandipndev/accorde
    ports: [ 3000:3000 ]
    links: [ server-pg ]
    environment: [ PG_CON=postgresql://user:password@server-pg:5432/pg ]