In a first step you need to find the placeholders for "bit depth" and "sampling frequency".
If you look here:
you will find possible matches with %_bitrate% and %_samplerate%
Maybe you look for %_bitspersample%
Please check, if this are the correct one.
With the matching placeholders you can build your action and replace the '('$upper(%_extension%)')' part with your new found placeholders.
You may find some additional hints in this existing thread:
Please let us know, how your final format string looks like.