You should try placing the material where you'd like it for a listen first before making it permanent. Not all rooms would require or benefit from the dampening.

BR, when I think of foam I think of the thick stuff that is used for padding or camping matress. Maybe or maybe not as good as carpet for deadening sound but I'd think it would get the job done. I certainly wouldn't want any in front of my speaker.