Loops are clicking

58 views
Skip to first unread message

Fabs@Temponautics

unread,
Dec 12, 2013, 12:33:23 PM12/12/13
to objectal-...@googlegroups.com
Hi Karl et al.,

first let me say: thank you for writing a fantastic open source library; ObjectAL is wonderful.

I am running into an issue where sounds I set to loop regularly "click" intermittently, ie. when the loop restarts. (This is on iOS).
Now, I know the standard culprits, I've done my extensive tour of googling and stack-overflow'ing, and I have ruled out the following potential sources below: 

- my sound files are correctly looping when played on any other digital audio program (e.g. QuickTime, Audacity, etc.). They should sound fine, but don't.
- I tried setting initial gain to zero, then fade in the gain, to no avail: It keeps clicking.
- I tried not using the loop, but just restarting "source play" whenever the source was found to be stopped. No help.
- I tried stopping the source before hitting play. No help.
- I tried replacing all "malloc" calls in your code with "callocs" to ensure the buffer memory was properly zeroed. No help either.

I'm really stumped as to what could be the cause.
I hope I'm overlooking something fantastically simple, but I fear I might not...

Using XCode 5.02, iOS 7, MacOS 10.8.6, Kobold2D + Cocos2D 2.1, ObjectAL 2.1 (I believe - the last version that came bundled with Kobold 2.1).

The way I'm playing the sounds is by handling them through sources created by ALChannels that were handed my loaded buffers.
I preload my buffers through OALSimpleAudio (I created a subclass of it to manage my sound channels through that subclass).

Any ideas?

Many thanks

Fabs

Karl Stenerud

unread,
Dec 12, 2013, 1:18:05 PM12/12/13
to objectal-...@googlegroups.com
Are the sound files mp3? mp3 is notoriously difficult to loop properly (see http://www.compuphase.com/mp3/mp3loops.htm).

Can you try it with an uncompressed audio file? (wav or caff signed 16-bit little endian)

If that works, consider switching to AAC, which has similar compression quality to mp3 but handles looping a lot better.


--
You received this message because you are subscribed to the Google Groups "ObjectAL-for-iPhone" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectal-for-ip...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Benoît Lahoz

unread,
Dec 13, 2013, 7:13:17 AM12/13/13
to objectal-...@googlegroups.com
I had a 'click sound' trouble too while building ALBuffers from my own buffers built in PCM with a WAV header (from WAV, mp3, AAC, ...).
The problem was the WAV header itself. I removed it and all works well, feeding the buffer with only the PCM data.
Could it be the same problem ?

(Sorry for my bad English)

Fabs@Temponautics

unread,
Dec 13, 2013, 9:41:28 AM12/13/13
to objectal-...@googlegroups.com
Hi Karl, hi Benoît,

thank you for both your fast and helpful replies. We did use .caf files from the beginning, which made me wonder, so I followed your link, Karl, to learn about mp3 loop troubles and why it's worse than caf, hoping to find a clue there even ghough we don't use mp3; Benoît's tip on headers also pointed in the way of my own files being the most likely culprit, so all of that made me analyze my own files again,.... and now I'm embarassed to say it is _some_ of our own files that do click, so creating a seamless loop is not as easy as I thought, though I did google some helpful hints here: 

http://www.youtube.com/watch?v=ryLpfVecUDs

and

http://www.bradleymeyer.com/wp-core/creating-seamless-loops-in-sound-forge/

explain how to do it in a wave editor. I've fiddled with this now, and the results are still not perfect with the material I got. Now there's an opportunity...

Thank you both! At least now I know the culprit, and am no longer pulling my hair out!

Cheers,

Fabs

Reply all
Reply to author
Forward
0 new messages