Looping m4a audio
J. Landman Gay
jacque at hyperactivesw.com
Sat Feb 23 21:51:49 EST 2013
I forwarded Colin's response to the client and this is his reply:
*** start quote ***
The music files we make have sample accurate loop points (however,
audibly they don't need to be sample-accurate, just really close to loop
perfectly when they are uncompressed). Any well-looped .aiff or .wav
file would be a candidate for testing but I've included one.
The problem I'm referring to isn't in the original uncompressed files;
as you'll hear, they loop perfectly before compression. The problem I'm
writing about is is purely the result of the compression process and is
commonly known artifact of .mp3 and AAC compression. I've never seen a
solution other than the one referred to in the link. [JG: see below for
link] However that solution seems Apple specific and may be viable only
during the execution of an app written with Apple tools that can use
Audio Queue. Oddly, this is one of the real strengths of Director.
Uncompressed audio files added to casts, which are then compressed
themselves, do loop perfectly. I'll see if I can find out.
The relevant problem is that there may not be a tool to do what is
required in the summary of the link I sent:
> Seamlessly looping a compressed audio file requires three pieces of
information related to how the audio media was compressed:
>
> • The number of silent sample frames (known as priming frames) added
to the front of the encoded audio data.
> • The number of padding samples frames (known as remainder frames)
added to the end of the encoded audio data.
> • The audio data packet count indicating the total number of audio
data packets contained in the file.
> Use AudioQueueEnqueueBufferWithParameters to enqueue all of the
packets you have to the audio queue, trim off the priming sample frames
from the start, trim off remainder sample frames from the last packet
and reset the current packet count to start reading data from the
beginning of the file creating the loop.
Colin is correct that the compression is in packets, as described in the
quote above. In fact, a solution is described in the link, I just don't
know how to perform it.
I suspect that the solution may not be "encodable" in the file itself,
rather the solution is via special treatment during playback. However,
if we could do that in LiveCode, that would be cool. But LiveCode would
have to reach inside what QuickTime is doing.
Here's something to play with, in case. If there was a possibility of
creating a tool to process uncompressed files into loopable compressed
files it would be out there by now, that's why I don't think it exists
outside custom playback.
The archive I included has an uncompressed loopable file as an .aif,
while the .m4a is compressed as we'd provide them.
*** end quote ***
The link he refers to is at the Apple Developer web site:
<http://developer.apple.com/library/mac/#qa/qa1636/_index.html>
I have placed the two files in my dropbox:
<https://dl.dropbox.com/u/23431607/Loop.aif.zip>
<https://dl.dropbox.com/u/23431607/Loop.m4a>
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list