Reverse playback audio file in ios objective c [duplicate] - iphone

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to reverse an audio file?
Is there any way/library in objective-c to make the audio file in reverse order.
Actually in my application user record his voice and then change the recording in various sounds. Now I have to use the reverse voice.
Please suggest me what should I do.
Thanks

There is no direct way to achieve such feature on audio file.
My suggestion to do this is to crearte chunks of audio files and merge them in reverse orderin one audio file.
You can use AVMutableComposition,AVMutableCompositionTrack,AVAssetExportSession APIs to achieve this.
You can also get more help from trimming movie file mentioned in Apple documents and same you can do for audio file.

Related

What's the best way to play a .mp3 in iPhone App ? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Iphone sdk support for playing mp3 files over the network
I need to play a .mp3 in my iPhone app. The .mp3 is on a server, and I just have the URL of it. It would be nice if it could be played in a UIWebView. In any case I want to stay in my app, and stream it.
The easiest way is to use MPMoviePlayerController. Despite the name, it fully supports audio-only streaming.
What omz said.
Btw, this is a very nice article which gives an overview of the history of iDevice media APIs:
http://cocoawithlove.com/2011/03/history-of-ios-media-apis-iphone-os-20.html
It will give you some idea of the options available.

Play song from the internet [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
downloading mp3 file from server in iphone programing.
How can I play music from the internet in my iPhone program? I want to play the song depending on the rate of download. Please guys, help. I have tried for one week.
I assume you try to open it with Safari? Could you be more specific as to why it doesn't work and what kind of source (file) that is?
Ideally you download it on your Mac or PC and sync it to your iPhone. If that is not possible you could try another browser like Opera. Alternatively there are several streaming apps which play music (free of charge) like last.fm or pandora.
good luck*

iPhone progressive download audio player [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to implement a progressive download audio player for the iPhone, using http and fixed size mp3-files.
I found the AudioStreamer project but it seems very complicated and works best with endless streams.
I need to be able to find out the total length of audio files and I also need to be able to seek in the files. I found a hacked deviation from AudioStreamer but it doesn't seem to work very well for me. http://www.saygoodnight.com/?p=14
I'm wondering if there is a simpler way to achieve my goals or if there are some better working samples out there? I found the bass library but not much documentation about it.
/Br Johannes
There's unfortunately nothing simple about playing audio streams on the iPhone. Here's the article that got me started:
Streaming and playing an MP3 stream
It's an OSX project, but most of it will work with the iPhone too. As for getting the full play time of it, you'd probably have to figure that out based on the content-length property of http header, provided it's a CBR file. Otherwise, I imagine you'd have to download the entire file before determining that.
If you only need to play MP3 files, why are you writing your own downloader/player? You have a few options built into iOS, each of which support progressive download and MP3 playback:
MPMoviePlayerController
AVPlayer
Safari <audio> player
I've personally had issues with the progressive download capabilities of MPMoviePlayerController and AVPlayer, so perhaps this is your issue also. I've found that these players try to be smart by requesting the mp3 multiple times, checking to see if the server supports progressive download via http range offsets. But when the server doesn't support range offsets the file is downloaded multiple times, eating bandwidth (!).
In my latest project I embedded a UIWebView having a html <audio> tag embedded. The Safari player seems to behave better than AVPlayer and MPMoviePlayerController, but it had its own caveats as well. For one, getting autoplay to work was a PITA.
There's a really good chapter about streaming audio in iPhone Cool Projects.
http://apress.com/book/view/9781430223573
It shows a simpler approach then AudioStreamer (Using NSURLConnection instead of CFNetwork), better suited for progressive downloading, and no multi threading code.
And for finding out the size of the audio file you can use [response expectedContentLength] in
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
I know this is a rather old post, but wanted to suggest a solid library that is open source. It is based on Matt Gallagher's original post recommended by #pzearfoss above. The current version uses AudioUnits now, rather than the AudioQueue classes, so it gives you access to the raw PCM samples for any manipulation you want to make (filtering, etc.) before playback. It also gives you progressive download capabilities for free, with rather minimal effort. The library seems to be actively updated which is a huge plus!
StreamingKit by #tumtumtum

Play midi file on the iPhone

Is it possible to play .mid files directly via some API, or one have to convert the midi file to e.g. AAC first?
(2 years later…) You can use MusicPlayer and MusicSequence APIs. Available in iOS 5.
There is no Apple API for this. You could write your own, which i think would depend on what you are hoping it is going sound like.
There is lots of available source code for reading midi files and there are a few open source synths for the iphone - or you could use openAl for triggering samples. It probably isn't going to sound like Garageband tho.
If you want it to sound as good as possible you will have to convert it first.

Change pitch of audio during playback on iPhone [duplicate]

This question already has answers here:
Real-time Pitch Shifting on the iPhone
(5 answers)
Closed 7 years ago.
What is the best way to accomplish this?
From what I have read so far, it seems you have to setup IO Remote (which is a pain itself). Do you need to do a FFT? Are there any examples out there?
Can I just speed up / slow down playback?
Thanks
OpenAL lets you pitch-shift with the AL_PITCH source property. Maybe you could run your audio through OpenAL and use that.
I've never developed for an iPhone, but if you have sufficient control over the buffer sent to the audiodevice, then you could do the following:
say you have a buffer read from an audiofile, if you send only every even sample to the audiodevice (probably put in some other buffer which is passed to some function), then it will double the frequency and half the time to play the file.
If you want something in between you need to compute in between samples or resample the audiofile = interpolate values between successive samples.