1function [x, fs] = load_wav(path)
2% Read a mono float32 WAV as written by audio-spike-sorting: a fixed
3% 44-byte header (sample rate at byte 24) followed by IEEE float samples.
4% numbl has no audioread; in real MATLAB, audioread(path) works too.
5fid = fopen(path, 'r');
6if fid < 0
7 error('cannot open %s', path);
8end
9fseek(fid, 24, 'bof');
10fs = fread(fid, 1, 'uint32');
11fseek(fid, 44, 'bof');
12x = fread(fid, Inf, 'single');
13fclose(fid);
14end