iReal Pro records you playing along with the backing track and mixes the two into a single audio file. It works on iPhone, iPad, Android, and Mac. The Windows app does not record.
 
Open the song, tap or click Share at the top right, then Record. On Mac you can also press Ctrl-R. In the Record window, watch the Input Level meter as you play, set the Input Volume, and choose AAC for a small file or WAV for full quality. On Mac, pick the microphone under Audio Input. Press Start Recording, then stop the player to end the take and save or share it.
 
Wear wired headphones. Through a speaker the microphone records the band a second time, and Bluetooth delay lands your playing behind the beat.
 
For the full guide, see Record yourself on the iReal Pro website.