I can propose two solutions:
\documentclass{article}
%%% solution 1
\usepackage{amsmath}
\newcommand{\setmetera}[2]{\ensuremath{\genfrac{}{}{0pt}{}{#1}{#2}}}
%%% solution 2
\newcommand{\setmeterb}[2]{\ensuremath{%
\vcenter{\offinterlineskip
\halign{\hfil##\hfil\cr
$\scriptstyle#1$\cr
\noalign{\vskip1pt}
$\scriptstyle#2$\cr}
}}%
}
\begin{document}
This is common time: \setmetera{4}{4}
This is a ternary time: \setmetera{3}{4}
\bigskip
This is common time: \setmeterb{4}{4}
This is a ternary time: \setmeterb{3}{4}
\end{document}

Some comments on the second solution
The definition of \setmeterb
uses some low level TeX trickery. I use \ensuremath
for being able to use \vcenter
that will center the result with respect to the line (the "geometric center" will actually be slightly above the baseline).
In the \vcenter
I set an alignment built with the primitive \halign
, which avoids all the things LaTeX does with tabular
in order to ensure equal spacing between rows, which is exactly what we don't want in this case where the two rows consist only of numbers; in particular the insertion of interline glue is disabled with \offinterlineskip
. So the final trick is to set one centered column
\halign{\hfil#\hfil\cr ...}
and then add the two rows, separated by 1pt of white space. The #
must actually be ##
because we're using it in a definition.
\newcommand*\meter[2]{\resizebox*{!}{.7\baselineskip}{\meterfrac{#1}{#2}}}
and then use\meter{4}{4}
in the text. BTW:\begin{music}
and\end{music}
isn't actually needed here.C
used for4/4
meter? (I understand that you want a general solution, I'm just making sure that I'm not missing some point.)C
might be used, but it's less popular nowadays (though I think widely understandable) and I have never encountered this in normal text, only in notation (but I don't posses much experience in this field).