[7.1] Can I loop sound seamlessly?

Small sounds that can be kept entirely in memory the whole time can be seamlessly looped simply by setting the "looped" checkbox in the sound cast info dialog box. They'll play continuously without an intervention from your code at all. As far as I know, there is no way of testing or setting this property via Lingo.

External AIFF sounds played with the sound playFile command cannot be looped automatically. One way to get around this is to frequently test the sound channel you started playing in until it is no longer busy and then call sound playFile again -- this can be pretty laborious, but will be the best (or only) solution in some cases. This will never give a smooth loopback, since you can't know you have to loop until after the sound has actually stopped.

Alternatively, the AIFF can be linked as a QuickTime movie, which can in turn be looped. In this case, though, you'll almost certainly be better off converting the file to a QuickTime movie first, since QuickTime seems a bit flaky in its treatment of AIFFs masquerading as MooVs. Either way, the loop is unlikely to be as smooth as with a sound cast kept wholly in RAM, since there'll usually be a seek time overhead for locating the start of the sound on disk again.

(Of course, if the sound's finish is significantly different from its start, the loop will not be smooth in any case. You'll need to adjust the join in a sound editing package beforehand...)