In the first Transformers movie we see Frenzy regenerate its entire body in a couple of seconds once it finds the Allspark. Whether Frenzy initiated the repair or it occurred simply by being in the presence of the cube isn't clear. But in either case why didn't the Allspark repair Bumblebee's vocal processor before Bumblebee shrunk the cube?
It is a detail that most likely got overlooked by the production team. But also may be because this led to the rather funny running gag where BumbleBee cannot speak, and talks only through radio snippets. Sadly no in-universe explanation for this.
It does fix his voice box thingy as he talks at the end of the movie if I'm not mistaken, asking optimus permission to stay with the boy
The all spark DID repair bumble bees voice projector (albeit as Transformers 2 stated only temporarily). The problem was only that bee was so used to his "own" method of talking that he just used that instead of trying to talk and thus only did talk at the very end of the 1st film when he had something important on his heart.
Why it was only temporarily repaired though was never stated as far as I know.