Commit 66c3dea
authored
Add a wav loader (#14923)
This pull request adds support for loading and processing `.wav` audio
files in the multimodal runner, alongside existing `.bin` file support.
It introduces a dedicated WAV loader utility, updates the runner to
dispatch audio file processing based on file type, and adds
comprehensive tests for WAV file parsing and normalization. These
changes improve flexibility and robustness when handling audio inputs.
**WAV file support and audio processing:**
* Added a new utility `wav_loader.h` that provides functions to parse
WAV file headers and load normalized PCM audio data from `.wav` files,
supporting 16-bit and 32-bit PCM formats.
* Updated `multimodal.cpp` to support loading audio from both `.bin` and
`.wav` files, including input validation and error handling for
unsupported formats. The runner now uses the processor for both file
types and enforces processor requirements for `.wav` files.
[[1]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843L138-R149)
[[2]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843L166-R191)
[[3]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843R247-L255)
* Added a new command-line flag `data_path` and passed it to the
multimodal runner to facilitate data file handling.
[[1]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843R38)
[[2]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843R294)
[[3]](diffhunk://#diff-0ac16dbe4eaefa08e21fbda582fe2cd2b482f43aaedfc1bf2f31becf5e7bb843L297-R322)
**Testing and build integration:**
* Introduced `test_wav_loader.cpp`, which provides unit tests for WAV
header parsing, sample normalization, error handling, and unsupported
format detection.
* Registered the new utility and tests in build configuration files,
ensuring proper header exports and test coverage.
[[1]](diffhunk://#diff-8a73187dfda9c5479db6911bee649164ff4434d36e8f4eb881cc1f049c4e3271R108)
[[2]](diffhunk://#diff-24b61cfeb7f1fc9a646df385ece0c31ea2ab18b3c7e34fc62117c62538e111ffL22-R22)
[[3]](diffhunk://#diff-c8ef93f128805fc48fe2d7c1dadb9ff5d2f4dc5ee7c00b638fd193d3dfb1f06cR47-R56)
[[4]](diffhunk://#diff-d755455ed59da7a902bb5a5c1e540a1924f63e8f70a9dc78b455f2c569a19db6R17)1 parent d0827e5 commit 66c3dea
File tree
8 files changed
+460
-45
lines changed- examples/models/voxtral
- extension
- llm/runner
- test
- testing_util
8 files changed
+460
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
73 | 87 | | |
74 | | - | |
75 | | - | |
| 88 | + | |
76 | 89 | | |
77 | 90 | | |
78 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
116 | | - | |
117 | | - | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | | - | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
138 | 175 | | |
139 | 176 | | |
140 | 177 | | |
| |||
153 | 190 | | |
154 | 191 | | |
155 | 192 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 193 | | |
176 | 194 | | |
177 | 195 | | |
| |||
226 | 244 | | |
227 | 245 | | |
228 | 246 | | |
| 247 | + | |
229 | 248 | | |
230 | 249 | | |
231 | 250 | | |
232 | 251 | | |
233 | 252 | | |
234 | | - | |
235 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
236 | 256 | | |
237 | 257 | | |
238 | 258 | | |
239 | 259 | | |
240 | 260 | | |
241 | 261 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
249 | 273 | | |
| 274 | + | |
250 | 275 | | |
251 | | - | |
252 | | - | |
253 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
254 | 279 | | |
255 | | - | |
256 | 280 | | |
257 | 281 | | |
258 | 282 | | |
| |||
267 | 291 | | |
268 | 292 | | |
269 | 293 | | |
| 294 | + | |
270 | 295 | | |
271 | 296 | | |
272 | 297 | | |
| |||
294 | 319 | | |
295 | 320 | | |
296 | 321 | | |
297 | | - | |
| 322 | + | |
298 | 323 | | |
299 | 324 | | |
300 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments