File size: 532 Bytes
4ddd98f
 
 
 
 
 
 
 
 
 
 
 
 
c08cffe
 
4ddd98f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

import { nodewhisper } from "nodejs-whisper"

import { convertMp3ToWavFilePath } from "../utils/convertMp3ToWavFilePath.mts"

export async function speechToText(sound: string): Promise<string> {

  console.log("/speechToText: calling whisper binding..")

  // TODO try a wav? audio/wav
  const wavFilePath = await convertMp3ToWavFilePath(sound)

  const result = await nodewhisper(wavFilePath, {
    modelName: "base.en", //Downloaded models name
    autoDownloadModelName: "base.en"
  })

  console.log(result)

  return "TODO"

}