Convert .caf audio file to .wav audio file swift - ios

I have recorded audio and saved in .caf format in document directory. I need to convert the .caf to .wav file to upload the file to server. I researched and didn't get much input in swift. Please help me out to find a solution?

Did you try AudioKit?
Maybe you can use AKConverter https://audiokit.io/docs/Classes/AKConverter.html

Related

How to convert .ogg file to .mp3/.caf to play in AVPlayer?

How to convert .ogg file to any supported AVPlayer file format so that I can play it in app. Now if I am uploading .ogg file the player shows its raw data so how to solve this?
You can use mobile-ffmpeg!
Import mobile-FFmpeg to your project. If you do not know how to import, you can read this
Use this MobileFFmpeg.execute("-hide_banner -y -i [filename].ogg -c:a libmp3lame -qscale:a 2 [filename].mp3") (I found this from the sample code of mobile-FFmpeg)
And you will get the converted mp3 file in your project.
*note: if your .ogg file is from the server, please download it first.

Can I extract or convert a video file to audio?

I have a case where i need to get audio out from video file. Is this possible in iOS ??
I need only the output file as an audio any type. I have the video file in my documents directory which I record earlier in application.
1.Convert Video Reverse
2.Extract audio from a video file
3.Add Audio & Video Together
Download Code From Here
may be helpful to you.
Yes, it can be done. See Extract audio from video file for ideas.
Extracting is probably the more accurate term.

Do I need to convert audio files to .wav first before converting to .caf?

I have several audio files which all of them are in .mp3 format. But playing .mp3 won't maximize the efficiency of audio playing on iOS. From one of research, .wav or .caf is a go for short loop or sound effect audio file used in game. Thus I need to convert this .mp3 file into those two formats.
Currently I use the following command to convert .mp3 to .caf.
afconvert -f caff -d LEI16 kick_sfx.mp3
However, I see that .caf is a container format thus I have a bad feeling that it's still not so efficient. According to that, I think I need to convert those .mp3 files to .wav first in order to maximize efficiency in playing audio file.
Do I need to really convert those (.mp3) files to .wav first before convert them again to .caf? Or using that command alone will do the work for me ?
Any additional info is welcome.

Convert .Caf file to more standard format programatically in iOS

I know this has been asked around, but couldn't find a straight answer.
My App uploads .caf files from ios to Webserver, where .caf isn't a recognized format. What Should I do programatically in iOS to turn it into mp3, .wav..etc before uploading to server?
EDIT : I had the same problem and solution is given below
I had same issue, As .caf isn't a recognized format in ISS 6.0 or greater (not sure about which ISS) so u convert into base64 then save in server as .cab file
When retrieving again convert form .cab to .caf file
I couldn't find an easy way to do this. So, I ended up downloading caf players on my windows machine.

playing m4a files on finch

I have tried putting in the decoding options in the decoder file with finch in order to get .m4a files to play, but it when it actually plays the sounds, it comes out static. Any ideas on how to get this work?
Thanks
You can't play m4a files with Finch, because OpenAL doesn't load m4a files.
And it doesn't decode them either.
To play m4a files, you must use AVAudioPlayer.

Resources