In the mouth of two or three witnesses let every matter be established, says the scripture,
Deuteronomy 19:15, Matthew 18:16 and 2 Corinthians 13:1. And here, three witnesses attest to a voice being heard from heaven.
These three are Matthew, especially chosen by Jesus Christ personally to be a witness of all that occurred during the ministry of Jesus Christ ; and Mark, who is approved by both Peter, the chief apostle and by Paul the most prominent ; and Luke who also is approved of Paul in his writing and accompanied him in his missionary journeys.
Matthew, the apostle of Jesus Christ says of the event :
He tells his reader to behold what he is about to recount. And then he recounts the facts.
Nowhere do these three witnesses mention 'them that stood by'. I am assuming that those words are remembered, by the OP, from the matter of a voice being heard by 'them that stood by' when Saul of Tarsus heard a voice speaking to him. Those 'that stood by' (on that occasion) only were aware of a voice speaking. It seems that only Saul, later called Paul, was cognizant of the content of the speech.
Thus the documented record does not draw attention to 'those that stood by' on this particular occasion, nor do we have any information about what they did, or did not, apprehend.
The record is there for us to 'behold' ... certain things.
We - we, ourselves - are to behold : that a voice was heard and what the voice said.
This is my beloved Son, in whom I am well pleased.
Our attention is not to be on the crowd, on those that stood by. We are not even told what John heard. In the gospel account of the apostle John, John 1:28-34, we are told that John the Baptist testifies to the descent of the Holy Spirit upon Jesus and he declares, himself, that this is the Son of God. But whether, or not, John heard, or did not hear, the voice from heaven, is not - specifically - mentioned.
The revelation that Jesus of Nazareth is the Son of God is a personal revelation. One either sees it and testifies to it (as did John the Baptist) or one is unaware of it, by personal revelation, only able to repeat it from books or other people's words.
We are to behold that a voice spoke, we are to behold what the voice said.
We are to behold the One of whom it spoke.
I agree with @Dottard , in his comment :
We are not told who heard the voice from heaven.
We are to hear it for ourselves.