# Mac exercise for mission 13.3: Listening to a question in phone quality

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/mac-13-3

About 12 minutes at your computer · Type this address: **llm.yoga/en/mac-13-3**

The mission was about Barbara’s practice and why a phone agent should read names and numbers back. Here you hear what the phone line does to a question: 8,000 samples per second at 8 bits each in the µ-law format, the way Twilio delivers the audio. Then you have speech recognition transcribe both versions. The question is in German, as in the exercise for 13.1: „Haben Sie am Freitagnachmittag noch einen Termin frei?“ (“Do you have an appointment free on Friday afternoon?”).

**Before you start**

You need parakeet-mlx from the exercise for 13.1, in the same Python environment. Open a terminal window and activate it:

```
source ~/sprache/bin/activate
```

`say`, `afconvert`, `afinfo` and `afplay` come with macOS.

### 1. The question in normal quality

```
say -v Anna -o frage.aiff "Haben Sie am Freitagnachmittag noch einen Termin frei?"
```

```
afconvert -f WAVE -d LEI16@16000 -c 1 frage.aiff frage.wav
```

### 2. The same question in phone format

`ulaw@8000` means µ-law with 8,000 samples per second.

```
afconvert -f WAVE -d ulaw@8000 -c 1 frage.aiff telefon.wav
```

```
afinfo frage.wav | grep -E "Data format|bit rate"
```

```
afinfo telefon.wav | grep -E "Data format|bit rate"
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
Data format:     1 ch,  16000 Hz, Int16
bit rate: 256000 bits per second
Data format:     1 ch,   8000 Hz, ulaw (0x00000000) 8 bits/channel, 1 bytes/packet, 1 frames/packet, 1 bytes/frame
bit rate: 64000 bits per second
```

256,000 versus 64,000 bits per second: the phone has a quarter of the data rate. What’s audibly missing is mainly everything above 4 kHz, because 8,000 samples per second capture tones up to 4,000 hertz at most.

### 3. Listen

First the normal version, then the phone version. Pay attention to “S” and “F” and to the overall sound.

```
afplay frage.wav
```

```
afplay telefon.wav
```

(Checked against the documentation, not run here) On the test Mac, the files were only created and transcribed, not played out loud.

### 4. Have both transcribed

Parakeet expects 16 kHz. So the phone version gets converted back up; that doesn’t restore the missing high frequencies.

```
afconvert -f WAVE -d LEI16@16000 -c 1 telefon.wav telefon16.wav
```

```
parakeet-mlx frage.wav telefon16.wav --output-format txt
```

```
printf '„%s“\n' "$(cat frage.txt)" "$(cat telefon16.txt)"
```

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
„Haben Sie am Freitagnachmittag noch einen Termin frei?“
„Haben Sie am Freitagnachmittag noch einen Termin frei?“
```

### 5. Let the page check it

Paste the two lines with the quotation marks. The page checks whether each transcript matches the spoken sentence word for word.

The check needs JavaScript. Without it: compare both lines word for word with the sentence from step 1.

On the test Mac, every word stayed the same. A computer voice in a quiet room is the easiest case. Real callers with a dialect, street noise or a bad connection are harder; that’s why you test over a real line.

### 6. A sentence with a name and a number

Now what Barbara’s agent would really have to take down. The sentence is German too and means “My name is Fiona Simon, born November 4, 1971, insurance number M 815.”

```
say -v Anna -o name.aiff "Mein Name ist Fiona Simon, geboren am 4. November 1971, Versichertennummer M 815."
```

Then the same steps as above: `afconvert` to `name.wav`, into the phone format `name-telefon.wav`, back to `name-telefon16.wav`, transcribe both with `parakeet-mlx` and print them with `printf`.

**Output (Measured on an M4 Mac (24 GB) on November 25, 2026)**

```
„Mein Name ist Fiona Simon, geboren am 4. November 1971, versicherte Nummer M815.“
„Mein Name ist Fiona Simon, geboren am 4. November 1971, versicherte Nummer M815.“
```

The name and date are right, but „Versichertennummer“ (insurance number) became „versicherte Nummer“ (“insured number”), in both versions. The check above only knows the question; you compare this sentence yourself, word for word. An agent that reads names and numbers back and has them confirmed catches exactly this kind of mistake.

### 7. Clean up

```
rm frage.aiff frage.wav frage.txt telefon.wav telefon16.wav telefon16.txt name.aiff name.wav name.txt name-telefon.wav name-telefon16.wav name-telefon16.txt
```

If you no longer need Parakeet, clean up the environment as described in the exercise for 13.1.

The math for this is in the chapter: 8,000 × 8 = 64,000 bits per second, and Base64 adds a third more for transmission over WebSocket, about 10,667 characters per second.

#### On the DGX Spark

NVIDIA’s Spark overview has no dedicated playbook for speech. The model card for Parakeet v3 describes using it with NVIDIA’s NeMo toolkit (`pip install -U nemo_toolkit['asr']`); the chapter didn’t check whether that installs on the Spark’s ARM Linux without adjustments. Simpler: create and transcribe the audio files on the Mac as above. (Checked against the documentation, not run here)
