Bubble growth in an ascending parcel of magma is controlled both by diffusion of oversaturated volatiles and decompression as the magma rises. We have developed a numerical model which explores the processes involved in water exsolution from basaltic and rhyolitic melts rising at a constant rate from magma chamber depths of 4 and 1 km. While the model does not attempt to simulate natural eruptions, it sheds light on the processes which control eruptive behavior under various conditions. Ascent rates are defined such that a constant rate of decompression dP/dt is maintained. A variety of initial ascent rates are considered in the model, from 1 m/s to 100 m/s for basalts, and from a few centimeters per second to 10 m/s for rhyolite, at the base of the conduit. The model results indicate that for any reasonable ascent rate, basaltic melt degasses at a rate sufficient to keep the dissolved volatile concentration at equilibrium with the decreasing ambient pressure. Rhyolitic melt reaches the surface at equilibrium if its ascent rate is less than 1 m/s, but it can erupt with high oversaturation at greater ascent rates. The latter may lead to explosive eruptions. If the ascent rate of rhyolite is 10 m/s or more, then melt barely degasses at all in the conduit and erupts with the highest oversaturation possible. For the case of slow magma rise, bubble growth is limited by decompression. For the case of rapid magma rise, bubble growth is limited by diffusion. The results of our simple model do not accurately simulate natural volcanic eruptions, but suggest that subsequent, more complex models may be able to simulate eruptions using the insights regarding diffusive and decompressive bubble growth processes explored in this study. Numerical modeling of volcanic degassing may eventually lead to better prediction of eruption timing, energetics and hazards of active volcanoes.