Looping m4a audio

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Looping m4a audio

J. Landman Gay
A client wants to use m4a audio files that loop, but there's a short
blip each time it rolls around to the beginning. Is there a way to
seamlessly loop those? I said I'd ask here since we have some audio pros
on the list.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Colin Holgate-2
Blips would happen if the looping isn't good, or if the sound ends with the last sample not at a zero value.

There's another complication with compressed audio, in that the sound is compressed in particular size packets. That could cause the loop to either have silence at the end, or to cut into the sound.

Is the sound somewhere online, that we can take a look at it?


On Feb 23, 2013, at 6:49 PM, "J. Landman Gay" <[hidden email]> wrote:

> A client wants to use m4a audio files that loop, but there's a short blip each time it rolls around to the beginning. Is there a way to seamlessly loop those? I said I'd ask here since we have some audio pros on the list.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

ScottR
In reply to this post by J. Landman Gay
Hi Jacque:

In my experience, I've never been able to reliably loop a native player
seamlessly.  Even if it I got it working on one system, there's always
another that runs slowly or has multiple process processes running, and a
split second pause is audible in between loops.

The only way I've ever been able loop audio seamlessly is using Trevor
DeVore's Enhanced QuickTime external. The external has a
qtMakeSeamlessLoop command that allows you to loop audio a specified
number of times seamlessly.  Check the Audio section of the docs here:
http://www.bluemangolearning.com/download/revolution/enhancedqt/eqt_documen
tation/


That said, if there's an actual "blip" in the file, you may be stuck, but
it's likely the blip is the result of the (attempted) loop.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design




On 2/23/13 3:49 PM, "J. Landman Gay" <[hidden email]> wrote:

>A client wants to use m4a audio files that loop, but there's a short
>blip each time it rolls around to the beginning. Is there a way to
>seamlessly loop those? I said I'd ask here since we have some audio pros
>on the list.
>
>--
>Jacqueline Landman Gay         |     [hidden email]
>HyperActive Software           |     http://www.hyperactivesw.com
>
>_______________________________________________
>use-livecode mailing list
>[hidden email]
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

J. Landman Gay
Thanks Scott. We're trying to avoid externals but I may be able to talk
them out of that if nothing else works. It isn't a real "blip", it's the
stutter that happens between loops like you said.

I've asked the client if he's willing to share one of the files, I'll
see what he says.

On 2/23/13 6:42 PM, Scott Rossi wrote:

> Hi Jacque:
>
> In my experience, I've never been able to reliably loop a native player
> seamlessly.  Even if it I got it working on one system, there's always
> another that runs slowly or has multiple process processes running, and a
> split second pause is audible in between loops.
>
> The only way I've ever been able loop audio seamlessly is using Trevor
> DeVore's Enhanced QuickTime external. The external has a
> qtMakeSeamlessLoop command that allows you to loop audio a specified
> number of times seamlessly.  Check the Audio section of the docs here:
> http://www.bluemangolearning.com/download/revolution/enhancedqt/eqt_documen
> tation/
>
>
> That said, if there's an actual "blip" in the file, you may be stuck, but
> it's likely the blip is the result of the (attempted) loop.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX Design
>
>
>
>
> On 2/23/13 3:49 PM, "J. Landman Gay" <[hidden email]> wrote:
>
>> A client wants to use m4a audio files that loop, but there's a short
>> blip each time it rolls around to the beginning. Is there a way to
>> seamlessly loop those? I said I'd ask here since we have some audio pros
>> on the list.
>>
>> --
>> Jacqueline Landman Gay         |     [hidden email]
>> HyperActive Software           |     http://www.hyperactivesw.com
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Alex Shaw
In reply to this post by J. Landman Gay
Hi Jacqueline

