There is special software to remove background sound noise. Audacity for PC may be one of the most popular (this, by the way, is open source). Alternatively, you can do this completely on your iPhone using Denoise .
Basically, the recorded audio contains several separate sounds, and some of them are harmful (for example, buzzing lamps, street noises, problems with microphones, etc.). A very popular approach to suppressing harmful sounds is to calculate the frequency spectrum of harmful noises and to suppress "harmful" frequencies throughout the duration of the sound. In both cases, Audacity and Denoise, you do this by selecting the “noise only” section. All sounds in this fragment are considered noises and are suppressed in the whole file.
If you need to include this feature in your application, you can look at the sources of Audacity. Please let me know if you need more information.
source share