1#!/bin/sh
2# the next line restarts using wish \
3exec wish8.4 "$0" "$@"
4
5# This file shows how to handle CSL/NSP files with both A and B data chunks
6
7package require -exact snack 2.2
8
9set filename CSL_file_with_A_and_B_chunks.nsp
10
11# Read in file using Snack's CSL/NSP decoder, which only gets channel A
12# This is done in order to determine the number of samples in each channel
13
14snack::sound s -load $filename
15
16set end [expr [s length] - 1]
17
18# Now read channel A by treating the file as raw data skipping initial
19# headers and write it out in a file of its own
20
21s read $filename -fileformat raw -skip 60 -end $end
22
23s write channel_A.wav
24
25# Read channel B by skipping channel A and initial headers and write it
26
27s read $filename -fileformat raw -skip [expr 60 + $end * 2 + 8] -end $end
28
29s write channel_B.wav
30
31exit
32
33