|
|
@@ -1509,9 +1509,10 @@ private extension ViewController {
|
|
1509
|
1509
|
private func startMicrophoneRecording(at outputURL: URL, showToast: Bool) {
|
|
1510
|
1510
|
let settings: [String: Any] = [
|
|
1511
|
1511
|
AVFormatIDKey: kAudioFormatMPEG4AAC,
|
|
1512
|
|
- AVSampleRateKey: 44_100,
|
|
|
1512
|
+ AVSampleRateKey: 48_000,
|
|
1513
|
1513
|
AVNumberOfChannelsKey: 1,
|
|
1514
|
|
- AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
|
|
|
1514
|
+ AVEncoderBitRateKey: 128_000,
|
|
|
1515
|
+ AVEncoderAudioQualityKey: AVAudioQuality.max.rawValue
|
|
1515
|
1516
|
]
|
|
1516
|
1517
|
do {
|
|
1517
|
1518
|
let recorder = try AVAudioRecorder(url: outputURL, settings: settings)
|
|
|
@@ -1646,8 +1647,18 @@ private extension ViewController {
|
|
1646
|
1647
|
guard let export = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetAppleM4A) else {
|
|
1647
|
1648
|
throw NSError(domain: "MeetingAudioMix", code: 2, userInfo: [NSLocalizedDescriptionKey: "Unable to create audio export session."])
|
|
1648
|
1649
|
}
|
|
|
1650
|
+
|
|
|
1651
|
+ // Give the local microphone a small speech-focused boost while preserving meeting audio.
|
|
|
1652
|
+ let systemMix = AVMutableAudioMixInputParameters(track: systemTrack)
|
|
|
1653
|
+ systemMix.setVolume(1.0, at: .zero)
|
|
|
1654
|
+ let micMix = AVMutableAudioMixInputParameters(track: micTrack)
|
|
|
1655
|
+ micMix.setVolume(1.35, at: .zero)
|
|
|
1656
|
+ let audioMix = AVMutableAudioMix()
|
|
|
1657
|
+ audioMix.inputParameters = [systemMix, micMix]
|
|
|
1658
|
+
|
|
1649
|
1659
|
export.outputURL = destinationURL
|
|
1650
|
1660
|
export.outputFileType = .m4a
|
|
|
1661
|
+ export.audioMix = audioMix
|
|
1651
|
1662
|
await withCheckedContinuation { continuation in
|
|
1652
|
1663
|
export.exportAsynchronously {
|
|
1653
|
1664
|
continuation.resume()
|