How is loop information encoded in FLAC files? I'm trying to convert .wav files (samples for a sampled instrument) into FLAC format.  The .wav files have loop information in the smpl chunk.  I understand that various sample players support loops in FLAC files.  However, I can't find a converter that converts .wav to .flac and preserves the loop information.  I could code it myself (say, by postprocessing results from SoX), but can't find any information on how loops are encoded in FLAC files.

I'm using this for sampled instruments with hundreds of .wav files and so need to be able to do batch processing.

Sorry if this is the wrong forum.  It's not quite stackoverflow or sounddesign.
The simple answer is, &quot;the same way it's kept in .wav files.&quot;  FLAC uses the same RIFF &quot;chunk&quot; structure as WAV.  The WAV file format has a chunk for use by samplers, which includes looping information.  I found I could simply copy that chunk from the WAV file and append it to the FLAC file and it worked (for anything that supported loops in FLAC files, which isn't everything -- for example linuxsampler does not, due to a library it uses not supporting it yet.)
Better yet, the flac application has a --keep-foreign-metadata option that does the trick without my having to code anything.