deepgram_speech_to_text 1.0.4 copy "deepgram_speech_to_text: ^1.0.4" to clipboard
deepgram_speech_to_text: ^1.0.4 copied to clipboard

A simple Deepgram client for Dart and Flutter. Made to simply transcribe audio from : File, URL, Stream or Raw data.

A simple Deepgram client for Dart and Flutter.

You can simply transcribe audio from : File, URL, Stream or Raw data.

Currently only supports Speech-To-Text (STT), maybe more in the future. Feel free to contribute to this project or to ask for new features on GitHub !

Features #

Speech to text transcription from:

  • File
  • URL
  • Stream
  • Raw data

Getting started #

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

Usage #

For a bit more detailed usage check /example

String apiKey = 'your_api_key';
Deepgram deepgram = Deepgram(apiKey, baseQueryParams: params);

// -------------------- From a file --------------------
File audioFile = File('audio.wav');
String json1 = await deepgram.transcribeFromFile(audioFile);

// -------------------- From a URL --------------------
String json2 = await deepgram.transcribeFromUrl('https://somewhere/audio.wav');

// -------------------- From raw data --------------------
String json3 = await deepgram.transcribeFromBytes(List.from([1, 2, 3, 4, 5]));

// -------------------- From a stream  --------------------
  // for example : from a microphone https://pub.dev/packages/record (other packages would work too as long as they provide a stream)
final micStream = await AudioRecorder().startStream(RecordConfig(
      encoder: AudioEncoder.pcm16bits,
      sampleRate: 16000,
      numChannels: 1,
    ));
// You need a package to record from mic ? I recommend this one : 
Stream<String> jsonStream = deepgram.transcribeFromLiveAudioStream(micStream);

// or to have more control over the stream
DeepgramLiveTranscriber transcriber = deepgram.createLiveTranscriber(micStream);

transcriber.start();
transcriber.jsonStream.listen(print);
transcriber.close();

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 !

5
likes
0
pub points
78%
popularity

Publisher

unverified uploader

A simple Deepgram client for Dart and Flutter. Made to simply transcribe audio from : File, URL, Stream or Raw data.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, universal_file, web_socket_channel

More

Packages that depend on deepgram_speech_to_text