Reputation: 1
I can't seem to find any instructions in the documentation. I am able to successfully transcribe audio from Google Cloud storage, but it transcribes the whole file. In order to save on costs, I would like to transcribe only portions of the audio, preferably using timestamps. Is there a method or variable to do this?
Upvotes: 0
Views: 262
Reputation: 812
You can split the audio file based on timestamp first, as suggested in the comment. The following Python code taken from this Stackoverflow link can be used for the same.
from pydub import AudioSegment
t1 = t1 * 1000 #Works in milliseconds
t2 = t2 * 1000
newAudio = AudioSegment.from_wav("oldSong.wav")
newAudio = newAudio[t1:t2]
newAudio.export('newSong.wav', format="wav") #Exports to a wav file in the current path.
The code uses Pydub library which supports various audio file formats such as WAV, mp3, flv etc.
Upvotes: 1