Try loading the file into a audio editor like Audacity
(http://audacity.sourceforge.net) and check the beginning to end of the
clip.

Blips should be obvious and generally if the sound has been trimmed
badly then a simple tool like audacity allows you to smooth things out.

If there is a slight gap between repeats then try a very short fade in
at the beginning or fade out at the end.

regards
alex

On 24/02/13 9:49 AM, J. Landman Gay wrote:
> A client wants to use m4a audio files that loop, but there's a short
> blip each time it rolls around to the beginning. Is there a way to
> seamlessly loop those? I said I'd ask here since we have some audio pros
> on the list.
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

J. Landman Gay
In reply to this post by Colin Holgate-2
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         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Colin Holgate-2
The example loop has a clunk in it, even in QuickTime Player. I cleaned that up and could then get clunk-free looping of AIF or M4A in LiveCode.

But, there was a moment of silence when it loops. That is the case in LiveCode with either AIF or M4A as external files, and also in QuickTime Player. Only Director would play the sound perfectly.

Next I tried this:

 play audioclip 1 looping

That works perfectly in LiveCode. Of course, that limits you to desktop only, it won't work on mobile. And it would need to be loaded into memory, as is the case when using audioClips.

Would that be acceptable?
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Colin Holgate-2
Another solution to the problem occurred to me, that works with external files, if you are allowed to make the M4A be MOV:

Open the M4A in QuickTime Player 7
Command-J
Select the sound track
Click the "Other Settings" tab
Click the checkbox Cache (hint)
Note the optimistic note "Improve looping performance by caching this track in memory"

That MOV will now loop perfectly in LiveCode, even though it's playing an AAC soundtrack.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Colin Holgate-2
In reply to this post by Colin Holgate-2
I went back to try other ideas, and the looping was no longer successful, but as I tried things it would be good again, then not good again!

For a moment I thought I had a better solution, which you should try, in case it is as good as it was for me, momentarily. Try this with the player set directly to the audio file:

on mouseup
  set the looping of player 1 to true
  set the alwaysBuffer of player 1 to true
  play player 1
end mouse up

If that does work for you, it would be as good a solution as setting the cache in QuickTime Player.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

ScottR
Your experience is consistent with mine: seamless looping playback with a player is unreliable.

Looping imported audio clips works better, perhaps because the audio is loaded into memory, but  is still unreliable and requires the audio to be in one of the few supported formats.

There's another option that involves using revBrowser and one of the many web based audio players out there, but I've never gone to the trouble to work out a setup, and revBrowser has its quirks.

If seamless playback is key, The EQT external should be a good option.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design

On Feb 24, 2013, at 5:41 AM, Colin Holgate <[hidden email]> wrote:

> I went back to try other ideas, and the looping was no longer successful, but as I tried things it would be good again, then not good again!
>
> For a moment I thought I had a better solution, which you should try, in case it is as good as it was for me, momentarily. Try this with the player set directly to the audio file:
>
> on mouseup
>  set the looping of player 1 to true
>  set the alwaysBuffer of player 1 to true
>  play player 1
> end mouse up
>
> If that does work for you, it would be as good a solution as setting the cache in QuickTime Player.
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

J. Landman Gay
In reply to this post by Colin Holgate-2
On 2/24/13 6:20 AM, Colin Holgate wrote:

> The example loop has a clunk in it, even in QuickTime Player. I
> cleaned that up and could then get clunk-free looping of AIF or M4A
> in LiveCode.
>
> But, there was a moment of silence when it loops. That is the case in
> LiveCode with either AIF or M4A as external files, and also in
> QuickTime Player. Only Director would play the sound perfectly.
>
> Next I tried this:
>
> play audioclip 1 looping
>
> That works perfectly in LiveCode. Of course, that limits you to
> desktop only, it won't work on mobile. And it would need to be loaded
> into memory, as is the case when using audioClips.
>
> Would that be acceptable?

I really appreciate all your work on this Colin, thanks so much. I tried
the m4a in a player and I didn't hear any silence between loops, but I'm
still on Lion. The client in Mt Lion does hear it. I'm inclined to agree
with Scott that there's no good way to deal with this. The results also
varied for my client between different playbacks, like it did for you.
Sometimes it worked, sometimes not.

The link to the enhanced QT external docs didn't work and I couldn't
find a new one. We'd like to avoid externals if possible, but I was
curious to read about it anyway.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Klaus on-rev
Hi Jaqueline,

Am 24.02.2013 um 21:49 schrieb J. Landman Gay <[hidden email]>:

> ...
> The link to the enhanced QT external docs didn't work and I couldn't find a new one.

Here it is:
<http://www.bluemangolearning.com/download/revolution/enhancedqt/eqt_documentation/>

> We'd like to avoid externals if possible, but I was curious to read about it anyway.
>
> --
> Jacqueline Landman Gay         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com

Best

Klaus

--
Klaus Major
http://www.major-k.de
[hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

J. Landman Gay
On 2/24/13 3:00 PM, Klaus on-rev wrote:
> Hi Jaqueline,
>
> Am 24.02.2013 um 21:49 schrieb J. Landman Gay <[hidden email]>:
>
>> ...
>> The link to the enhanced QT external docs didn't work and I couldn't find a new one.
>
> Here it is:
> <http://www.bluemangolearning.com/download/revolution/enhancedqt/eqt_documentation/>

Perfect. Thanks Klaus.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio

Simon
In reply to this post by J. Landman Gay
Hi Jacqueline,
How about using two players and ping pong between the two, simulating a loop?
I'm not sure but I think some blips are caused by an internal "get-file-in-zero-time-and-play-it-now".

Simon

J. Landman Gay wrote
A client wants to use m4a audio files that loop, but there's a short
blip each time it rolls around to the beginning. Is there a way to
seamlessly loop those?
Reply | Threaded
Open this post in threaded view
|

Re: Looping m4a audio (after 2 years)

Trevix
This post has NOT been accepted by the mailing list yet.
OK. We are now in 2015 and, for what I tried, the problem with audio looping is still there.

Enhanced Quicktime does not work anymore (on LC7.0.4) and for that matter, Apple decided to drop quicktime.

I need to put more then one loop on desktop apps that play in the same time. And no matter how much I try, the control players always make the loop audible.

The point is, for the LC people: Why to have a feature if you cannot fixit in 2 years. It is just a loss of time !