TAAE2 - Crossfade looping
I am not so experience developer in core audio.
Currently I am working on one sequencer project and I want to implement Crossfade loop audio.
Here is explanation :
When user press any key in sequencer piano it will play some audio file and and that audio file will continue to play in loop until user release the key. But that loop will be crossfade to itself.
I am using AEAudioFilePlayerModule for looping but not sure how to crossfade audio file with this class.
Explanation of Cross fade :
Start/End: This setting allows me to choose where in the audio file I want the app to constantly loop so that if user taps+holds note down for a long time, the audio will sound continuously until the user releases his finger.
XFade: This function (crossfade) allows me to chose how to fade between the end and start of the audio loop. This is good so
that the sound will loop smoothly. Here, 9999 is set. So at about 5k samples before the 200k end point, the audio for this note
will begin to fade away and at the same time, the audio loop starting at 50k samples will fade in for a duration of about 5k samples (1/2 the XFade amount).
Hi @pratik. I'm afraid you'll need to write your own player (or adapt the current one) for crossfading if you want this behaviour; the built-in player only does a microfade upon play and stop, not at the loop boundary.
Thanks for reply Michael
can you give me the idea in brief on how create this player with AEAudioFilePlayerModule ?
It'd be quite a long answer, I'm afraid, and very technical, involving expanding the play region either side and buffering the outer parts to crossfade into the inner parts. I don't really have the resources to help you there, I'm afraid.
I am working on cross fade player and I am using AEAudioFilePlayerModule for it
but the currently problem is when I create the AEAudioFilePlayerModule object with completion block it is not actually released later.
Even i tried to nil it's object as well. but no luck.
Check the code sample.
Oh - are you using the latest version, from Github? There was indeed a retain cycle, but that should be fixed now.
edit: I notice this:
That's going to cause your own retain loop, I'm afraid - you're gonna want to use
Thank you so much.