OC703 is the type of rigid fiberglass insulation you are looking for.
OC = "Owens Corning", an insulation manufacturer.
Building supply places, Home Depot, that sort of place will carry it.
It's not outrageously expensive, but if you are just now at the point of realizing you need some sort of "foam", I would do some reading here and learn some more about acoustic treatment and recording before spending any hard earned cash.
my two cents.
Read about bass traps, acoustic absorption, room modes, if you are concerned with sound in your room.
Read about Transmission Loss, soundproofing, and mass, if you are concerned about keeping noise inside/out of your recording space.
cheers
C.