Is it pure speculation or can they tell from studying fossils?
Well, it was shown in the Jurassic Park that from the bone structure of the dinosaurs, they could determine what sounds they could produce (veloci-raptors). This was because the size of the nasal cavity can be determined and the type of noise that it could make can be “speculated”. Probably, scientists are able to compare the nasal cavity structure of the dinosaur fossils or bones with existing animals of that size and extrapolate.