daft.functions.audio_metadata#
audio_metadata #
audio_metadata(file_expr: Expression) -> Expression
Get metadata for a audio file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_expr | AudioFile Expression | The audio file to get metadata for. | required |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Struct Expression | A struct containing the metadata |
Expression | of the audio file. | |
Expression | The struct contains the following fields: - sample_rate: int - The sample rate of the audio file - channels: int - The number of channels in the audio file - frames: int - The number of frames in the audio file - format: str - The format of the audio file - subtype: str | None - The subtype of the audio file |
Examples:
1 2 | |
1 2 | |
1 2 3 4 5 6 | |
╭────────────────────────────────┬─────────┬──────────────────────────────────────────────────────────────────────╮
│ path ┆ size ┆ metadata │
│ --- ┆ --- ┆ --- │
│ String ┆ Int64 ┆ Struct[sample_rate: Int64, channels: Int64, frames: Float64, format: │
│ ┆ ┆ String, subtype: String] │
╞════════════════════════════════╪═════════╪══════════════════════════════════════════════════════════════════════╡
│ hf://datasets/Eventual-Inc/sa… ┆ 822924 ┆ {sample_rate: 16000, │
│ ┆ ┆ channels… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/Eventual-Inc/sa… ┆ 618408 ┆ {sample_rate: 16000, │
│ ┆ ┆ channels… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ hf://datasets/Eventual-Inc/sa… ┆ 1190736 ┆ {sample_rate: 16000, │
│ ┆ ┆ channels… │
╰────────────────────────────────┴─────────┴──────────────────────────────────────────────────────────────────────╯
(Showing first 3 rows) Source code in daft/functions/audio.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |