1

I would like to know if it's possible to resample an already written AVAudioFile.

All the references that I found don't work on this particular problem, since:

  • They propose the resampling while the user is recording an AVAudioFile, while installTap is running. In this approach, the AVAudioConverter works in each buffer chunk given by the inputNode and appends it in the AVAudioFile. [1] [2]

The point is that I would like to resample my audio file regardless of the recording process.

The harder approach would be to upsample the signal by a L factor and applying decimation by a factor of M, using vDSP:

Audio on Compact Disc has a sampling rate of 44.1 kHz; to transfer it to a digital medium that uses 48 kHz, method 1 above can be used with L = 160, M = 147 (since 48000/44100 = 160/147). For the reverse conversion, the values of L and M are swapped. Per above, in both cases, the low-pass filter should be set to 22.05 kHz. [3]

The last one obviously seems like a too hard coded way to solve it. I hope there's a way to resample it with AVAudioConverter, but it lacks documentation :(

  • 1
    This can be done using `AVAudioConverter` by setting a different sample rate for the output format. – sbooth Mar 30 '21 at 13:53

0 Answers0