Anything is possible. Depending on the game, the difficulty would range from extraordinarily difficult, to very easy (if you have the skills/experience and the target program is hospitable).
2 major factors to consider:
CPU time - does the game have enough idle time that you can take over? This varies during gameplay, and you have to fit inside the very worst case scenario (and your music program has it's own worst case timings to consider). Still fits in the "possible" category because, in theory, one could rewrite and optimize the game. This would be ridiculous though (unless one greatly enjoys RE'ing software). If there's not enough CPU time, better to just walk away. Or add your own CPU to the cartridge..
Memory - where in memory will the music data and variables sit? This actually may be kind of easy to overcome, as long there is a board with larger ROM/RAM you could migrate it to.
If the game's source code was available that would be helpful to refer to, but overall it's of limited use. Assembling 30+ year old source code, or more likely converting it to a modern assembler, may be a bit of a project in itself. But I've never tried to assemble any of the old Atari source code, so I could be wrong. It's amazing that any of the source codes are even available at all. I wouldn't assume that they are the final versions, until you can assemble and do a binary compare.
Edited by Memblers, Wed May 16, 2018 11:11 PM.