Created
March 31, 2020 13:46
-
-
Save FedeRotoli/e5b9e70c57b34acc23705a785ebc92d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SoundAnalysis | |
class SoundAnalyzerController: UIViewController { | |
private let audioEngine = AVAudioEngine() | |
private var soundClassifier = EmotionModel() | |
var inputFormat: AVAudioFormat! | |
var analyzer: SNAudioStreamAnalyzer! | |
var resultsObserver = ResultsObserver() | |
let analysisQueue = DispatchQueue(label: "com.apple.AnalysisQueue") | |
@IBOutlet weak var transcriberText: UILabel! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
resultsObserver.delegate = self | |
inputFormat = audioEngine.inputNode.inputFormat(forBus: 0) | |
analyzer = SNAudioStreamAnalyzer(format: inputFormat) | |
} | |
override func viewDidAppear(_ animated: Bool) { | |
startAudioEngine() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment