Skip to content

daft.functions.audio_file#

audio_file #

audio_file(url: Expression, verify: bool = False, io_config: IOConfig | None = None) -> Expression

Converts a string containing a file reference to a daft.AudioFile reference.

Parameters:

Name Type Description Default
url String Expression

the url of the file

required
verify bool

If True, verify that the file exists and is a audio file. If ANY files are not audios, this will produce an error.

False
io_config IOConfig, default=None

The IO configuration to use.

None

Returns:

Name Type Description
Expression File[Audio] Expression

An expression containing the file reference.

Source code in daft/functions/file_.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
def audio_file(url: Expression, verify: bool = False, io_config: IOConfig | None = None) -> Expression:
    """Converts a string containing a file reference to a `daft.AudioFile` reference.

    Args:
        url (String Expression): the url of the file
        verify:
            If True, verify that the file exists and is a audio file.
            If **ANY** files are not audios, this will produce an error.

        io_config (IOConfig, default=None): The IO configuration to use.

    Returns:
        Expression (File[Audio] Expression): An expression containing the file reference.

    """
    return url._eval_expressions("audio_file", verify=verify, io_config=io_config)