to_filewise_index()¶
- audformat.utils.to_filewise_index(obj, root, output_folder, *, num_workers=1, progress_bar=False)[source]¶
Convert to filewise index.
If input is segmented, each segment is saved to a separate file in
output_folder
. The directory structure of the original data is preserved withinoutput_folder
. If input is filewise no action is applied.- Parameters
obj (
Union
[Index
,Series
,DataFrame
]) – object conform to table specificationsroot (
str
) – path to root folder of data. Even if the file paths offrame
are absolute, this argument is needed in order to reconstruct the directory structure of the original dataoutput_folder (
str
) – path to folder of the created audio segments. If it’s relative (absolute), then the file paths of the returned data frame are also relative (absolute)num_workers (
int
) – number of threads to spawnprogress_bar (
bool
) – show progress bar
- Return type
- Returns
object with filewise index
- Raises
ValueError – if
output_folder
contained in path to files of original data
Examples
>>> index = segmented_index( ... files=["f.wav", "f.wav"], ... starts=[0, 0.5], ... ends=[0.5, 1], ... ) >>> to_filewise_index(index, ".", "split") Index(['split/f_0.wav', 'split/f_1.wav'], dtype='string', name='file')