The acoustic and entropy transfer functions of quasi-one-dimensional nozzles are studied analytically for both subsonic and choked flows with and without shock waves. The present analytical study extends both the compact nozzle solution obtained by Marble & Candel (J. Sound Vib., vol. 55, 1977, pp. 225–243) and the effective nozzle length proposed by Stow, Dowling & Hynes (J. Fluid Mech., vol. 467, 2002, pp. 215–239) and by Goh & Morgans (J. Sound Vib., vol. 330, 2011, pp. 5184–5198) to non-zero frequencies for both modulus and phase through an asymptotic expansion of the linearized Euler equations. It also extends the piecewise-linear approximation of the velocity profile in the nozzle proposed by Moase, Brear & Manzie (J. Fluid Mech., vol. 585, 2007, pp. 281–304) to any arbitrary profile or equivalently any nozzle geometry. The equations are written as a function of three variables, namely the dimensionless mass, total temperature and entropy fluctuations, yielding a first-order linear system of differential equations with varying coefficients, which is solved using the Magnus expansion. The solution shows that both the modulus and the phase of the transfer functions of the nozzle have a strong dependence on the frequency. This holds for both choked flows and subsonic converging–diverging nozzles. The method is used to compare two different nozzle geometries with the same inlet and outlet Mach numbers, showing that, even if the compact solution predicts no differences between the transfer functions of the two nozzles, significant differences are found at non-zero frequencies. A parametric study is finally performed to calculate the indirect to direct noise ratio for a model combustor, showing that this ratio decreases at higher frequencies.