docs: add proposition to karaoke exercise

This commit is contained in:
AL-FAHAMI 2025-04-25 21:26:15 +01:00
parent 307a5eaaa2
commit 7d832c9df7

View File

@ -99,4 +99,39 @@ Before providing the API specs for the second type of the exercises page, there'
**Problem:** Flexibility in handling audio. **Problem:** Flexibility in handling audio.
**Option:** Provide both a file path and Base64-encoded audio in the JSON. **Option:** Provide both a file path and Base64-encoded audio in the JSON.
--- ---
### **Proposition of the Karaoke Exercise JSON Structure**
This proposition uses one solution of the different design challenges mentioned above and is designed for a karaoke type exercise where audio is associated with tasks that guide the user through the exercise. The **audio** path points to the MP3 file used in the exercise. Each task contains a segment of the lyrics that should be highlighted in sync with the audio playback.
In this structure:
- The **audio** is stored as a file path to the MP3.
- The **tasks** are broken down by segments of the audio, and each segment corresponds to a specific time range defined by **start_time** and **end_time**.
- The **highlighted_text** field will now represent **words** rather than full sentences, providing more granular control for highlighting.
Heres the updated JSON example:
```json
{
"exercise_id": 1,
"title": "Karaoke Exercise",
"audio": "/path/to/audio/file/karaoke_exercise.mp3",
"tasks": [
{
"id": 1,
"text": "The lyrics of the audio content subtask",
"start_time": 0,
"end_time": 30,
"highlighted_text": "The first word of the first sentence"
},
{
"id": 2,
"text": "Continue with the next part of the lyrics",
"start_time": 31,
"end_time": 60,
"highlighted_text": "The first line of the second part of the audio"
}
]
}
```