#This work is licensed under the
#Creative Commons Attribution-Share Alike 3.0 United States License.
#To view a copy of this license, visit
#http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
#Creative Commons,
#171 Second Street, Suite 300,
#San Francisco, California, 94105, USA.

INPUT "the Shorten file stream";
OUTPUT "PCM samples";
VAR magic_number "magic number";
VAR version "version";
VAR file_type "file type";
VAR channels "channels";
VAR block_length "block length";
VAR max_LPC "maximum LPC";
VAR mean_count "mean count";
VAR bytes_to_skip "bytes to skip";
VAR PCM_data "PCM data";
FUNC read_long "read long" "shorten:read_long";
FUNC process_shorten_commands "process Shorten commands"
"shorten:process_commands";
magic_number <- read 4 bytes;
version <- read 8 unsigned;
assert magic_number == bytes(97, 106, 107, 103);
assert version == 2;
file_type <- read_long();
channels <- read_long();
block_length <- read_long();
max_LPC <- read_long();
mean_count <- read_long();
bytes_to_skip <- read_long();
skip bytes_to_skip bytes;
PCM_data <- process_shorten_commands(channels,
                                     block_length,
                                     max_LPC,
                                     mean_count);
return PCM_data;
