Caution

You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.9.1.

librosa.output.times_csv

librosa.output.times_csv(path, times, annotations=None, delimiter=',', fmt='%0.3f')[source]

Save time steps as in CSV format. This can be used to store the output of a beat-tracker or segmentation algorithm.

If only times are provided, the file will contain each value of times on a row:

times[0]\n
times[1]\n
times[2]\n
...

If annotations are also provided, the file will contain delimiter-separated values:

times[0],annotations[0]\n
times[1],annotations[1]\n
times[2],annotations[2]\n
...

Warning

This function is deprecated in librosa 0.7.0. It will be removed in 0.8.

Parameters
pathstring

path to save the output CSV file

timeslist-like of floats

list of frame numbers for beat events

annotationsNone or list-like

optional annotations for each time step

delimiterstr

character to separate fields

fmtstr

format-string for rendering time

Raises
ParameterError

if annotations is not None and length does not match times

Examples

Write beat-tracker time to CSV

>>> y, sr = librosa.load(librosa.util.example_audio_file())
>>> tempo, beats = librosa.beat.beat_track(y, sr=sr, units='time')
>>> librosa.output.times_csv('beat_times.csv', beats)