Применяя ИК-фильтр, появляется шум произнесения ⇐ IOS
-
Anonymous
Применяя ИК-фильтр, появляется шум произнесения
In my iOS application, using swift
i am getting audio from digital health device (BLE). In the form of audio data. It has background noise. Need to remove the background noise.
func applyFilterToData(decoded: Data) -> Data { // Example usage var lastData = Data() for decodedData in decoded { let unsignedData = UInt8(decodedData) let lowPassUInt8 = iirFilterNew.filter(Double(unsignedData)) lastData.append(lowPassUInt8) filteredDataToShare.append(lastData) self.n = (self.n + 1) % 9 } // Receive UInt8 -> Data return lastData } Applied IIR filter in it, try to filter the noise, but not able to filter the audio properly. utter noise comes.
func filter(_ input: Double) -> UInt8 { // Update input history xHistory.insert(input, at: 0) xHistory.removeLast() // Calculate output var output = b[0] * xHistory[0] for i in 1.. 127.0 { val = 127.0 } if val < -128.0 { val = -128.0 } var signedInt: Int8 = 0 if val.isNaN { signedInt = 0 } else { signedInt = Int8(val) } return UInt8.init(bitPattern: Int8(signedInt)) }
Источник: https://stackoverflow.com/questions/780 ... oise-comes
In my iOS application, using swift
i am getting audio from digital health device (BLE). In the form of audio data. It has background noise. Need to remove the background noise.
func applyFilterToData(decoded: Data) -> Data { // Example usage var lastData = Data() for decodedData in decoded { let unsignedData = UInt8(decodedData) let lowPassUInt8 = iirFilterNew.filter(Double(unsignedData)) lastData.append(lowPassUInt8) filteredDataToShare.append(lastData) self.n = (self.n + 1) % 9 } // Receive UInt8 -> Data return lastData } Applied IIR filter in it, try to filter the noise, but not able to filter the audio properly. utter noise comes.
func filter(_ input: Double) -> UInt8 { // Update input history xHistory.insert(input, at: 0) xHistory.removeLast() // Calculate output var output = b[0] * xHistory[0] for i in 1.. 127.0 { val = 127.0 } if val < -128.0 { val = -128.0 } var signedInt: Int8 = 0 if val.isNaN { signedInt = 0 } else { signedInt = Int8(val) } return UInt8.init(bitPattern: Int8(signedInt)) }
Источник: https://stackoverflow.com/questions/780 ... oise-comes
Мобильная версия