Speech-to-Text integrado en el dispositivo

Organiza tus páginas con colecciones Guarda y categoriza el contenido según tus preferencias.

Descripción general

Speech-to-Text integrado en el dispositivo habilita la tecnología de voz de calidad del servidor en dispositivos incorporados. Esto te permite ejecutar el reconocimiento de voz de transmisión por completo integrado en el dispositivo, sin conexión a una red ni a servidores de Google.

La solución es un servidor de gRPC de transmisión bidireccional. El servidor consume audio y emite eventos en tiempo real, similar a la API de transmisión bidireccional de Cloud Speech.

La API a continuación es un ejemplo incompleto.

service SpeechToText {
  rpc StreamingRecognize(stream StreamingRecognizeRequest)
      returns (stream StreamingRecognizeResponse) {}
}

message StreamingRecognizeRequest {
  oneof streaming_request {
    StreamingRecognitionConfig streaming_config = 1;
    bytes audio_content = 2;
  }
  // ...
}

message StreamingRecognizeResponse {
  enum SpeechEventType {
    // ...

    // This event indicates that the server has detected the beginning of human
    // voice activity in the stream. This event can be returned multiple times
    // if speech starts and stops repeatedly throughout the stream.
    START_OF_SPEECH = 2;

    // This event indicates that the server has detected the end of human voice
    // activity in the stream. This event can be returned multiple times if
    // speech starts and stops repeatedly throughout the stream.
    END_OF_SPEECH = 3;
  }
  // ...
  repeated StreamingRecognitionResult results = 2;
  // ...

  SpeechEventType speech_event_type = 4;
}

Guía de inicio rápido de ejemplo

A continuación, se muestra un ejemplo del uso del servidor integrado en el dispositivo.

  1. Elige un paquete de idioma (LP) y comienza el servidor de reconocimiento.

    Un paquete de lenguaje es un directorio que contiene modelos y opciones de configuración. El servidor de Speech-to-Text entregará un paquete de idiomas a la vez.

      ./speech_to_text_server --server_ip="0.0.0.0" --port=8000 \
         --language_pack=/../en_us
    
  2. Usa el cliente de la línea de comandos para probar el servidor con un archivo de audio (WAV)

      ./speech_to_text_client --server_ip="0.0.0.0" --port=8000 \
        --audio=/../hello.wav
    

    Consulta las opciones del cliente de la línea de comandos con

      ./speech_to_text_client --help