You are on the phone, walking down a street. This daily situation calls for selective attention, allowing you to ignore surrounding irrelevant sounds, while trying to encode in memory the relevant information from the phone. Attention and memory are indeed two cognitive functions that are interacting constantly. However, their interaction is not yet well characterized during sound-sequence encoding. We independently manipulated both selective attention and working memory in a delayed-matching-to-sample of two tone-series, played successively in one ear. During the first melody presentation (memory encoding), weakly or highly distracting melodies were played in the other ear. Detection of the difference between the two comparison melodies could be easy or difficult, requiring low- or high-precision encoding, i.e., low or high memory load. Sixteen non-musician and 16 musician participants performed this new task. As expected, both groups of participants were less accurate in the difficult memory task and in difficult-to-ignore distractor conditions. Importantly, an interaction between memory-task difficulty and distractor difficulty was found in both groups. Non-musicians presented less difference between easy and difficult-to-ignore distractors in the difficult than in the easy memory task. On the contrary, musicians, with better performance than non-musicians, showed a greater difference between easy and difficult-to-ignore distractors in the difficult than in the easy memory task. In a second experiment including trials without a distractor, we could show that these effects are in line with the cognitive load theory. Taken together, these results speak for shared cognitive resources between working memory and attention during sound-sequence encoding.