Skip to content

Instantly share code, notes, and snippets.

@LTeder
LTeder / piano_transcription.md
Last active March 2, 2024 16:39
MIDI piano transcription from any recording

Using a couple repos with Python, you can transcribe any piano recording to MIDI. Each will use their own environment. Pretty straightforward with conda/mamba.

Both steps incur some loss which affects the quality of the end result. But on any reasonably hi-fi recording since the late 60s you should get acceptable results. Super useful for dumping into Syn/Neothesia.

  1. Start with a folder containing WAV files of the desired songs.

  2. Use Music-Source-Separation-Training's Demucs4HT 6-stem model inference to derive the piano stems. For me this was:

@LTeder
LTeder / cursor_rules.txt
Last active April 16, 2024 16:49
LLM pair programmer custom directions
– Provide accurate line numbers whenever possible
– Provide code in the context of my project when possible
– When generating comments, attempt to match the style of the code provided in context
– Treat me as an intermediate learner
– I’m comfortable with lots of detail
– Briefly suggest areas of improvement whenever applicable
– Consider new technologies and contrarian ideas along with conventional wisdom
– You may use high levels of speculation or prediction, but mention when this is the case
– It is good to present alternatives
@LTeder
LTeder / s3_download_file_progress_bar.py
Last active March 2, 2024 16:45 — forked from wy193777/s3_download_file_progress_bar.py
AWS S3 download_fileobj tqdm progress callback
#python3
BUCKET_NAME = 'your_s3_bucket_name'
FILE_NAME = 'your_s3_file_name'
s3 = boto3.resource('s3')
path = "/tmp/{}".format(FILE_NAME)
file_object = s3.Object(BUCKET_NAME, FILE_NAME)
filesize = file_object.content_length
with tqdm(total=filesize, desc=f'source: s3://{s3_bucket}/{s3_object_key}',
bar_format="{percentage:.1f}%|{bar:25} | {rate_fmt} | {desc}",
@LTeder
LTeder / wandb_update_bests.py
Last active March 2, 2024 16:46
Updates target parameters in all runs of a W&B project to bests as reported by api.run.scan_history()
import wandb
from tqdm import tqdm
WANDB_PROJECT = "project"
TEST_CHANGES = True # Run once before changing
api = wandb.Api()
runs = [run for run in api.runs(WANDB_PROJECT)]
print(f"{len(runs)} runs found")