Is it possible to purchase a song on iTunes in app to be recorded over? - iphone

I'm a new developer working on an app that allows users to record vocals over a track. I have some tracks that I am selling on iTunes and I would like for users to be able to purchase the a tracks from inside the app and load them to be recorded over.
So what I want is for a user to select a track listing from a table, purchase the track in-app, and be able to press button that will switch views to an audio recorder that loads that track to be recorded over. I've been scouring the documentation and I'm struggling to figure out whether this is even possible.
Does anyone know if this is possible, and can anyone point me in the right direction as to where to begin piecing the code together?
Thank you!

Short answer: Yes it's possible to do what you're trying to do
Long answer: It's possible to access the audio data from any song in the music library using an AVAssetReader (more info here How would you connect an iPod library asset to an Audio Queue Service and process with an Audio Unit? and in a bunch of other SO questions)
You'll probably need to copy the song file into the app's documents directory first to work with it. Then you'll probably need to use Audio Units to mix the microphone input with the audio, but that's a whole other topic that I'm not particularly familiar with so you'll have to search SO for more info on that, there's plenty of related questions.
As for purchasing the song, the easiest way would probably be to just link to the song in the iTunes store and have them buy it there, I believe you can even be an iTunes affiliate so you can possibly make additional money on the purchases that way. Once they have the song, it will be in their library and you can use the AVAssetReader to get it.
You could have the songs listed in a table, and in the didSelectRowAtIndexPath: delegate method you could open the link to the iTunes store for that particular song.
Hope that helps.

Related

accessing itunes music data

If it helps, I am using Xcode 4.3.1 and objective-c to program simple apps on an iPhone 4s running iOS 5.1.
I would like to find the documentation for a class with methods to capture the digital music signal that iTunes sends to an output device (speaker, headphones). I assume it must be accessible since it exists in the phone prior to reaching the speakers. I am not attempting a pirating move, but rather would like to route this music signal to the phone's outgoing wireless signal so that it can be heard clearly by someone on the other end of a call (ex. a method to play a favorite song, with decent sound quality, for a friend out of town). Can anyone point me in a general direction (if that direction exists) so that I can begin learning more?
Thanks,
Seth
One, I'm pretty sure there's no way to get the raw audio samples from a song in the library. You can get a list of the tracks and tell the system to play one, but that all happens outside your app. Two, apps can't access the cell phone—there's no way to send audio from your app to a phone call. Three, even if the first two did work, calls are heavily compressed and tuned to voice data. Call a friend and have them play a song through the phone, see how it sounds. Not very good, I'll bet.

How can I record currently playing audio on the iPhone?

I'd like to record what the iPhone is currently outputting. So I'm thinking about recording audio from Apps like Music (iPod), Skype, any Radio Streaming App, Phone, Instacast... I don't want to record my own audio or the mic input.
Is there an official way to do this? How do I do it? It seems like AVAudioRecorder does not allow this, can somebody confirm?
Officially you can't. The audio stream belongs to the app playing it ,and iOS.
The Sandbox paradigm means that a resource owned by your App can't be used by another App. Resource here means Audio/Video stream or file. Exceptions are when a mediator like Document interaction controller are used.
If you want to do this you'd have to start with deducing AVFoundation's private methods and find out if theres a way there. Needless to say this it wouldn't be saleable on the App store and will probably only be possible on a jailbreak.
Good Luck.
TLDR;
This is only feasible only from time to time, as it's a time expensive process.
You can record the screen while listening your songs on Spotify, Music or whatever music application.
This will generate a video on your Photos application. That video can be converted on MP3 from your computer.
Actually, this is not true. The screen recordings will not actually have the audio from Apple Music at all, as it blocks it. Discord also uses this pipe as well, so you cannot record Discord audio either this way.

Access iPhone User Songs and Videos?

I was wondering if I can access user's songs and videos in iPhone, part of that access if I can save them or modify them? hopefully not a Jailbroken iPhones
I am greatly appreciated.
Yes, you can. I can't speak for video, because I've only done it for audio, but you can definitely get audio data. These links should get you started. Note: I am as yet unsure if this works with tracks that use any kind of iTunes-related DRM.
First of all, this blog post talks you through the method of accessing the data. Note the reliance on iOS 4.1 or above.
This SO question/answer explains how to get at the raw pcm data, should you want to do more than just save it out.
You can allow the user to pick songs using the MPMediaPickerController class. I think you can save the selected item to your app's sandbox directory.
You can read up on this a bit more with this SO question.

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.

How to record sound of a key press on iphone?

I am developing an application in which I want to record the sound of a piano key press. I'm not able to find anything relevant on the internet which helps.
Can anybody share the code or any link which shows how to record the data of the piano key press, store it somewhere in memory and then play it again?
or
If anybody knows how to get the key press event of the keyboard and record it, that would also be appreciated.
Thanks,
Mishal
It sounds like your particular need does not involve MIDI or capturing notes from a digital piano, if I am reading correctly. You want just the audio sound of a piano, to play back on an iPhone app?
A few questions/thoughts:
First, do you just need one note/sound? If so you should be able to easily find a sound file that is to your liking on a site that sells sound samples. I myself use sounddogs.com for various odd projects.
Next, what sort of code do you need to play the sound? What programming language are you developing the app in and how do you trigger the sound playback? These details will be helpful in giving you some ideas.
Finally, if the main obstacle is just finding and recording the sound, this question may be better moved to superuser.com since that site deals more with general computer questions, media, and technology. (StackOverflow is focused strictly on programming.)