Saving an audio file in documents directory with the iphone - iphone

I want to develop an iphone application where I have to save the audio file and later mail it.
Can you give me some idea regarding this like the format in which it should be saved so that it can be played later anytime and also mailed?
Please let me know the step wise process or any sample code would be helpful.

Apple has a nice example (called Speakhere) to record and save audio files:
http://developer.apple.com/iphone/library/samplecode/SpeakHere/index.html
In order to send e-mail:
Follow Jasarien's post.

The Apple Example suggested by Ahmet is a good reference for recording and saving the sound clip.
To email it, look at the documentation for the MessageUI framework. The class you'll want to use is MFMailComposerViewController.
You can use that class to set recipients, subject, body and attatchments.

Related

Is it possible to convert audio file with some music notes?

I have a music file with a particular tone(music.mp4). I want to convert existing sound file (speech.mp4) into the tone which is specified in music.mp4. Its like converting a speech into some particular tone. I do not want to play both files simultaneously. I want to convert source file with help of some music file. So, output file will be converted file.
Is it possible? I searched for Audio Unit Hosting and Multimedia guide. But do not get any clue.
Thanks in advance.
The answer is: it sounds (no pun intended) like it would be possible with the iOS. You just need to find someone who knows how to program that specific functionality. I do not know why you would think to find the answer in the Apple Docs. I want to know if it's possible to program music that plays backwards. I want to know if I can program a sound that converts my words into something my dog understands. I can't imagine the documentation could possibly cover everything everyone ever wants to program an iPhone to do.
There are no iOS public APIs for frequency analysis of audio files. You would have to write your own DSP code for that. The AVFoundation and Accelerate frameworks have some audio file conversion and math functions that may help, but that is only a small portion of the code needed.

IPhone: Video API: Live video streaming modify

I have a question about video stream processing. Is it possible to get access and modify real time video stream during recording (f.e. I want to add some text to video)? I can do this as a preview by getting separate frames, but I'm looking for tool which will allow me to store video with my text in video frames.
Probably there is already some libraries/tools available (but I haven't found any yet).
Try GPUIMAGE library. It can help you.
You should check AVCam sample code by apple. That might be a starting point.

Where is the file of the recording located on the iPhone SpeakHere example?

It is as simple as that.
When you use the SpeakHere example it should create a file somewhere on the iPhone that contains the data from the recording.
Does anyone know how I can find this?
Thanks!
EDIT 1
To be clear, I want to do operations on the wav file within my application. I have some code that needs the URL of a wav file. What would that be in the SpeakHere example? (Keep in mind this is all within the same app).
EDIT 2
I appreciate the suggestion #sudo rm -rf, but I would really like to stick to the SpeakHere example as it serves my purpose well. Have you looked at the mRecordFile variable in AQRecorder.mm? Could that be it?
Well, I tried the app and it looks like it doesn't even save it to disk (it should be in the Documents directory); I'm not sure how it's holding it. Maybe in memory? Anyway, if I were you, I'd not use that sample code for recording audio. It's meant for iOS 2, and is quite outdated. Try visiting THIS question and read about how to use AVAudioRecorder.
Edit:
Found where it saves the audio file to recordedFile.caf. However, it's saving it to a temporary directory. So, to access it you need to use:
recordFilePath = (CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: #"recordedFile.caf"];
player->CreateQueueForFile(recordFilePath);
An App can only store data inside it's own sandbox. This means, it's stored inside the bundle of your example App and can't be read by any other App, except by the example App.

iPhone SDK: Is it possible to process audio file from local library

Well, I will try best not to make it as a 'I just want the code' question...
I'm recently working on a project which requires some audio signal processing from local music files (e.g. iTunes Library). The whole work includes:
Get the PCM data of an audio file (normally from iTunes library); <--AudioQueue (?)
Write the PCM data to a new file (it seems that Apple does not allow direct modification on music tracks); <--CoreAudio(?)
Do some processing and modification, like filters, manipulators, etc. <-- Will be developed in C++
Play the processed track. <--RemoteIO
The problem is, after going through some blogs and discussions:
http://lists.apple.com/archives/coreaudio-api/2009/Aug/msg00100.html, http://atastypixel.com/blog/using-remoteio-audio-unit/
http://osdir.com/ml/coreaudio-api/2009-08/msg00093.html
as well as the official sample codes, I got a feeling that the CoreAudio SDK allow us to apply audio processing only on voice demos recorded from Mic.
My question is that:
Can I get raw data from iTunes library tracks instead of Mic input?
If the first question is 'No', is there a way to 'fool' the SDK to let it think it is getting data from Mic input, not from iTunes? (I have done some similar 'hacking' stuff in C# before XD)
If the whole processing just doesn't work, can anyone provide some alternative ideas?
Any help will be appreciated. Thank you very much :-)
Thanks.
Just found something really cool yesterday.
From iPhone Media Library to PCM Samples in Dozens of Confounding, Potentially Lossy Steps
(http://www.subfurther.com/blog/?p=1103
And also a class library by MIT:
TSLibraryImport: Objective-C class + sample code for importing files from user's iPod Library in iOS4.
(http://bitbucket.org/artgillespie/tslibraryimport/changeset/a81838f8c78a
Hope they help!
Cheers,
Manca
1) No. Apple does not allow direct access to PCM data of songs. Otherwise you could create music-sharing apps, which is not in Apple's interests.
2) No. Hacking and getting approved is impossible due to Apple's code approval mechanism.
3) The only alternative I could think of is that you have to do the processing part on PC/Mac and then transfer it to the iPhone. Or you would have to store the files in your own applications folder - you should be able to load and process these via CoreAudio.
I know this thread is old but... did this work for you, Manca? And did this app get approved?
EDIT: just discovered the AVAssetReader class, introduced since iOS 4.1, should help

Record and email audio files on the iPhone?

is it possible to record the sound in iPhone 2.1 and then attache it in mail? I have to record any sound on one button click. Please help for that.
I believe that the iPhone 2.1 SDK does not have any APIs to attach an audio clip in mail.
I believe you could do this if you wrote your own email app and were able to properly encode the data from our audio file as an attachment. From what I have read the current sandbox environment for the Mail is only allowed to look into pictures for attachments.