# Monkey's Audio fixtures (tools/fixtures.py): audio/ape, codecs/audio/Ape. # tests/gen/ape_cases.luau synthetic signals encoded by the reference encoder (mac 13.28: -c1000 .. -c5000, 8 / 16 / # 24 / 32-bit int and 32-bit float, 1 / 2 / 3 / 4 / 6 / 8 channels, odd rates, short and # odd lengths, silence (special frames), mono-in-stereo (pseudo stereo), APEv2 tags), and # the ffmpeg FATE samples luckynight-partial.ape (an older 3.99 encoder, cut) and # NoLegacy-cut.ape (downloaded at fixture time, not committed); each with the CRC-32 of # `mac -d`'s samples (integers as i32 LE, floats as their f32 bytes) import importlib.util, os, struct, tempfile, urllib.request, zlib _spec = importlib.util.spec_from_file_location("_wv", os.path.join(os.path.dirname(os.path.abspath(__file__)), "wavpack.py")) WV = importlib.util.module_from_spec(_spec) _spec.loader.exec_module(WV) CTX = None TMP = None CASES = [] FATE = "https://fate-suite.ffmpeg.org/lossless-audio/" def wav_samples(path): """(rate, channels, bits, float, ints-or-raw-bytes) of a WAV file (PCM / float, plain or extensible)""" d = open(path, "rb").read() i = 12 fmt = data = None while i + 8 <= len(d): cid, size = d[i:i + 4], struct.unpack_from("