Alumni Brian Pei at his office sitting next to co-workers.

Brian Pei ’13, Math and Economics

October 17, 2022

by Kate Williard

Brian Pei ‘13 gained two key skills from his lifelong love of music — patience and practice. Photo by Kristof Pusztai

When Spotify introduces you to something great, you can thank Brian Pei ’13.

As an analytics engineer, his job is to write the code that propels the technological wizardry of the popular streaming app so that it knows what to offer your ears next.

“My team does analysis for basically all content on the platform, specifically with regard to how it’s performing,” he says. “So if Olivia Rodrigo has a new album that comes out on the same day as a Taylor Swift album, the code I write tells the app which album we should share on somebody's homepage. And it's analysis that's happening while you're interacting with the app so that we can give you things that we think you would like, or to edit playlists algorithmically. It's using data to make the user experience better.”

He speaks passionately about his work, but Pei couldn’t have predicted his career in data. His first love was music.

Growing up in the suburbs of New York City with two musician parents, he studied both his mother’s and his father’s instruments — violin and voice, respectively — and brought his talents along to Bucknell where he was involved with the Bison Chips, chorus and orchestra, and frequented the Seventh Street stage.

But he didn’t major in music. As the only son of first-generation immigrants from China, his parents told him he could only major in music if he paired it with “another versatile major.” Instead, he leaned in the opposite direction, choosing to double-major in math and economics.

His first job — a consulting role — pitched Pei headfirst into coding. “The lead developer quit, so I spent two weekends watching hours of YouTube videos on coding,” he says. In his flood of learning, Pei realized a surprising parallel — he could equate writing code with writing music.

“Writing code tells a story,” he says. “And if you're composing music, it’s the same thing. If I know where the start is, and where the end is, all I have to do is fill in the middle. It was a bunch of random letters and numbers to me at first — not English,” he says. “But music isn’t English either, and learning to view music as its own language gave me confidence to learn programming.”

Pei invested himself in becoming a programmer, and eventually joined co-working company WeWork during its meteoric rise. “As soon as I was on a data team, I noticed that I was surrounded by incredibly smart people, who almost all had different majors,” he says. “The colleagues I learned the most from had studied English, classics or pre-med.”

The move to Spotify — led by WeWork’s famed crash — landed him his dream role: combining his love of music with his penchant for coding.

Now, Pei pays it forward. In partnership with Bucknell’s Center for Career Advancement, he gave a talk to current Bucknell students to inform them of the true breadth of the discipline.

“Whether to Bucknell students or at the high school career fairs I’ve attended, I make sure to cover around 20 data-related job titles, specifically explaining their function and importance.”

He says his desire to share with others is inspired by his parents. “I write code alone in my apartment for about eight hours a day,” he says. “But because my parents are both music teachers, a little bit of teaching and mentoring might be in my blood. Sharing what I’ve learned with students gives me an opportunity to connect with others in a purposeful way.”