"When you're a musician, you hear melodies everywhere. I thought, whoever's playing this is really talented."
Kin Rich was walking through Birmingham city centre when he heard the flute being played.
He stopped and spoke to the homeless man, Nathan, who was playing and decided to record the melody.
But when he sampled it and produced a song, he didn't expect it to go viral.
"I approached him, we started talking and he told me he loves music," Kin told Radio 1 Newsbeat.
"He said it's his life - he doesn't have anything else. He doesn't have anywhere to stay, but he has music."
At the time Kin gave Nathan the only money he had in his pocket - a five pound note - but he didn't leave.
He stayed and recorded the tune Nathan was playing on the flute using his phone.
"I told him I wanted to work with him. The flute is my favourite instrument to put with my beats."
After getting the recording, Kin went home and added a beat and a hook, and posted a snippet of the song on Instagram.
"I woke up the next day to so many likes and views on my post, it was crazy."
Kin returned to the city centre and played the song to Nathan.
"He called me a genius - I was calling him a genius too!
"He told me he liked how I rearranged it all, he loves it."
Kin is determined to make his song a success, and is filming a music video to go with it, involving Nathan and his flute.
"I told him on the day I met him; 'If this blows up, if I make any money from it, I promise I've got you bro. I'll treat you.'
"I love that I got to showcase his talent and mine.
"We're definitely going to keep in touch. I love him, we're always laughing together. I can see me and him performing live."