Skip to content

Audio ​

The robot records from a microphone and plays sound files through its speaker. Recording and playback are HTTP requests to port 8081, and recordings are downloaded from port 8080. Both use the robot's web account (rb / rainbow2026) as HTTP Basic authentication, and the bodies are JSON.

Which microphone and speaker ​

The robot uses one microphone and one speaker at a time, and picks them itself.

RobotMicrophoneSpeaker
PTZ payload loadedPTZ camera microphonePTZ camera speaker
No PTZ payloadMicrophone plugged into the robot's audio inputRobot speaker

When the PTZ camera comes up or goes away, the robot switches within about 5 seconds. Check which devices are in use before you record or play: input and output read ptz, robot or none.

bash
curl -u rb:rainbow2026 http://192.168.0.10:8081/api/audio/status
  • Robot microphone — the robot's audio input is listed even when nothing is plugged in, so mic_present alone does not tell you a microphone is there. mic_signal does: 1 when sound comes in, 0 when it is almost silent and the jack may be empty. It is measured again at most once a minute while you read the status, so plug the microphone in, wait a minute, then check. Plug it in before you start recording — if you pull it out while recording, the rest of the file is silent.
  • Robot speaker — it is silent while the speaker amplifier is off. Turn on Speaker amp (12V) (Speaker amp on CAN-FD robots) under Maintenance → Power / System — see Maintenance. The PTZ camera speaker has its own amplifier.

Record ​

  1. Start recording. The robot records from the moment it answers, so start talking after the reply. The reply carries the file's path.

    bash
    curl -u rb:rainbow2026 -X PUT http://192.168.0.10:8081/api/audio/record \
         -H 'Content-Type: application/json' -d '{"state":"start","source":"mic"}'
    # {"path":"20261026/mic_20261026_143000.wav", ...}

    With no microphone the request fails with no microphone.

  2. Stop recording. The file is complete only after this — a file still being recorded reads as 0 seconds long.

    bash
    curl -u rb:rainbow2026 -X PUT http://192.168.0.10:8081/api/audio/record \
         -H 'Content-Type: application/json' -d '{"state":"stop"}'
  3. Download the file. GET /api/audio/list on the same port lists the recordings.

    bash
    curl -u rb:rainbow2026 -o rec.wav \
         'http://192.168.0.10:8080/api/audio/file?path=20261026/mic_20261026_143000.wav'

A file is closed after 30 minutes. Starting a recording while one is running closes the first file and starts a new one.

Play a sound file ​

  1. Upload the file as base64 in pieces: send each piece with its byte offset and the file's total size, up to 50 MB in all. When the last piece arrives the robot converts the file for playback and replies with its path. Anything past 10 minutes is cut off.

    bash
    curl -u rb:rainbow2026 -X POST http://192.168.0.10:8081/api/audio/upload \
         -H 'Content-Type: application/json' \
         -d '{"name":"alarm","offset":0,"total":<bytes>,"data":"<base64>"}'
    # last piece: {"path":"library/alarm.wav", ...}
  2. Play it. With "loop":true it repeats, for up to 30 minutes.

    bash
    curl -u rb:rainbow2026 -X PUT http://192.168.0.10:8081/api/audio/play \
         -H 'Content-Type: application/json' -d '{"path":"library/alarm.wav","loop":false}'
  3. Stop it with {"state":"stop"} on the same request. Playing another file replaces the one that is playing.

WARNING

Playback shares the one speaker with the operator app's Talk. If the operator app is connected and then disconnects, playback stops with it.

Live audio with the PTZ camera ​

The robot's own interface records and plays files only. For live audio, use the PTZ camera directly at 192.168.0.100:

  • Microphone — the camera's profile4 RTSP stream (rtsp://<user>:<password>@192.168.0.100:554/profile4/media.smp) carries the microphone track. Receive it, or save the stream to record.
  • Speaker — open the camera's ONVIF audio back-channel: the same profile4 with the header Require: www.onvif.org/ver20/backchannel, then SETUP the sendonly track and PLAY. Sound you send after the PLAY reply comes out at once. Send G.711 μ-law (PCMU) at 8 kHz, 160 bytes every 20 ms, and keep sending silent frames while no one talks. Close the session (TEARDOWN) when you are done.

The camera has a 25 W speaker. For its audio settings, see the SUNAPI reference.

The robot uses the same back-channel for file playback and the operator app's Talk, so do not use both at once. The robot closes its back-channel 2 seconds after its sound ends. See PTZ Camera for the camera account and SUNAPI.

This user manual is intended for RBQ users.