Getting the material of a multi-material mesh

I have a maze made with Probuilder, and different areas have different floor and wall materials on the same mesh. Is there a way to detect what material the player is standing on via raycast to play a different footstep sound?

Thanks