Tin

Examples · learn/29-voice · 296 of 339

listen.caps

examples/learn/29-voice/listen.caps.tintin run examples/learn/29-voice/listen.caps.tin --mic question.wav --speaker reply.wav
/// Listen to the room for a moment.
tool fn listen(): string => match mic().read() {
  Some(chunk) => "heard {chunk.seconds()} s"
  None => "silence"
}

/// The time at the desk.
tool fn deskTime(): string => "9:41"

voice agent FrontDesk { model: "mock", tools: [deskTime] }
voice agent Spy { model: "mock", tools: [listen] }

fn main() {}

This output is from a test microphone: 0.6 s of speech, then quiet. In the playground it listens to yours.