Cancelling out known signal with sampling offset I would like to cancel out a known audio signal at my receiver.

Specifically at my transmitter I am playing a song, and at my receiver I am recording it. Both transmit and receive sampling rate is 44.1kHz.

At the receiver I basically want to null out the song so that the only thing that is left is the ambient noise in the room.

When I lined up the received and transmitted signal, I noticed that there is sampling offset so I cannot simply subtract out the transmitted signal.

Are there tools in Matlab that are designed for this task?
And what are the general principles I can use to solve this?
What you are describing is basically an acoustic echo cancellator, as used in e.g. any car with a «hands free» phone solution. Use the (known) dry song track as a reference, and use a stochastic gradient search algorithm (eg NLMS) to online identify the FIR filter which relate your recorded signal to the known reference. As long as the channel (room acoustics) remains relatively stationary (LTI) and the ambient noise is uncorrelated to the reverberated music, you should be able to adopt standard methods to your application.