Help with Bitrate of audio file

I wanted to make an app to display the bit rate of an audio file. I can get automator to pass the list of selected files. I can get the file name printed. I cannot get the bit rate or display it. I also would like to have a window pop up with the results. Not sure what to do there, haven’t gotten that far.
Here is the script in the do shell script part:

#! /bin/bash
for FILE1 in “$@”
#echo $FILE1 | sed 's/^.
BR=$(afinfo $FILE1 | grep “bit rate”)
echo -e $FN “\t” $BR

HELP please.


you could retrieve the information with Spotlight metadata

set audioFile to choose file
tell application "System Events"
	set fileKind to kind of audioFile
	set fileName to name of audioFile
end tell
if fileKind contains "audio" then
	set bitRate to do shell script "mdls -name kMDItemAudioBitRate -raw " & quoted form of POSIX path of audioFile
	display dialog "Audio Bit Rate of file " & fileName & " is " & bitRate buttons {"Cancel", "OK"} default button "OK"
	display dialog "file " & fileName & " seems to be no audio file"
end if