Prince Albert, Duke of York, the second son of King George V, stammers through his speech closing the British Empire Exhibition at Wembley Stadium. The Duke has given up hope of a cure, but his wife Elizabeth persuades him to see Lionel Logue, an Australian speech therapist living in London. During their first private session, Logue insists on being called Lionel by his patient. In addition, breaching royal etiquette, Logue calls the Prince "Bertie", a name used only by his family. When the Duke decides Logue's treatment is unsuitable, Logue bets him that he can recite Hamlet's "To be, or not to be" soliloquy without trouble and distracts him by playing music through headphones while recording his performance on an acetate record. Prince Albert leaves in anger but Logue offers him the recording as a keepsake.
After King George V makes his 1934 Christmas radio address, he explains to his son the importance of broadcasting to a modern monarchy and demands that Albert train himself, starting with a reading of his father's speech. His attempt to do so is a failure. Later, the Duke plays Logue's recording and hears himself reciting unhesitatingly. He therefore returns to Logue, where he and his wife both insist that Logue focus only on physical exercises, not therapy. Logue teaches his patient muscle relaxation and breath control but continues to probe gently and persistently at the psychological roots of the stutter. Albert eventually reveals some of the pressures of his childhood and the two men start to become friends.
With George Vâs death in 1936, his eldest son David ascends the throne as King Edward VIII, but causes a constitutional crisis with his determination to marry Wallis Simpson, an American socialite divorcĂŠe who is still legally married to her second husband. It is pointed out that Edward, as head of the Church of England, cannot marry her, even if she receives her second divorce, because both her previous husbands are alive.
At his next session, Albert expresses his frustration that while his speech has improved when talking to most people, he still stammers when talking to his own brother and reveals the extent of Edward VIII's folly with Simpson. When Logue insists that Albert could be a good king instead, the latter labels such a suggestion as treason and dismisses Logue. When King Edward decides to abdicate in order to marry Simpson, Albert reluctantly succeeds him as King George VI. The new king and queen visit Logue to make up the quarrel, startling Mrs. Logue, who was unaware that the new King had been her husband's patient.
During preparations for his coronation in Westminster Abbey, George learns that Logue has no formal qualifications. When confronted, Logue explains how he was asked to help shell-shocked Australian soldiers returning from The Great War. Since George remains unconvinced of his own fitness for the throne, Logue sits in King Edward's Chair and dismisses the underlying Stone of Scone as a trifle. Goaded by Logue's seeming disrespect, the King surprises himself with his own sudden burst of outraged eloquence and allows Logue to rehearse him for the ceremony.
Upon Britain's declaration of war with Nazi Germany in 1939, King George summons Logue to Buckingham Palace to prepare for his upcoming radio address to Britain and the Empire. Knowing the challenge that lies before him, the Archbishop of Canterbury, Winston Churchill and Prime Minister Neville Chamberlain are present to offer support. George and Logue are then left in the broadcasting room. He delivers his speech with Logue conducting him, but by end is speaking freely. Preparing to leave the room for the congratulations of those present in the palace, Logue mentions to the King that he still had difficulty enunciating 'w' and the King jokes back, "I had to throw in a few so they'd know it was me".
After the King and his family step onto the balcony of the palace and are applauded by the crowd, a title card explains that Logue was always present at King George VI's speeches during the war and that they remained friends for the rest of their lives.

Question: How does Logue distract Prince Albert while he's reciting Hamlet's piece?
Answer: by playing music through headphones
Alternative answer: With music through headphones.