Original project is by @Ukelele2007. Why use TurboWarp when this is already smooth as heck? --Changelog-------------------------------------------------- 26-08-2025 19:45 (UTC+08:00) I will implement stereo recording if I have time, I have assignments to do.
Music: Tobu - Candyland pt. II Link: http://youtube.com/tobuofficial ---Recording audio-------------------------------------- The Python script below will output the loudness to a text file, which you have to import the text file to the "Loudness" list. Python script to record (save it as RecordSound.py, and use syntax "python3 RecordSound.py <audio_file> 1" (without quotes): Prerequisites are ffmpeg, soundfile, and numpy. To install ffmpeg, if on Windows, open CMD, and type "winget install ffmpeg" (be sure to update App Installer from Microsoft Store). Mac users, set up Homebrew, and type in the terminal "brew install ffmpeg". Linux users, since there are many distros, use its designated package manager. To install soundfile and numpy, install Python 3.13, and type in your terminal "pip install soundfile numpy". import sys import math import numpy as np import soundfile as sf import os def calculate_loudness(samples): if len(samples) == 0: return -0.0 rms = np.sqrt(np.mean(samples ** 2)) if rms == 0: return -float('inf') return 20 * math.log10(rms) # ---- Main ---- if len(sys.argv) < 3: print("Usage: python script.py <filename> <channels>") sys.exit(1) filename = sys.argv[1] desired_channels = int(sys.argv[2]) chunk_length_ms = 10 # chunk size # Read file data, samplerate = sf.read(filename) # Handle mono as shape (N, 1) if len(data.shape) == 1: data = np.expand_dims(data, axis=1) num_channels_in_file = data.shape[1] # Pad with silence if needed if desired_channels > num_channels_in_file: padding = np.zeros((data.shape[0], desired_channels - num_channels_in_file)) data = np.hstack([data, padding]) else: data = data[:, :desired_channels] samples_per_chunk = int(samplerate * chunk_length_ms / 1000) # Create one list per channel loudness_data = [[] for _ in range(desired_channels)] # Process chunks for i in range(0, len(data), samples_per_chunk): chunk = data[i:i+samples_per_chunk, :] for ch in range(desired_channels): loudness = calculate_loudness(chunk[:, ch]) # optional loudness shift loudness_shifted = loudness + 70 if loudness_shifted < 0: loudness_shifted = 0 beat_drop = 10 if loudness > -35 else 0 output_value = loudness_shifted + beat_drop loudness_data[ch].append(output_value) # Write separate text files base_name, ext = os.path.splitext(filename) for ch in range(desired_channels): out_filename = f"{base_name}_loudness_channel_{ch+1}.txt" with open(out_filename, "w") as f: for value in loudness_data[ch]: f.write(f"{value:.2f}\n") print(f"Wrote {out_filename}")