We consider planar hairy black holes in five dimensions with a real scalar field in the Breitenlohner-Freedman window and show that is possible to derive a universal formula for the holographic speed of sound for any mixed boundary conditions of the scalar field. As an example, we locally construct the most general class of planar black holes coupled to a single scalar field in the consistent truncation of type IIB supergravity that preserves the $SO(3)times SO(3)$ R-symmetry group of the gauge theory. We obtain the speed of sound for different values of the vacuum expectation value of a single trace operator when a double trace deformation is induced in the dual gauge theory. In this particular family of solutions, we find that the speed of sound exceeds the conformal value. Finally, we generalize the formula of the speed of sound to arbitrary dimensional scalar-metric theories whose parameters lie within the Breitenlohner-Freedman window.