Making Music

Just some notes and tools to help me practice music

Method (Match my Sound) Printing

SoR uses the “Method App”, which you cannot print out of natively.

For Safari, there’s an addon that creates PDFs:

Download YT to MP3

python3.14 yt-dlp -t mp3 "<YT URL>"

Pitch Shifting

When playing in a different key than the original song, it can help to transpose an MP3 for pratice. There seem to be a few online apps that say they can do it, but they mostly don’t work at all, support only limited length audio files, or create super crappy audio. This one works:

Output is a WAV file.

It seems like it’s “just” doing some ffmpeg magic in the background which would be feasible without a browser as well…

    const inputName = "input.mp3";
    const outputName = "output.wav";

    // Load input
    const res = await fetch(furl);
    const inputData = await res.arrayBuffer();
    await ffmpeg.writeFile(inputName, new Uint8Array(inputData));

    const tempo = Number(tempoSlider.value);
    const pitchRatioUI = Number(pitchSlider.value);
    const semitones = Number(keySlider.value);
    const volume = Number(volumeSlider.value);

    const keyPitch = Math.pow(2, semitones / 12);

    const finalPitchRatio = pitchRatioUI * keyPitch;

    const sampleRate = audioBuffer.sampleRate;
    const newSampleRate = sampleRate * finalPitchRatio;

    const correctedTempo = tempo / finalPitchRatio;

    const filterChain =
      `asetrate=${newSampleRate},` +
      `atempo=${correctedTempo},` +
      `volume=${volume}`;

    await ffmpeg.exec([
      "-y",
      "-i", inputName,
      "-af", filterChain,
      outputName
    ]);
    const output = await ffmpeg.readFile(outputName);

    if (!output || output.length === 0) {
      throw new Error("FFmpeg produced empty output");
    }

(from https://audio.pi7.org/static/js/pitch_changer.js)