<< Part 16 - Part 18 >>

Add Audio in Generic Problems

It's easy to use audio content within the generic problem framework. At the moment
only mp3 (mpeg 2 layer 3) files are supported. That might change in the future.

You can reference an audio content almost everywhere in a TeX file, for example
in a \text and a \tasks command (see example below). You achieve that by using
the command \audio{audio lid}. And that not only works in problem TeX files but
also for instance in an article document.

An extensive example:

\documentclass{mumie.problem.gwtmathlet}
\begin{metainfo}

  ...

  \begin{components}
    ...
    \component{generic_sound}{content/il/test/problems/audio/g_snd_audio_1.meta.xml}{audio1}
    \component{generic_sound}{content/il/test/problems/audio/g_snd_audio_2.meta.xml}{audio2}
    \component{generic_sound}{content/il/test/problems/audio/g_snd_audio_3.meta.xml}{audio3}
  \end{components}

\end{metainfo}

\begin{content}

  ...

\begin{problem}

  \begin{question}

    \type{input.generic}

    \text{Eine Aufgabe: \audio{audio1}}

    \explanation{Denk nochmal nach...}

    \begin{answer}

      \type{mc.unique}
      \text{\audio{audio2}\\ W\"{a}hle die richtige Antwort aus:}
      \begin{choice}
        \text{$42$}
        \solution{true}
      \end{choice}
      \begin{choice}
        \text{\audio{audio3}}
        \solution{false}
      \end{choice}

    \end{answer}

  \end{question}  

\end{problem}

\embedmathlet{applet}

\end{content}

As an optional parameter you can set a specific audio playback rate: \audio[playback rate]{audio lid}.
Most browsers accept values between 0.25 and 5. 1 is the default playback rate. For example, \audio[2]{myAudio}
sets the playback rate of that audio file to 200%.

Alternatively you can give a comma separated list of playback rate values, from that the user can choose.
The first value in that list defines the initial playback rate. The order of the rest of the list doesn't matter.
The list will be automatically sorted by the system.

Another example: \audio[0.4,0.3,0.5,1,1.2,1.5]{myAudio}

Capture47.PNG (13.7 KB) Michael Heimann, 04/19/2018 11:46 AM

Capture52.PNG (11.4 KB) Michael Heimann, 05/31/2018 04:16 PM

Capture47 Capture52
Add picture from clipboard (Maximum size: 500 MB)