Hi,
I'm working on a project that uses the AVSpeechSynthesizer and AVSpeechUtterance.
I discovered by chance that the AVSpeechSynthesizer automatically completes some words instead of just outputting what it's supposed to.
These are abbreviations for days of the week or months, but not all of them. I don't want either of them automatically completed, but only the specified text. The completion transcends languages.
I have written a short example program for demonstration purposes.
import SwiftUI
import AVFoundation
import Foundation
let synthesizer: AVSpeechSynthesizer = AVSpeechSynthesizer()
struct ContentView: View {
var body: some View {
VStack {
Button {
utter("mon")
} label: {
Text("mon")
}
.buttonStyle(.borderedProminent)
Button {
utter("tue")
} label: {
Text("tue")
}
.buttonStyle(.borderedProminent)
Button {
utter("thu")
} label: {
Text("thu")
}
.buttonStyle(.borderedProminent)
Button {
utter("feb")
} label: {
Text("feb")
}
.buttonStyle(.borderedProminent)
Button {
utter("feb", lang: "de-DE")
} label: {
Text("feb DE")
}
.buttonStyle(.borderedProminent)
Button {
utter("wed")
} label: {
Text("wed")
}
.buttonStyle(.borderedProminent)
}
.padding()
}
private func utter(_ text: String, lang: String = "en-US") {
let utterance = AVSpeechUtterance(string: text)
let voice = AVSpeechSynthesisVoice(language: lang)
utterance.voice = voice
synthesizer.speak(utterance)
}
}
#Preview {
ContentView()
}
Thank you
Christian
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I try to record audio on the iPhone with the AVAudioRecorder and Xcode 26.0.1.
Maybe the problem is that I can not record audio with the simulator. But there's a menu for audio.
In the plist I added 'Privacy - Microphone Usage Description' and I ask for permission before recording.
if await AVAudioApplication.requestRecordPermission() {
print("permission granted")
recordPermission = true
} else {
print("permission denied")
}
Permission is granted.
let settings: [String : Any] = [
AVFormatIDKey: kAudioFormatMPEG4AAC,
AVSampleRateKey: 12000,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]
recorder = try AVAudioRecorder(url: filename, settings: settings)
let prepared = recorder.prepareToRecord()
print("prepared started: \(prepared)")
let started = recorder.record()
print("recording started: \(started)")
started is always false and I tried many settings.
Error messages
AddInstanceForFactory: No factory registered for id <CFUUID 0x600000211480> F8BB1C28-BAE8-11D6-9C31-00039315CD46
AudioConverter.cpp:1052 Failed to create a new in process converter -> from 0 ch, 12000 Hz, .... (0x00000000) 0 bits/channel, 0 bytes/packet, 0 frames/packet, 0 bytes/frame to 1 ch, 12000 Hz, aac (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame, with status -50
AudioQueueObject.cpp:1892 BuildConverter: AudioConverterNew returned -50
from: 0 ch, 12000 Hz, .... (0x00000000) 0 bits/channel, 0 bytes/packet, 0 frames/packet, 0 bytes/frame
to: 1 ch, 12000 Hz, aac (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
prepared started: true
AudioQueueObject.cpp:7581 ConvertInput: aq@0x10381be00: AudioConverterFillComplexBuffer returned -50, packetCount 5
recording started: false
All examples I find are the same, but apparently there must be something different.
Hi all,
I use the FileManager trashIitem function to put a file in the trash.
If it is only one file, then the option to put it back is available.
If, however, several files are deleted, the option to put it back is only available for the first
deleted file. All others cannot be put back.
The problem has been known for at least 10 years.
See Put back only works for the first file.
NSWorkspace recycle has the same problem.
It seems to be due to .DS_Store in the trash. The files that are in the trash are stored there. This may also lead you to believe that the trashItem function is working properly because the deleted files are still in the .DS_Store file.
If I call trashItem or recycle several times and wait 2 seconds between calls, then the option to put it back is available for all of them.
That obviously can't be the solution. Waiting less than 2 seconds only offers to put the first file back.
So trashItem and recycle are the same as remove, with the difference that you can look at the files in the trash can again, but not put them back.
Are there other ways?
The Finder can also delete multiple files and put them all back.