Skip to content

Instantly share code, notes, and snippets.

@eazyliving
Last active August 29, 2015 14:02
Show Gist options
  • Save eazyliving/c9da436dd9c3bed8a68a to your computer and use it in GitHub Desktop.
Save eazyliving/c9da436dd9c3bed8a68a to your computer and use it in GitHub Desktop.
read chapters from tascam wavs.
set fh [open $argv]
set bytes [read $fh]
set length 0
while {$length==0} {
binary scan $bytes a4 data
if {$data=="data"} {
binary scan [string range $bytes 4 8] i length
set bytes [string range $bytes [expr $length + 16] end]
} else {
set bytes [string range $bytes 1 end]
}
}
binary scan $bytes i countmarks
set bytes [string range $bytes 8 end]
set count 0
while {$count<$countmarks} {
binary scan $bytes a4 data
if {$data=="data"} {
binary scan [string range $bytes 12 16] i mark([incr count])
set bytes [string range $bytes 16 end]
} else {
set bytes [string range $bytes 1 end]
}
}
set i 0
foreach m [lsort [array names mark]] {
set milli [string range [lindex [split [expr $mark($m) / 44100.0] .] end] 0 2]
puts "[clock format [expr $mark($m) / 44100] -gmt -1 -format %H:%M:%S].$milli Chapter [incr i]"
}
close $fh
@eazyliving
Copy link
Author

So. Das bleibt jetzt mal so. Ausgabe ist ein mp4chaps-File auf stdout. Wird auch für die Hörsuppe Verwendung finden :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment