<?php
if ($data != '') {
    header('Content-Type: ' . $type);
    header('Content-Length: '. $length);
    header('Content-Range: bytes 0-' . ($length - 1) . '/' . $length);
    header('Cache-Control: public, must-revalidate, max-age=0');
    header('Pragma: no-cache');  
	header('Accept-Ranges: bytes');
	header("Content-Disposition: inline; filename=test.wav");
	header("Content-Transfer-Encoding: binary");
    echo $data;
    exit();   
} else {
    throw new CHttpException(400, 'Binary data is empty');
}
?>