Skip to content
Yohan Chalier edited this page Jul 5, 2023 · 1 revision

Instead of specifying a visual handler, you may specify a tool as argument for beatviewer:

python -m beatviewer <Tool Name> <Tool Args>

Possible names are annotator, directogram and dummy.

Content

Directogram Computation

The directogram takes a video (or GIF) file as input, computes its directogram and extracts checkpoints that can be used for the warp visualizer. It outputs a JSON file next the video file. It implements a technique described in Visual Rhythm and Beat, Davis, 2018.

Argument Default Description
path Path to the video file
skip-directogram False Set this flag to skip directogram computation, and reuse saved data
average-period 1.0 Length in seconds of the window for computating signal average and standard deviation
maximum-period 0.15 Length in seconds of the window for computatig signal local maxima
sigma 2.0 Threshold to detect a checkpoint, as a number of std above the mean

The first step, directogram computation, takes a lot of time, while the second step, checkpoints extraction, requires a lot of finetuning. A practical way to use this then is to run the script once: the output JSON file will contain the directogram. Then run the script again with the -s flag to skip the directogram computation, and tune the checkpoint extraction parameters as much as you want.

Video Annotator

I find the Directogram Computation inneficient: it takes a lot of time to compute and the result is not very accurate. The video annotator script uses Pygame to allow doing this work manually in an very time efficient way. It takes the path to the video to annotate as input, and uses very basic key controls:

Key Function
Right Go to next frame
Left Go to previous frame
Ctrl + Right Go to next checkpoint
Ctrl + Left Go to previous checkpoint
Ctrl + A Gox to first frame
Ctrl + E Go to last frame
Shift (hold) Move one frame/checkpoint at a time
Alt (hold) Move as fast as possible
Space (hold) Warped playback at 100 BPM
Enter Toggle checkpoint
Ctrl + S Save to JSON
Escape Exit
Ctrl + W Exit
Argument Default Description
path Path to the video file
size 900 Maximum size of the window
buffer-before 30 Number of frames stored in the buffer before its cursor
buffer-after 30 Number of frames stored in the buffer after its cursor
buffer-margin 120 Number of frames above the default buffer size to trigger the cleanup

Dummy Tracker

To make developping visualizers easier, I added a dummy beat tracker. Give it a target BPM and then pass visualizers arguments as you would for the real beat tracker. The dummy tracker will then regurlarly send fake BPM and BEAT messages down the multiprocessing pipe.

Argument Default Description
bpm Target BPM (might not be very precise)
onsets False Send onsets every beat and half beat
print False Print beat to stdout
beep False Make noise when a beat occurs
keyboard False Enable keyboard shortcuts (PageUp and PageDown for increasing or decreasing the BPM)
Clone this wiki locally