From 698ac7e7faff107be2d6d668ed189c22d600fe71 Mon Sep 17 00:00:00 2001 From: Sting <loic.allegre@ensiie.fr> Date: Fri, 21 Jul 2023 13:10:41 +0200 Subject: [PATCH] Update README + plot_syls --- README.md | 20 +++++++++++++++----- plot_syls.py | 17 ++++++++++++----- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5adecf4..9471adb 100644 --- a/README.md +++ b/README.md @@ -73,17 +73,21 @@ Having a CUDA-capable GPU is optional, but can greatly reduce processing time in ## Autokara -To execute AutoKara from scratch on a MKV video file : +To use Autokara, you need : + - A media file of the song (video, or pre-extracted vocals) + - An ASS file with the lyrics, split by syllable + +To execute AutoKara on a MKV video file and an ASS file containing the lyrics (ASS will be overwritten): ```bash -$ python autokara.py video.mkv output.ass +$ python autokara.py video.mkv lyrics.ass ``` -To execute AutoKara with existing syl splits and line timings : +To output to a different file (and keep the original) : ```bash -$ python autokara.py video.mkv output.ass --ref reference.ass +$ python autokara.py video.mkv lyrics.ass -o output.ass ``` -To execute AutoKara on a (pre-extracted) WAV vocals file : +To execute AutoKara on a (pre-extracted) WAV (or OGG, MP3, ...) vocals file, pass the `--vocals` flag : ```bash $ python autokara.py vocals.wav output.ass --vocals ``` @@ -110,6 +114,12 @@ Batch preprocessing (vocals + ASS extraction) of all videos in a directory : $ ./preprocess_media.sh video_folder output_folder ``` +A visualization tool, mainly intended for debug. +Does the same as autokara.py, but instead of writing to a file, plots a graphic with onset times, spectrogram, probability curves,... +Does not work on video files, only separated vocals audio files +```bash +$ python plot_syls.py vocals.wav lyrics.ass +``` diff --git a/plot_syls.py b/plot_syls.py index 527c1e4..e869604 100644 --- a/plot_syls.py +++ b/plot_syls.py @@ -5,6 +5,7 @@ import re import matplotlib.pyplot as plt import scipy.signal as sg import parselmouth +import argparse from autosyl.assUtils import getSyls, timeToDate, dateToTime from autosyl.LyricsAlignment.wrapper import align, preprocess_from_file @@ -19,11 +20,17 @@ from autosyl.LyricsAlignment.wrapper import align, preprocess_from_file # ############################################################################## -songfile = sys.argv[1] -if(len(sys.argv) >= 3): - reference_syls = getSyls(sys.argv[2]) -else: - reference_syls = None + +parser = argparse.ArgumentParser(description='AutoKara - Automatic karaoke timing tool') +parser.add_argument("vocals_file", type=str, help="The audio file to time") +parser.add_argument("ass_file", type=str, help="The ASS file with lyrics to time") + +args = parser.parse_args() + + +songfile = args.vocals_file +reference_syls, line_meta = getSyls(sys.argv[2]) + print(reference_syls) -- GitLab