This paper presents SonicMaster, the first unified generative model that addresses various audio artifacts through text-based control to address common sound quality issues in music recordings produced without professional equipment or expertise, such as excessive reverberation, distortion, clipping, timbre imbalance, and narrow stereo imaging. SonicMaster applies specific enhancements based on natural language instructions, or operates in an automatic mode for general restoration. To train this model, the authors built the SonicMaster dataset, a large-scale dataset of degraded and high-quality tracks, by simulating common degradation types using 19 degradation functions belonging to five enhancement groups: equalization, dynamics, reverb, amplitude, and stereo. This approach utilizes a flow-matching generative training paradigm to learn audio transformations from degraded input to a cleaned and mastered version, guided by text prompts.