Custom recipes with multiple audio ?

Hello everyone,

So, basically, I want to annotate some audio files in a custom recipe. Problem is, I need to annotate multiple audio files at the same time (we're annotating 4 files for each student). Annotation is done only through choice block.

I managed to have different choice blocks, with custom id/labels, and with a custom validation function (in order that each choice block can only have one valid input).
But I don't manage to load 4 different audio at the same time.

Problem is that, I can load multiple audio in the custom stream function ( get_stream() ) and put them in a dic through base64, but I can only """ feed """ one audio to all audio block at the same time ?

If that makes more sense, I have 4 {"view_id": "audio"} in my block of my custom receipe, and I would like to give each of them a different audio file through the yield of the get_stream() function. What would be the best way to do so ?

Kind regards,

Gautier

Hi! If I understand this correctly, your goal is to just be able to play the multiple audio files, right? At the moment, you can only have one native audio block per UI because the interface always reads from the audio key.

However, one option would be to use a native HTML audio player with html blocks instead and provide an HTML template on each block that reads from a different variable in the task:

"html_template": '<audio controls><source src="{{audio1}}" /></audio>'

In your data, you could then do stuff like:

{"audio1": "base64/url here", "audio2": "base64/url here", ...}