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=`expr "$LOWER_FREQUENCY" \* "$WIDTH" / 2 \ / "$FRAME_RATE"` echo SAMPLES_PER_FRAME=$SAMPLES_PER_FRAME if [ "$#" -ge 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. Default 0.6. The bigger the quicker display.\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" FAST_FRAME_RATE=`expr $FRAME_RATE + 1` # To make sure mplayer is eager to consume frames make sf && arecord -f S16_LE -c1 -r"$SAMPLE_RATE" -t raw | tee captured.raw | \ ./sf \ | mplayer - -demuxer rawvideo -rawvideo fps="$FAST_FRAME_RATE":w="$WIDTH":h="$HEIGHT":yuy2 -nokeepaspect -aspect 1.333