diff --git a/lal-api-design.md b/lal-api-design.md index 5df6fd6..6af3bdb 100644 --- a/lal-api-design.md +++ b/lal-api-design.md @@ -99,4 +99,39 @@ Before providing the API specs for the second type of the exercises page, there' **Problem:** Flexibility in handling audio. **Option:** Provide both a file path and Base64-encoded audio in the JSON. ---- \ No newline at end of file +--- + +### **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. + +Here’s 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" + } + ] +} +``` \ No newline at end of file