2

I have a Mp3 audio file, which i am converting into text with 'Speech Framework'. Now i Want to recognise multiple user voices in that converted text file. How i will do this? Here is my function where i am converting audio file to text.

func convertAudioFileToText(audioURL: URL?){
    
    let request = SFSpeechURLRecognitionRequest(url: audioURL!)
    request.shouldReportPartialResults = true
    
    
    if (speechReconizer?.isAvailable)! {
        
       
        
        self.task  =   speechReconizer?.recognitionTask(with: request) { result, error in
            guard error == nil else {
                print("Error: \(error!)");
                self.openAlert()
                return }
            guard let result = result else {
                print("No result!");
                return }
            
           
            self.textViewAudioText.text =  self.strSplitedText + result.bestTranscription.formattedString
            
            if result.isFinal{
                       self.task.cancel()
                       self.task.finish()
              
            }
        }
    } else {
        print("Device doesn't support speech recognition")
    }
}
shelen
  • 105
  • 1
  • 7
  • I dont think its technically feasible with just the in built apple frameworks. You have to use Facebook to google cloud services – Saamer Apr 07 '22 at 14:44

0 Answers0