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.
Related
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
I am downloading a .wav file from a server and storing it locally in the file system. Once the file has been downloaded I try and play the file using the AVPlayer.
The url of the file being stored is something like this:
/Users/user/Library/Developer/CoreSimulator/Devices/FC767376-76BC-4402-B51B-SDFS/data/Containers/Data/Application/FA18B9RE-8D6E-4553-0617-4A064478AFF4/Documents/voice/test.wav
I have gone through all the related questions and have checked that I am doing the following:
Keeping reference to the AVPlayer in the viewController
Setting the category on the AVAudioSession
Setting the AVAudioSession to active
using NSURL(fileURLWithPath:) to retrieve the file url
I have tried using AVAudioPlayer
I have also confirmed the url being set on the AVPlayer does infact contain the audio file.
I have generated a test project that reproduces this issues. It can be found at https://github.com/va3093/AVAudioTest
Is it the way that I am storing the file? Is there something wrong with the file formats?
It turns out that the webservice I was using to generate the audiofiles genertate .mp3 files while I was saving them as .wav. When I changed to .mp3 then the audio player started playing the audio files.
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.
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.
I have downloaded a mp3 file from a server successfully, but the problem I encountered is, I don't know how to play that file.. Should I use AVAudioPlayer or AudioQueue to play the file?? I will be appreciate if you could post some sample code here.
Both AVAudioPlayer and the Audio Queue API can be used to play MP3 files. The AVAudioPlayer is well documented and has a lot of sample code available. So why not give it try first and if that does not work, post a more specific question here.