#!/bin/bash
echo $*
mplayer -vc ffh264 -vo png -nosound $*
for f in *.png; do
	pngtopnm $f |
	pamscale 0.3 |
	pamditherbw -threshold -value 0.5 |
	pamflip -tb |
	pamtopnm |
	potrace -b gimppath |
	sed -ne 's/.*X: \([0-9]*\) Y: \([0-9]*\).*/\1 \2/p' > ${f%.png}.points
done
./oscdraw 6568 48000 > bad_apple.raw
sox -c2 -r 48000 -b 16 -e unsigned-integer bad_apple.raw bad_apple.wav
rm bad_apple.raw
