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 means that Alberto heard the music of the party and then left his house. The second sentence means that Alberto was already hearing the music of the party when he left his house. In other words, the first sentence implies that Alberto left his house because he heard the music, whereas the second sentence simply establishes a sequence of events.

The difference in meaning between these two sentences lies in the verb tense used.

In the first sentence, "Alberto oyó la música de la fiesta y salió de casa," the verb "oyó" is in the preterite tense, which indicates a completed action in the past. This means that Alberto heard the music first, and then he left the house. The emphasis is on the sequence of events, with the action of hearing the music happening before the action of leaving the house.

In the second sentence, "Alberto oía la música de la fiesta cuando salió de casa," the verb "oía" is in the imperfect tense, which indicates an ongoing or continuous action in the past. This means that Alberto was already hearing the music when he decided to leave the house. The emphasis is on the concurrent actions of hearing the music and leaving the house.

In summary, the first sentence emphasizes the sequence of events, while the second sentence emphasizes the concurrent actions.