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