How to access the mp3 stored in iPhone in iPhone SDK - iphone

How does one access an MP3 stored in iPhone iTune_controls directory? When i want to see the MP3 it is not visible for me in my applcation.

I'm not sure I understand your question correctly, but it sounds like you want to access an MP3 from your app that is in the iTunes (iPod?) area of the phone, is this correct?
If so then you can't directly access the file, since your app runs in an isolated sand-box.
If on the other hand you're wanting to play an MP3 that's part of your app then look in the iPhone Library - Audio Queue Services section.

Related

iPhone iOS5 what are my options for playing audio I do not have bundled in?

I currently have 3 ways to play audio within my app:
Using AudioServicesPlaySystemSound for vibration and simple
sounds
Using Audio Toolbox for bundled files (3rd party class)
Using AudioServices with AudioFX
What I'm currently investigating is, if I can play other kinds of audio that are already present on the iPhone. I would like to reduce my app's download size, as well as offer more flexibility in terms of the kind of sound that the user can play.
Can I play from within my app:
Audio recordings from the Voice Memos app, or do I have to
create my own recordings? Items from an iPod playlist or Music app?
Items from youtube by pre-loading them, or will I have to stream them every time?
Existing ringtone for the phone?
I am a complete beginner when it comes down to playing audio on an iPhone and am already using two 3rd party classes for audio tasks.
Is there an easy way to accomplish some of the tasks listed above?
1) Audio recordings from the Voice Memos app
It's been asked before and I don't believe it's possible from your app sandbox.
iPhone: Access voice memos programmatically
2) Items from an iPod playlist or Music app
There's an API for that, the iPod Access Library:
http://developer.apple.com/library/ios/#documentation/Audio/Conceptual/iPodLibraryAccess_Guide/Introduction/Introduction.html
3) Items from youtube
Should be possible, using a UIWebView.
http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application
4) Existing ringtone for the phone
No, you can't access the current ringtone programatically.
How can I programmatically determine the default ringtone on an iPhone?
You can download sound files on first start (not in your didFinishLaunchingWithOptions method or your app will likely be killed) and save them locally, then you can just play them when needed. You can play files in their iTunes library, but won't know what they have in the library.
To play from their library, this is a handy example:
http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-music-library-access/
You can also record user input from your app with AVAudioRecorder, save that and then play it whenever.

Possible to move downloaded mp3s from application to iPod?

I was looking to code an iPhone application however, i was not sure if the following is possible :
Download an mp3 from an external site (through the application)
Once the mp3 has been downloaded, automatically add it to the usual iPod application, so it is visible in the user ipod songs list.
Same for videos too (download video[mp4] and directly transfer it to the usual videos app)
If the above is not possible, can i directly play the downloaded mp3 in my application ? What would i require to play an mp3 in my application ? Are there open source mp3 players available that i can integrate with my application ?
Thanks for any help, i really appreciate it.
Once the mp3 has been downloaded, automatically add it to the usual iPod application, so it is visible in the user ipod songs list.
No, that's not possible. The iPod library is not writable by third-party apps.
Same for videos too (download video[mp4] and directly transfer it to the usual videos app)
Not possible, either.

Making ringtone of music files on Iphone

Is it possible to edit music files stored on iphone in app and create ringtone from them?
Any help would be appreciated.
If I understand correctly, you want to extract the music from an existing iPhone app, and then turn that music from the app into a ring tone?
The short answer is no, not if you keep your iDevice up to date and within apple's licensed operating paradigm.
The longer answer is maybe. If you jailbreak the device, you may be able to hack access to the application and extract the desired data.
If I don't understand correctly, and you're just looking to change any old mp3 into an iPhone ringtone, try googling for iPhone ringtone hacks. Of course your mileage may vary but google is again your friend.
Sorry to not provide any code. This question didn't seem to warrant it.
No, for a number of reasons. The SDK doesn't give you access to the actual file data from the music library (just an object that will play music back for you), and while you can probably export an M4A file, with an "m4r" extension that iTunes will recognize as a ringtone, you'll have to get the user to take the file off their device and import it into iTunes manually for it to be usable as an actual ringtone on their phone.

HTML5 audio on iOS4 iPhone offline Web app does not play?

I built an offline Web app (at www.chirp.com) that caches itself when bookmarked on the desktop. Testing on the iPhone4 in airplane mode shows that the program runs without a network connection (except for Google map access of course). But the mp3 sound files do not play in this mode. Is there a problem with the audio tag when running in offline mode? The sound files are included in the manifest file, so they should be cached with the other files. Image files are still shown for instance.
How about if I use PhoneGap to create an iPhone app from this webapp? Will the sound files be included in the resulting binary load? In other words will the time delay, of online download of the small mp3 files each time the app is run and the sound is requested, be removed?
It is a bug or design decision on iOS to silently disallow caching of audio resources.
See this answer for more detail.
Using PhoneGap should work because the audio files will be present locally.
How about if I use PhoneGap to create an iPhone app from this webapp? Will the sound files be included in the resulting binary load? In other words will the time delay, of online download of the small mp3 files each time the app is run and the sound is requested, be removed?

iPhone Music Library Access

I would like to develop an application for iPhone that classifies the user's music according to user-defined genres. The application should be able to have access to iPhone's Music Library and work on the files, this is, fetching an mp3 file, apply some DSP ( like MFCC coefficients ) and then save the results on the file itself.
Is it possible to obtain a song as a file and work on it?
No. You have access to the music library database and can launch a music player to play a certain song but under the SDK you have neither access to the song files themselves nor to the actual PCM data of the music.
Also, access to the music library database on the device is strictly read-only, so you can't modify genres etc. if that was your plan.
I know this is not the answer you are looking for, but given that you can't access the music data from the iPhone, you might consider having a desktop app that accesses the user's music on their Mac/PC, and encodes something into the genre of the music there. Then you could write a music player app for the iPhone that can understand your genre descriptor and function accordingly. You could even go as far as having your iPhone app and desktop app communicate via WiFi to synch up data.