function [t,W] = wav(name)

  fp = fopen([name ".wav"], "r");

  H = fread(fp, 22, "uint16");
  
  S = H(13);
  N = (H(21) + H(22)*65536) / 2;
  printf("Sample rate: %d Hz\n", S)
  printf("Number of samples: %d\n", N)
  
  W = fread(fp, N, "int16", "l");
  t = linspace(0, (N-1)/S, N)';
  
  fclose(fp);

endfunction
