File: CSLwithAB.tcl

package info (click to toggle)
snack 2.2.10.20090623-dfsg-6
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 3,636 kB
  • ctags: 4,759
  • sloc: ansic: 32,662; sh: 8,558; tcl: 1,086; python: 761; makefile: 575
file content (32 lines) | stat: -rwxr-xr-x 814 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# the next line restarts using wish \
exec wish8.5 "$0" "$@"

# This file shows how to handle CSL/NSP files with both A and B data chunks

package require -exact snack 2.2

set filename CSL_file_with_A_and_B_chunks.nsp

# Read in file using Snack's CSL/NSP decoder, which only gets channel A
# This is done in order to determine the number of samples in each channel

snack::sound s -load $filename

set end [expr [s length] - 1]

# Now read channel A by treating the file as raw data skipping initial
# headers and write it out in a file of its own

s read $filename -fileformat raw -skip 60 -end $end

s write channel_A.wav

# Read channel B by skipping channel A and initial headers and write it

s read $filename -fileformat raw -skip [expr 60 + $end * 2 + 8] -end $end

s write channel_B.wav

exit