Skip to main content

kletso_voice 0.1.0 copy "kletso_voice: ^0.1.0" to clipboard
kletso_voice: ^0.1.0 copied to clipboard

Microphone and speaker for Kletso voice sessions: PCM capture (record on Android/iOS/desktop, Web Audio on the web) and low-latency playback. One line installs it into KletsoClient; the chat widgets t [...]

example/kletso_voice_example.dart

// Add microphone and speaker to a Kletso client in one line. In a real app use
// your publishable key; the fake backend here only shows the wiring.
import 'dart:io';

import 'package:kletso_core/fake.dart';
import 'package:kletso_core/kletso_core.dart';
import 'package:kletso_voice/kletso_voice.dart';

Future<void> main() async {
  final backend = KletsoFakeBackend(scenario: const KletsoFakeScenario.demo());
  final client = await Kletso.init(
    KletsoConfig(publishableKey: 'kl_pub_dev_example', agentId: 'agt_demo'),
    api: backend,
    transport: backend,
  );

  // Capture (record_* / Web Audio) and playback (audio_stream_player) for client.voice.
  final audio = KletsoVoice.install(client);
  stdout.writeln('voice audio installed: $audio');

  // From here the chat widgets show a mic button when the agent has voice
  // enabled; or drive the controller yourself:
  //   await client.voice.start();   // asks for the microphone on first use
  //   await client.voice.stop();
  await client.dispose();
}
0
likes
0
points
313
downloads

Publisher

verified publisherkletso.ai

Weekly Downloads

Microphone and speaker for Kletso voice sessions: PCM capture (record on Android/iOS/desktop, Web Audio on the web) and low-latency playback. One line installs it into KletsoClient; the chat widgets then offer a mic button.

Homepage
Repository (GitHub)
View/report issues

Topics

#ai #voice #speech #chatbot #sdk

License

unknown (license)

Dependencies

audio_stream_player, flutter, kletso_core, record_android, record_ios, record_linux, record_macos, record_platform_interface, record_windows, web

More

Packages that depend on kletso_voice