Statistical Thermodynamics
The rationalization of the specific heat capacity at constant volume being only a function of temperature, can be derived from combining quantum mechanics and statistical thermodynamics. I am sure you know the steps:
- You solve the time-independent Schrodinger's equation for the $1$-dimensional particle in the box. The result you are interested in, are the the energy eigenvalues $E_n$ that depend on the particular state of the particle, denoted by $n$.
- Considering Boltzmann's theory, we calculate the molecular partition function, by summing along all possible states of the quantum system
$$ q = \sum_{n = 1}^\infty \exp(-\beta E_n) \tag{1} $$
before that, you correct the $E_n$, so they are relative to the lowest state, i.e. $n = 1$. This is actually the exact value. However, we approximate the infinite sum to an integral in order to get an analytic expression.
- You assume that the translational movements along the $x$, $y$, and $z$ directions are independent. This allows you to write down the molecular partition function as a product of three individual ones, i.e., $q = q_xq_yq_z$.
- That's all. Once you have the molecular partition function, all the thermodynamic properties are obtained with calculus. In this case our task is to do
$$ C_\mathrm{V} = 2k_BT\left(\frac{\partial \ln q}{\partial T}\right)_V
+ k_BT^2 \left(\frac{\partial^2 \ln q}{\partial T^2}\right)_V \tag{2} $$
Once you compute Eq. (2), you will get that it is independent of pressure and temperature. If we take into accounte other modes of movement, this will not hold, and $T$ appears again. Is this a realistic result? Well, we need to test the theory. We search for some substances, and find that in the case of $\ce{Ar}$, the heat capacity is independent of pressure and also on temperature. What is our conclusion? Reality may be complex, but for $\ce{Ar}$, this is all the movement that we need to account for explaining the specific heat capacity at constant volume (if it is a gas). For most gases, this doesn't work, unfortunately.
Classical Thermodynamics
[OP] I've come across this article which says that the constant pressure heat capacity is independent of pressure.
First you need to accept the ideal gas law, that comes from early experimentation by well-known chemists
$$ pV = RT \tag{3} $$
$V$ here is the molar volume.
In addition you need to accept some consequences that derive from Joule's experiments, which he carried out in his basement in Manchester. If you are interested in, you can search them, they were very basic but accurate. One of these consequences is the following:
- The internal energy of an ideal gas is only a function of temperature, i.e., $ U = U(T)$.
The main consequence he found is that heat is another form of energy, such as work, and it can change the internal energy of a substance (the $1$st law in fact).
Thereby, by definition of the heat capacity at constant volume
$$ C_\mathrm{V}^\mathrm{ig} := \left[\frac{\partial U(T)}{\partial T}\right]_V =
\mathrm{function(T)} \tag{4} $$
and that is the proof, no more, no less.
The specific heat capacity at constant pressure also derives from the definition of enthalpy
\begin{align}
H &:= U(T) + pV \quad \text{(use Eq. 3)} \\
H &= U(T) + RT \therefore H = H(T) \\
\end{align}
so the enthalpy is just a function of temperature. Again, by the definition of specific heat capacity at constant pressure
$$ C_\mathrm{p}^\mathrm{ig} := \left[\frac{\partial H(T)}{\partial T}\right]_p =
\mathrm{function(T)} \tag{5} $$
And that's it. Again, no more, no less.
[OP] And also, how can one account for the pressure dependence using a real gas equation?
Unfortunately, EoS's will not tell you the heat capacity of any substance. The values must be obtained by experimentation. The answer should end here. However, something which is not said often, is that it offers information of the residual heat capacity. A residual thermodynamic property is the difference between the real value and the value if the substance behaved as an ideal gas, ie. $M^R(p,T) = M(p,T) - M^\mathrm{ig}(p,T)$. If you are interested in this, you can keep reading.
Similar to statistical thermodynamics, once we have an EoS, the rest is just math. I will exemplify to you with the very basic virial equation in terms of pressure
$$ Z = 1 + \frac{Bp}{RT} \tag{6} $$
and by the fundamental relationship $\mathrm{d}G= V\mathrm{d}p - S\mathrm{d}T$, or in residual form, $\mathrm{d}G^R= V^R\mathrm{d}p - S^R\mathrm{d}T$. At constant temperature we have
\begin{align}
\require{cancel}
\mathrm{d}G^R &= V^R \mathrm{d}p \\
\mathrm{d}G^R &= (V - V^\mathrm{ig}) \mathrm{d}p \\
\mathrm{d}G^R &= \left(\frac{ZRT}{p} - \frac{RT}{p}\right) \mathrm{d}p \\
\mathrm{d}G^R &= \frac{RT}{p} (Z - 1) \mathrm{d}p \quad \text{(use Eq. 6)} \\
\mathrm{d}G^R &= \frac{\cancel{RT}}{\cancel{p}} \frac{B\cancel{p}}{\cancel{RT}} \mathrm{d}p\\
\mathrm{d}G^R &= B \mathrm{d}p \\
\int_{G^R(0,T)}^{G^R(p,T)} \mathrm{d}G^R &= B \int_{0}^p \mathrm{d}p \\
G^R(p,T) - G^R(0,T) &= B(p - 0) \quad \text{(divide by $RT$)} \\
\frac{G^R(p,T)}{RT} &= \frac{Bp}{RT} + \frac{G^R(0,T)}{RT} \rightarrow
\boxed{\frac{G^R(p,T)}{RT} = \frac{Bp}{RT} + C} \tag{7} \\
\end{align}
That the residual Gibbs energy is zero in the limit of zero pressure, is something that we cannot determine, but it can be shown by experimental data that it is not zero. Therefore, we just leave it as letter $C$, that is only a function of temperature (we evaluated the pressure at “$0$” there). There is a relation between $G^R$ and $H^R$, which I will not prove, let me know in the comments if you want to know where it comes from
\begin{align}
\require{cancel}
\frac{H^R}{RT} &= -T\left[\frac{\partial (G^R/RT)}{\partial T}\right]_p
\quad \text{(use Eq. 7)} \\
\frac{H^R}{RT} &= -T\left[\frac{\partial (Bp/RT + C)}{\partial T}\right]_p \quad \text{(constant goes away, great!!!)} \\
\frac{H^R}{RT} &= -T\left[\frac{\partial (Bp/RT)}{\partial T}\right]_p \\
\frac{H^R}{RT} &= -\frac{pT}{R}
\left[\frac{\mathrm{d} (B/T)}{\mathrm{d} T}\right] \\
\frac{H^R}{\cancel{RT}} &= -\frac{pT}{\cancel{R}}
\left(\frac{1}{\cancel{T}}\frac{dB}{dT} - \frac{B}{T^\cancel{2}}\right) \\
H^R &= -pT\left(\frac{dB}{dT} - \frac{B}{T}\right) \rightarrow
\boxed{H^R(p,T) = p\left(B - T\frac{dB}{dT} \right) = p(B-TB')} \tag{8}
\end{align}
We need one more step. By definition of the residual specific heat capacity at constant pressure
\begin{align}
C_\mathrm{p}^R &= \left(\frac{\partial H^R}{\partial T}\right)_p \quad
\text{(use Eq. 8)} \\
C_\mathrm{p}^R &= \left\{\frac{\partial [p(B-TB')]}{\partial T}\right\}_p \\
C_\mathrm{p}^R &= p\left[\frac{\mathrm{d}(B-TB')}{\mathrm{d}T}\right] \\
C_\mathrm{p}^R &= p (\cancel{B'} - \cancel{B'} - TB'') \rightarrow
\boxed{C_\mathrm{p}^R(p,T) = -pT\frac{\mathrm{d}^2B}{\mathrm{d}T^2}} \tag{9}
\end{align}
Eq. (9) ends our journey. Observations:
- If the gas is ideal, $B=0$ and the residual heat capacity at constant pressure is zero, so we are happy.
- The residual heat capacity at constant pressure is a linear function of the pressure.
- Higher the pressure, higher the deviations from the ideal gas heat capacity. This makes sense, however, we need to make sure that $Z = 1 + Bp/RT$ is still a good representation of the non-ideal gas at high pressures (probably not).
- When $B$ changes from concave up to concave down, the heat capacity behaves as an ideal gas. If you watch Eq. (7), when $B=0$ the residual Gibbs energy is zero. This is something really funny that happens to thermodynamic functions: the gas is not ideal, because we have an EoS, but the properties sometimes behave as ideal for special circumstances.
- We can make measurements of a gas at low pressures, where the gas approximates by the ideal-gas behaviour. For other pressure, we can apply Eq. (9) to calculate the real heat capacity
$$ C_\mathrm{p}(p,T) = C_\mathrm{p}^\mathrm{ig}(T) -
pT\frac{\mathrm{d}^2B}{\mathrm{d}T^2} \tag{10} $$
the results will be as good as you can estimate numerically the second derivative of $B$ at a certain $T$, a difficult task...