     { header riff-chunk-header }
     { body uchar[0] } ;
 
-ERROR: invalid-wav-file ;
+ERROR: invalid-audio-file ;
 
 : ensured-read ( count -- output/f )
     [ read ] keep over length = [ drop f ] unless ;
 : ensured-read* ( count -- output )
-    ensured-read [ invalid-wav-file ] unless* ;
+    ensured-read [ invalid-audio-file ] unless* ;
 
 : read-chunk ( -- byte-array/f )
     4 ensured-read [ 4 ensured-read* dup le> ensured-read* 3append ] [ f ] if* ;

USING: alien.c-types alien.syntax audio combinators
combinators.short-circuit io io.binary io.encodings.binary
io.files io.streams.byte-array kernel locals math
sequences alien alien.data classes.struct accessors ;

    ] [
        [ header>> size>> 4 memory>byte-array le> dup ]
        [ body>> >c-ptr ] bi swap memory>byte-array
    ] bi*
    <audio>
    convert-data-endian ;

: read-wav ( filename -- audio )
    binary [
