Explain the difference in meaning between these two sentences: Alberto oyó la música de la fiesta y salió de casa. Alberto oía la música de la fiesta cuando salió de casa.

The first sentence "Alberto oyó la música de la fiesta y salió de casa" means that Alberto heard the music of the party and then immediately left the house. The use of the preterite tense "oyó" indicates a completed action.

The second sentence "Alberto oía la música de la fiesta cuando salió de casa" means that Alberto was hearing the music of the party at the moment when he left the house. The use of the imperfect tense "oía" indicates an ongoing or continuous action in the past.