Trying to transcribe audio files in R

172 Views Asked by At

i'm new to R and trying to use a script in order to transcribe audio files.

I found this terrific person, who proposes a solution for audio transcription.

https://www.bnosac.be/index.php/blog/105-audio-transcription-with-whisper-from-r

When i use this code, all the code does is converting an audio file. It is not transcribing. According to the web page, i chose a model for transcription.

knitr::opts_chunk$set(echo = TRUE)
remotes::install_github("bnosac/audio.whisper") #this is the whisper implementation for R that worked for me
install.packages("av") #to transform audio files in the format you need
library(av)
library(audio.whisper)
model <- whisper("large")

#here is a test code chunk that I got from here https://www.bnosac.be/index.php/blog/105-audio-transcription-with-whisper-from-r


file.path("/Users/mehmetkay-sudo/Desktop/R/ketzer_trans.wav", 
              destfile = "ketzer_new.wav", mode = "wb")
av_audio_convert("/Users/mehmetkay-sudo/Desktop/R/ketzer_trans.wav", output = "ketzer_new.wav", format = "mp3", sample_rate = 16000) 
trans <- predict(model, newdata = "ketzer_new.wav", language = "de", 
                 duration = 30 * 1000, offset = 7 * 1000, 
                 token_timestamps = TRUE) 

In the end it says, i need a 16-Bit wav file. Is there in R a way, to convert audio files into 16-Bit wav files?

I tried to follow the instructions of https://www.bnosac.be/index.php/blog/105-audio-transcription-with-whisper-from-r in order to transcribe audio files for a science project at the university, where we collect txt files for creating a topic analysis model.

In R-Studio, when i run the script, it installs the remaining packages and than creates an audio file. The script tells me in the end, that the model needs a 16-Bit .wav-file.

0

There are 0 best solutions below