I want to merge two recorded audio files (.caf)in an iphone .is there any solution?for recording am using avaudioplayer.
answered By: MidHere
You can do it using ExtAudioFileService. In ios developer library they had provided two examples to convert one audio file to another format. In these they are opening one audio file for reading and another file for writing (converted audio). You can change or updated code to read from two files and write them to one out put file in same format(caf) or compressed format. First you have open first audio file and read every packets from it and write it to a new audio file. After finishing first audio file, close the file and open second audio file for reading. Now read every packets from second audio file and write to newly created audio file and close second audio file and new audio file.
Please find the links(1,2) for these sample codes .... Hope this helps you...and good luck. :)
Related
I am working on audio recording. I am able to record my audio in caf (Core audio format). Now I want to record sound in .mp3 or .amr.
I tried a lot of google but didn't found anything. I am not sure if my steps following work:
Write that Audio with .caf extention to document dir
Read data from that file
write the file again with .mp3 or .amr extention
I have 100% doubt that this will not going to work as this will just re save file with some other extension. This won't change audio codec.
I thought that for converting any format whether it is audio or video we need to change its codecs and data sequence.
Please also suggest me any player which don't play .caf files not anything else. So I can make sure that my files are converted successfully.
UPDATE Please also let me know that the way I am re-writing data with different extension is correct in the way I am needed?
You might be interested in the iPhoneExtAudioFileConvertTest example.
The MP3 format is however not available due to patents, maybe you can use LAME.
From the Document The Basics: Audio Codecs, Supported Audio Formats, and Audio Sessions
How to save the file which is recorded in sound_record.js File from Appcellrator Titanium KitchenSick Demo.
file = recording.stop(); // file container TiFile Object
sound = Titanium.Media.createSound({sound:file}); // Sound Contains. TiMedia Object
I found these two lines which has the data, which is recorded, But i didnt get that, How to save these recorded data into iphone, so that they can have an access to these files which is recorded.
And also Uploading the Audio files to Web Server, Every where we have how to upload the Image which comes from Gallery, But there is no where its mentioned how we can upload the audio files such as .wav file which is recorded using sound_record.js.
I would checkout the KitchenSink, you'll find a lot of examples there. For saving I would checkout the filesystem.js and for upload the xhr_fileupload.js.
I am using AVAudioRecorder for recording audio in .caf format. When the user will resume this recording the new recording must append with the old recording. So how can i combine two .caf audio files.
You can do it using ExtAudioFileService. In ios developer library they had provided two examples to convert one audio file to another format. In these they are opening one audio file for reading and another file for writing (converted audio). You can change or updated code to read from two files and write them to one out put file in same format(caf) or compressed format. First you have open first audio file and read every packets from it and write it to a new audio file. After finishing first audio file, close the file and open second audio file for reading. Now read every packets from second audio file and write to newly created audio file and close second audio file and new audio file.
Please find the links(1,2) for these sample codes ....
Hope this helps you...and good luck. :)
I have .asf files. All of them have 2 video streams and 1 audio stream in it. I need to extract that .asf into 2 .flv files (first one is video stream, second one is second video + audio stream).
Is there some free program with funcitonality like this where I can choose which streams I want to extract/convert to .flv. I've tried at least 15 programs and all of them open my .asf file and offer me to convert it but none of them "knows" about that second video stream. Some programs opens my .asf and in external window open second video stream but not offering any functionallity to it. It's like they aren't aware of that second video stream.
I don't want to write my own program with Xuggle if I don't need to.
Thank You,
Dino
Let me answer this old question. On Windows download the program Haali Muxer and split the file as you want. Then there are many converters to .flv format but now there is only one video and audio stream in source file after splitting it with Haali Muxer.
I am making an iPhone recording app that needs to submit the sound file as a .wav to an external server.
Starting from the SpeakHere example, I am able to record sound as a file, but only as .caf
Does anyone know how to record it as a wav instead? Or how to convert from .caf to .wav on the iphone? (The conversion must happen on the phone)
EDIT:
I'm wondering if anything can be done with using kAudioFileWAVEType instead of kAudioFileCAFType in AudioFileCreateWithURL
Yup, the key is kAudioFileWAVEType
AudioFileCreateWithURL (
audioFileURL,
kAudioFileWAVEType,
&audioFormat,
kAudioFileFlags_EraseFile,
&audioFileID
);
Changing to WAVE from CAF in the SpeakHere example causes the recording to be as wav. I also edit the same thing in the playback class, and changed the filename to be Recording.wav
Have a look at libsndfile. It is a well used (including by Audacity) C library for working with lots of file formats. It supports read and write of a variety of CAF and WAV formats.
The CAF File structure and WAV format are fairly similar. If the worst comes to the worst, converting shouldn't be too hard.
It would involve taking the Audio data chunk, and copying as is into the WAV file, and using the information in the Audio Description Chunk to add an equivalent fmt subchunk for the WAV file. It is fairly simple byte copying.
However, be aware (as Eric pointed out) there are licensing issues, see: Can the Libsndfile library be used on the iPhone iOS?