modified flattener to use hsndfile rather than WAVE. So now we can write aiffs directly, instead of wavs. Also tidied up code a bit.