Add two-pass speech recognition Android/iOS demo (#304)
This commit is contained in:
20
ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass/Extension.swift
Normal file
20
ios-swiftui/SherpaOnnx2Pass/SherpaOnnx2Pass/Extension.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Extension.swift
|
||||
// SherpaOnnx
|
||||
//
|
||||
// Created by knight on 2023/4/5.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
|
||||
extension AudioBuffer {
|
||||
func array() -> [Float] {
|
||||
return Array(UnsafeBufferPointer(self))
|
||||
}
|
||||
}
|
||||
|
||||
extension AVAudioPCMBuffer {
|
||||
func array() -> [Float] {
|
||||
return self.audioBufferList.pointee.mBuffers.array()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user