An experience sampling method (ESM) study on 40 volunteers was conducted to explore the environmental factors and psychological conditions related to involuntary musical imagery (INMI) in everyday life. Participants reported 6 times per day for one week on their INMI experiences, relevant contextual information and associated environmental conditions. The resulting data was modeled with Bayesian networks and led to insights into the interplay of factors related to INMI experiences. The activity that a person is engaged was found to play an important role in the experience of mind wandering, which in turn enables the experience of INMI. INMI occurrence is independent of the time of the day while the INMI trigger affects the subjective evaluation of the INMI experience. The results are compared to findings from earlier studies based on retrospective surveys and questionnaires and highlight the advantage of ESM techniques in research on spontaneous experiences like INMI.