Mice can hear frequencies between 1,000 and 100,000 Hz. By comparison, humans can hear frequencies between 20 and 20,000 Hz. Noctuid moth has a hearing range between 1,000 and 240,000 Hz. Pigeon can detect sounds as low as 0.1 Hz. Rat has hearing range between 1,000 and 90,000 Hz.
Snakes have no external ears.
Instead, they are probably responding to the movements of the snake charmer and the flute. However, sound waves may travel through bones in their heads to the middle ear. There is no sound in outer space.