In the Aligned Continuity, it was revealed that
when Megatron first began spreading his revolutionary ideas across Cybertron for a just and equal society, Soundwave was chief among his followers, being by his side from the very beginning since before the war for Cybertron even began.
Starscream, however, was an Air Commander who joined the Decepticons only after the war began. During the war, he has already demonstrated a traitorous tendency towards Megatron. According to some literature, he has even alternated between staying neutral or even apparently working in favour of the Autobots at some point.
Clearly, Megatron has had a much longer history with Soundwave than Starscream, and his relationship with Soundwave appears to be quite personal too compared to a purely soldier-to-commander relationship with Starscream - Megatron often speaks of his personal thoughts and plans before Soundwave when they are alone, a demonstration of their special relationship at a level Starscream never enjoyed to the same degree.
As officers of the Decepticons, Soundwave has proven to be immeasurably more loyal to Megatron and reliable on missions than Starscream - two of the top qualities that Megatron values most in a Decepticon, as their one true lord and master. In leadership and skill in strategy and tactics, Soundwave does not appear to be inferior to Starscream either. Even if that is not the case, he definitely makes up for it with the lack of cowardice and tendency to panic that Starscream so often exhibits.
However I look at it, from my interpretation of Megatron's perspective Soundwave just seems more eligible as second-in-command of the Decepticons than Starscream in practically every way I can think of. The only possible reason I could find for why Starscream is made second-in-command is the fact that
Starscream captured Sentinel Prime and delivered him to Megatron instead of escorting him to safety with the Autobots, as an offering when he sought to join the Decepticons.
This act by Starscream impressed Megatron, but surely Megatron would feel that all that has transpired since then would not be worth whatever benefit or advantage he gained from Starscream? So why exactly is Starscream kept around as second-in-command, and Soundwave was apparently never considered for the post?