Should be plenty. I had RoonServer, HQPlayer, and 8gb dedicated to a zfs pool on an M1 Max Studio with 32gb of ram. With zfs pool not in play with you setup you should be good with 24gb.
I would personally get the M4 Max Studio as it has more ram bandwidth. I had a post here about it.
Also mentioned in that post, I’d also separate hqplayer and RoonServer. I haven’t completed my experiments for science as I haven’t found the thunderbolt ethernet adapter I have buried somewhere.