Mac Miller performing in New York in 2016.
Photograph: Sipa USA/Rex/Shutterstock

Although he has died aged only 26, of a reported drug overdose, the American rapper and music producer Mac Miller had already created a body of work that looks set to endure long after him.

Last month, his fifth studio album, Swimming, debuted at No 3 on the Billboard charts, making it his fifth consecutive US Top 10 album. Critics hailed the disc’s confident production and languid musicality, and the deftness with which Miller was able to confront his personal history of substance abuse in his lyrics, at the same time managing to impart a laconic sense of optimism.

However, his problems were deep-seated. Even on his first full-length album, the chart-topping Blue Slide Park (2011), Miller was delivering unnerving bulletins about his mental state. “I ain’t normal, I’m clinically insane / I guess it’s the result of drugs that enter in my brain,” he sang in Of the Soul, while the punkish Up All Night was a riotous account of non-stop drinking and party-going (“Yea, I got a reputation of gettin’ wasted,” he observed).

Miller was born Malcolm McCormick in Pittsburgh, the son of Mark McCormick, an architect, and his wife Karen Myers, a photographer. His mother was Jewish: he was brought up in that tradition and dubbed himself “the coolest Jewish rapper”. He attended Winchester Thurston school and Taylor Allderdice high school, and was committed to making music from an early age. He started piano lessons at the age of six, and later learned to play drums, bass and keyboards. “Once I hit 15, I got real serious about it and it changed my life completely,” he recalled. He cited the Beastie Boys, Lauryn Hill and A Tribe Called Quest as inspirations, and was close friends with the Pittsburgh rapper Wiz Khalifa.

His mixtape Best Day Ever (2011) included the single Donald Trump, which reached 75 on the Billboard Hot 100 and was downloaded over 1m times, while its video has had many millions of plays on YouTube. Trump himself praised the rapper as “the new Eminem” and said he was “very proud of him”, though later about-turned and demanded royalties for the use of his name. During the 2016 presidential election campaign, Miller expressed his contempt for the Republican candidate.

Blue Slide Park kicked off Miller’s barrage of Billboard album chartbusters. Watching Movies With the Sound Off (2013) reached No 3, GO:OD AM (2015) went to 4, The Divine Feminine (2016) peaked at 2 and Swimming was also his first album to breach the UK Top 50. Each release marked advances in Miller’s songwriting and production skills, advancing from the so-called “frat-rap” territory of Blue Slide Park into more considered and allusive pieces incorporating varied jazz, psychedelic and hip-hop influences.

Many listeners assumed that The Divine Feminine, which Miller said was about “the feminine energy of the planet”, was about his relationship with Grande and that Swimming was inspired by their break-up, but Miller rejected any such simplistic prescriptions. “I’ve not talked about what songs mean, what’s this or what’s that,” he told Vulture magazine in a profile published last week. “I’ve just kind of left it up to interpretation.”