Ensure flag -ldl is used when building wav2prg
Fix a corner case in which the first halfwave could be past the start of the first block