export WIDTH=360 export HEIGHT=576 # Width is the luma width. The chroma width and analysis width is half */ export FRAME_RATE=25 export LOWER_FREQUENCY=167 export SAMPLES_PER_FRAME=`echo "$LOWER_FREQUENCY" \* "$WIDTH" / 2 \ / "$FRAME_RATE" | bc` echo SAMPLES_PER_FRAME=$SAMPLES_PER_FRAME if [ "$#" -lt 1 ] then echo -e "\nTwibright Reflectoscope high performance realtime music analyser" >&2 echo -e "\nUsage: rfs_enc " >&2 echo -e "\nwhere is playable by mplayer" >&2 echo -e "GAIN sets the sensitivity of the analyzer / brightness of" \ "the output. Default 1 (just no clipping)" >&2 echo -e "BANDWIDTH sets the selectivity / bandwidth in semitones. Greater bandwidth is quicker display. Default 0.6\n" \ >&2 exit 1 fi if [ `expr "$WIDTH" % 2` -ne 0 ] then echo Width must be even. >&2 exit 1 fi SAMPLE_RATE=`expr "$SAMPLES_PER_FRAME" \* "$FRAME_RATE"` echo SAMPLE_RATE="$SAMPLE_RATE" if [ -z "$SPEEDUP" ] ; then SPEEDUP=1 fi echo SPEEDUP=$SPEEDUP make sf && mplayer -vo null "$1" -ao pcm:file=/dev/stdout -really-quiet \ | sox -t wav - -r "$SAMPLE_RATE" -c 1 -s -2 -L -t raw - \ | ./sf \ | mplayer -speed "$SPEEDUP" - -demuxer rawvideo -rawvideo fps="$FRAME_RATE":w="$WIDTH":h="$HEIGHT":yuy2 -audiofile "$1" -nokeepaspect -aspect 1.333