I ran into the same issue but (after two days) found the following:
buffer.format can not be used as Source Format description when converting the buffer. Instead the data is always 32-Bit float.
If we would trust the format, the buffer contains signed, packed, big-endian integer samples - which is wrong.
This explains, why you will find the data in buffer.int32ChannelData and not in buffer.floatChannelData.
however, this alone would just generate sound that sounds overdriven. But the explanation for the noise is that also the flag big-endian is wrong. This wrong flag is responsible for the noise.
The simple solution is, not to rely on buffer.format and instead use the following hard-coded format:
AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: Double(22050), channels: 1, interleaved: false)
which represents exactly the format generated by AVSpeechSynthesizer.
But if you use this correct format, keep in mind that you will find the date in buffer.int32ChannelData and not in buffer.floatChannelData.
Post
Replies
Boosts
Views
Activity
You can indeed use NWProtocolTCP.Options to set a connection timeout like this:
let options = NWProtocolTCP.Options()
options.connectionTimeout = 2
let params = NWParameters(tls: nil, tcp: options)
let connection = NWConnection(host: anyHost, port: anyPort, using: params)
So, no timer is needed.