We analyze and interpret SOHO/MDI data on oscillation frequency changes between 1996 and 2004 focusing on differences between activity minimum and maximum of solar cycle 23. We study only the behavior of the centroid frequencies, which reflect changes averaged over spherical surfaces. Both the f-mode and p-mode frequencies are correlated with general measures of the sun's magnetic activity. However, the physics behind each of the two correlations is quite different. We show that for the f-modes the dominant cause of the frequency increase is the dynamical effect of the rising magnetic field. The relevant rise must occur in subphotospheric layers reaching to some 0.5 - 0.7 kG at a depth of about 5 Mm. However, the implied constraints also require the field change in the atmosphere to be so small that it has only a tiny dynamical effect on p-mode frequencies. For p-modes, the most plausible explanation of the frequency increase is a less than 2 percent decrease in the radial component of the turbulent velocity in the outer layers. Lower velocity implies a lower efficiency of the convective transport, hence lower temperature, which also contributes to the p-mode frequency increase.