(bind-func sf_channels_from_file
"get the total number of channels from an audio file"
(lambda (filename)
(let ((info:SF_INFO* (salloc))
(audiofile (sf_open filename SFM_READ info)))
(if (null? audiofile)
-1
(begin
(sf_close audiofile)
(sf_channels info))))))