Yeah, I am using NodeJS to do the job. I want to just save the transcript part of the response payload. And do let me know if we can define the duration of the audio for scanning (Complete audio or Just for a timeframe)
CC: @michaeljolley
You can't define the duration. The API will try to transcribe the entire audio file every time, not just a section.
Using the Node SDK, you could send your request with the utterances feature turned on. (e.g. utterances:true)
Then, when the transcription comes back you can use the .toSRT() or .toWebVTT() functions to generate a text based version of the transcript with timestamps. Then you'd want to save it locally using fs.
Example:
const{Deepgram}=require('@deepgram/sdk');constfs=require('fs');constdeepgram=newDeepgram(DEEPGRAM_API_KEY)constaudioSource={url:URL_OF_FILE};deepgram.transcription.preRecorded(audioSource,{punctuate:true,utterances:true,// other options are available}).then((response)=>{constsrtTranscript=response.toSRT();fs.writeFile(FILENAME_TO_SAVE,srtTranscript,function(err){if(err){returnconsole.log(err);}console.log("The file was saved!");});}).catch((err)=>{console.log(err);});
That was real quick. But I don't really want it like a subtitles file. Rather I just want the transcript text to be saved to the file and not anything else. I am talking about the sentences in that transcript: part (the one marked in purple).
CC: @michaeljolley
You could just use the transcript property itself:
const{Deepgram}=require('@deepgram/sdk');constfs=require('fs');constdeepgram=newDeepgram(DEEPGRAM_API_KEY)constaudioSource={url:URL_OF_FILE};deepgram.transcription.preRecorded(audioSource,{punctuate:true,// other options are available}).then((response)=>{constsrtTranscript=response.results.channels[0].alternatives[0].transcript;fs.writeFile(FILENAME_TO_SAVE,srtTranscript,function(err){if(err){returnconsole.log(err);}console.log("The file was saved!");});}).catch((err)=>{console.log(err);});
Hiya @21rutam! Good question. Let me make sure I give you the right answer.
First, are you using one of our SDKs? If so, which one?
Second, are you trying to save the whole payload or just the words?
Yeah, I am using NodeJS to do the job. I want to just save the transcript part of the response payload. And do let me know if we can define the duration of the audio for scanning (Complete audio or Just for a timeframe)
CC: @michaeljolley
You can't define the duration. The API will try to transcribe the entire audio file every time, not just a section.
Using the Node SDK, you could send your request with the
utterances
feature turned on. (e.g.utterances:true
)Then, when the transcription comes back you can use the
.toSRT()
or.toWebVTT()
functions to generate a text based version of the transcript with timestamps. Then you'd want to save it locally usingfs
.Example:
That was real quick. But I don't really want it like a subtitles file. Rather I just want the transcript text to be saved to the file and not anything else. I am talking about the sentences in that
transcript:
part (the one marked in purple).CC: @michaeljolley
You could just use the transcript property itself:
Thanks a bunch @michaeljolley . You rock 🙌🚀