vllm.multimodal.media.audio ¶
Classes:
-
AudioEmbeddingMediaIO–Configuration values can be user-provided either by --media-io-kwargs or
-
AudioMediaIO–Configuration values can be user-provided either by --media-io-kwargs or
Functions:
-
load_audio_pyav–Load an audio file using PyAV (FFmpeg), returning float32 mono waveform.
-
load_audio_soundfile–Load audio via soundfile
AudioEmbeddingMediaIO ¶
Configuration values can be user-provided either by --media-io-kwargs or by the runtime API field "media_io_kwargs". Ensure proper validation and error handling.
Source code in vllm/multimodal/media/audio.py
AudioMediaIO ¶
Bases: MediaIO[tuple[NDArray, float]]
Configuration values can be user-provided either by --media-io-kwargs or by the runtime API field "media_io_kwargs". Ensure proper validation and error handling.
Source code in vllm/multimodal/media/audio.py
load_audio_pyav(path, *, sr=22050, mono=True, max_duration_s=None) ¶
Load an audio file using PyAV (FFmpeg), returning float32 mono waveform.
Decodes the audio stream at its native sample rate. Channel reduction to mono is performed by averaging across channels. Resampling to a model-specific rate is left to the downstream :class:AudioResampler.
Parameters:
-
(path¶BytesIO | Path | str) –A :class:
~io.BytesIObuffer, a filesystem :class:~pathlib.Path, or a string path. -
(max_duration_s¶float | None, default:None) –If set, abort decoding once the accumulated sample count exceeds this many seconds of audio. Prevents decompression-bomb attacks where a small compressed file expands into gigabytes of PCM.
Returns:
-
NDArray–(waveform, sample_rate)where waveform is a 1-D float32 -
float–NumPy array and sample_rate is the native sample rate in Hz.
Source code in vllm/multimodal/media/audio.py
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
load_audio_soundfile(path, *, sr=22050, mono=True, max_duration_s=None) ¶
Load audio via soundfile