| 1484 | } |
| 1485 | |
| 1486 | void mtmd_debug_preprocess_audio(mtmd_context * ctx, const std::vector<float> & samples) { |
| 1487 | if (!ctx->ctx_a) { |
| 1488 | LOG_ERR("%s: model does not support audio input\n", __func__); |
| 1489 | return; |
| 1490 | } |
| 1491 | std::vector<mtmd_audio_mel> mel_spec_chunks; |
| 1492 | bool ok = ctx->audio_preproc->preprocess(samples.data(), samples.size(), mel_spec_chunks); |
| 1493 | if (!ok) { |
| 1494 | LOG_ERR("%s: failed to preprocess audio\n", __func__); |
| 1495 | return; |
| 1496 | } |
| 1497 | LOG_INF("%s: preprocessed audio to %zu mel spec chunks\n", __func__, mel_spec_chunks.size()); |
| 1498 | for (size_t i = 0; i < mel_spec_chunks.size(); i++) { |
| 1499 | LOG_INF("%s: mel spec chunk %zu has n_len=%d, n_mel=%d\n", __func__, i, mel_spec_chunks[i].n_len, mel_spec_chunks[i].n_mel); |
| 1500 | |
| 1501 | // dump mel entries: data is stored as [n_mel][n_len] (mel-major) |
| 1502 | const auto & mel = mel_spec_chunks[i]; |
| 1503 | for (int m = 0; m < mel.n_mel; m++) { |
| 1504 | for (int t = 0; t < mel.n_len; t++) { |
| 1505 | LOG_INF("mel[%zu][m=%d][t=%d] = %f\n", i, m, t, mel.data[m * mel.n_len + t]); |
| 1506 | } |
| 1507 | } |
| 1508 | } |
| 1509 | } |
no test coverage detected