22 fseek($fd, $ThisFileInfo[
'avdataoffset'], SEEK_SET);
23 $AUheader = fread($fd, 8);
25 if (substr($AUheader, 0, 4) !=
'.snd') {
26 $ThisFileInfo[
'error'][] =
'Expecting ".snd" at offset '.$ThisFileInfo[
'avdataoffset'].
', found "'.substr($AUheader, 0, 4).
'"';
31 $ThisFileInfo[
'au'] = array();
32 $thisfile_au = &$ThisFileInfo[
'au'];
34 $ThisFileInfo[
'fileformat'] =
'au';
35 $ThisFileInfo[
'audio'][
'dataformat'] =
'au';
36 $ThisFileInfo[
'audio'][
'bitrate_mode'] =
'cbr';
37 $thisfile_au[
'encoding'] =
'ISO-8859-1';
40 $AUheader .= fread($fd, $thisfile_au[
'header_length'] - 8);
41 $ThisFileInfo[
'avdataoffset'] += $thisfile_au[
'header_length'];
47 $thisfile_au[
'comments'][
'comment'][] = trim(substr($AUheader, 24));
52 $ThisFileInfo[
'audio'][
'bits_per_sample'] = $thisfile_au[
'bits_per_sample'];
54 unset($thisfile_au[
'bits_per_sample']);
57 $ThisFileInfo[
'audio'][
'sample_rate'] = $thisfile_au[
'sample_rate'];
58 $ThisFileInfo[
'audio'][
'channels'] = $thisfile_au[
'channels'];
60 if (($ThisFileInfo[
'avdataoffset'] + $thisfile_au[
'data_size']) > $ThisFileInfo[
'avdataend']) {
61 $ThisFileInfo[
'warning'][] =
'Possible truncated file - expecting "'.$thisfile_au[
'data_size'].
'" bytes of audio data, only found '.($ThisFileInfo[
'avdataend'] - $ThisFileInfo[
'avdataoffset']).
' bytes"';
64 $ThisFileInfo[
'playtime_seconds'] = $thisfile_au[
'data_size'] / ($thisfile_au[
'sample_rate'] * $thisfile_au[
'channels'] * ($thisfile_au[
'used_bits_per_sample'] / 8));
65 $ThisFileInfo[
'audio'][
'bitrate'] = ($thisfile_au[
'data_size'] * 8) / $ThisFileInfo[
'playtime_seconds'];
71 static $AUdataFormatNameLookup = array(
72 0 =>
'unspecified format',
78 6 =>
'floating-point',
79 7 =>
'double-precision float',
80 8 =>
'fragmented sampled data',
81 9 =>
'SUN_FORMAT_NESTED',
83 11 =>
'8-bit fixed-point',
84 12 =>
'16-bit fixed-point',
85 13 =>
'24-bit fixed-point',
86 14 =>
'32-bit fixed-point',
88 16 =>
'non-audio display data',
89 17 =>
'SND_FORMAT_MULAW_SQUELCH',
90 18 =>
'16-bit linear with emphasis',
91 19 =>
'16-bit linear with compression',
92 20 =>
'16-bit linear with emphasis + compression',
93 21 =>
'Music Kit DSP commands',
94 22 =>
'SND_FORMAT_DSP_COMMANDS_SAMPLES',
95 23 =>
'CCITT g.721 4-bit ADPCM',
96 24 =>
'CCITT g.722 ADPCM',
97 25 =>
'CCITT g.723 3-bit ADPCM',
98 26 =>
'CCITT g.723 5-bit ADPCM',
101 return (isset($AUdataFormatNameLookup[$id]) ? $AUdataFormatNameLookup[$id] :
false);
105 static $AUdataFormatBitsPerSampleLookup = array(
129 return (isset($AUdataFormatBitsPerSampleLookup[$id]) ? $AUdataFormatBitsPerSampleLookup[$id] :
false);
133 static $AUdataFormatUsedBitsPerSampleLookup = array(
157 return (isset($AUdataFormatUsedBitsPerSampleLookup[$id]) ? $AUdataFormatUsedBitsPerSampleLookup[$id] :
false);