패키지, 저장소 및 앱 카테고리 검색

패키지 상세v4.2.0

deepgram_speech_to_text

Dart 및 Flutter용 Deepgram 클라이언트로 모든 플랫폼에서 음성 인식 및 텍스트 음성 기능을 지원합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
7.4천
좋아요
52
Pub 점수
140

패키지 설치

flutter pub add deepgram_speech_to_text

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Deepgram의 음성-텍스트 및 텍스트-음성 API용 Dart 및 Flutter 클라이언트로, 안드로이드, iOS, 웹, macOS, Windows, 리눅스에서 실시간 및 배치 전사 기능을 제공합니다. 스트리밍 오디오 입력, 사용자 정의 가능한 전사 설정, 음성 보조기기와의 통합을 지원합니다. 이 패키지는 크로스플랫폼 애플리케이션에서 고급 음성 인식 및 합성 기능에 접근하는 것을 간소화합니다.

사용 사례

  • 실시간 음성 전사
  • 음성 보조 기능 통합
  • 기록된 오디오의 전사
  • 다국어 음성 처리
  • 라이브 자막
  • 오디오 콘텐츠 인덱싱

주요 기능

  • 크로스 플랫폼 지원
  • 스트리밍 오디오 전사
  • 사용자 정의 가능한 전사 매개변수
  • Deepgram의 AI 모델과의 통합
  • 다중 언어 지원
  • 텍스트 음성 변환 기능

적합한 대상

  • 음성 기능을 갖춘 앱을 개발하는 개발자
  • 정확한 음성 인식이 필요한 앱
  • 크로스플랫폼 오디오 처리
  • 실시간 음성 인식이 필요한 애플리케이션
  • AI 기반 음성 서비스 통합

고려 사항

  • Deepgram API 키가 필요합니다
  • 네트워크 연결에 따라 다름
  • 사용 기반 비용이 발생할 수 있습니다
  • 제한된 오프라인 기능
  • 플랫폼별 권한이 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Deepgram Dart

Pub Version Pub Likes Pub Monthly Downloads

ko-fi

A Deepgram client for Dart and Flutter, supporting all Speech-to-Text and Text-to-Speech features on every platform.

Feel free to create issues, contribute to this project or to ask for new features on GitHub !

Features

Speech-to-Text Status Methods
From File ✅ listen.file(), listen.path()
From URL ✅ listen.url()
From Byte ✅ listen.bytes()
From Audio Stream ✅ listen.live(), listen.liveListener()
Text-to-Speech Status Methods
From Text ✅ speak.text()
From Text Stream ✅ speak.live(), speak.liveSpeaker()
Agent Interaction Status Methods
Agent Interaction 🚧 agent.live()

PRs are welcome for all work-in-progress 🚧 features

Getting started

All you need is a Deepgram API key. You can get a free one by signing up on Deepgram

Usage

First create the client with your api key.

Deepgram deepgram = Deepgram('your_api_key');

Pre-recorded

Then you can call the methods you need under the propper listen or speak subclass:

// Speech to text
DeepgramListenResult res = await deepgram.listen.file(File('audio.wav'), queryParams: {
  'model': 'nova-2-general',
  'detect_language': true,
  'filler_words': false,
  'punctuate': true,
  // options here : https://developers.deepgram.com/reference/listen-file
});

// Text to speech
DeepgramSpeakResult res = await deepgram.speak.text('Hello world', queryParams: {
  'model': 'aura-asteria-en'
  // options here : https://developers.deepgram.com/reference/text-to-speech-api
});

Streaming

Speech to text

let's say from a microphone :

//  https://pub.dev/packages/record (other packages would work too)
Stream<List<int>> micStream = await AudioRecorder().startStream(RecordConfig(
      encoder: AudioEncoder.pcm16bits,
      sampleRate: 16000,
      numChannels: 1,
));

final sttStreamParams = {
  'detect_language': false, // not supported by streaming API
  'language': 'en',
  // must specify encoding and sample_rate according to the audio stream
  'encoding': 'linear16',
  'sample_rate': 16000,
};

then you got 2 options depending if you want to have more control over the stream or not :

// 1. you want the stream to manage itself automatically
Stream<DeepgramListenResult> stream = deepgram.listen.live(micStream, queryParams: sttStreamParams);

// 2. you want to manage the stream manually
DeepgramLiveListener listener = deepgram.liveListener(micStream, queryParams: sttStreamParams);
listener.stream.listen((res) {
    print(res.transcript);
});
// connect to the servers and start sending data
listener.start();

// you can pause and resume the transcription (stop sending audio data to the server)
listener.pause(); 
// ...
listener.resume();

// then close the stream when you're done, you can call start() again if you want to restart a transcription 
listener.close(); 
Text to speech
final ttsStreamParams = {
  'model': 'aura-asteria-en',
  'encoding': "linear16",
  'sample_rate': 16000,
// options here: https://developers.deepgram.com/reference/text-to-speech-api
};

then again you got 2 options:

final textStream = ...
// 1. you want the stream to manage itself automatically
Stream<DeepgramSpeakResult> stream = deepgram.speak.live(textStream, queryParams: ttsStreamParams);

// 2. you want to manage the stream manually
DeepgramLiveSpeaker speaker = deepgram.liveListener(textStream, queryParams: ttsStreamParams);
speaker.stream.listen((res) {
    print(res);
    // if you want to use the audio, simplest way is to use Deepgram.toWav(res.data) !
});

// start sending data to the servers
speaker.start();

// https://developers.deepgram.com/docs/tts-ws-flush 
speaker.flush();

//https://developers.deepgram.com/docs/tts-ws-clear
speaker.clear();

// then close the stream when you're done, you can call start() again if you want to restart a transcription 
speaker.close(); 

For more detailed usage check the /example tab

Tested on Android and iOS, but should work on other platforms too.

Debugging common errors

  • make sure your API key is valid and has enough credits
deepgram.isApiKeyValid()
  • "Websocket was not promoted ..." : you are probably using wrong parameters, for example trying to use a whisper model with live streaming (not supported by deepgram)
  • empty transcript/only metadata : if streaming check that you specified encoding and sample_rate properly and that it matches the audio stream
  • double check the parameters you are using, some are not supported for streaming or for some models

Additional information

I created this package for my own needs since there are no dart sdk for deepgram. Happy to share !

Don't hesitate to ask for new features or to contribute on GitHub !

Support

If you'd like to support this project, consider contributing here. Thank you! :)

카테고리

의존성

의존성 목록 4 개

소스 저장소

이 패키지를 사용하는 프로젝트