export WIDTH=720 # 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 [ "$#" -lt 1 ] then echo -e "\nTwibright Reflectoscope high performance realtime music analyser" >&2 echo -e "\nUsage: rfs " >&2 echo -e "\nwhere is playable by mplayer" >&2 echo -e "Output is MPEG4 24Mbps PCM sound into .avi" >&2 echo -e "GAIN sets the sensitivity of the analyzer / brightness of" \ "the output. Default 30" >&2 echo -e "BANDWIDTH sets the selectivity / bandwidth in semitones. Default 0.333\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 -vc null -vo null "$1" -ao pcm:file=/dev/stdout -really-quiet | sox -t wav - -r "$SAMPLE_RATE" -c 1 -s -2 -L -t raw - | ./sf | mencoder - -demuxer rawvideo -rawvideo fps="$FRAME_RATE":w="$WIDTH":h=576:yuy2 -audiofile "$1" -aspect 1.333 -o "$1".avi -of avi -oac pcm -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=24000000