Get it in writing.

Musicians tend to want to keep things low-key and informal. It's understandable.  Having a conversation about business terms when you're in the midst of a writing or recording a song may tend to put a damper on the creative vibe.  You may have known the person you're writing or recording with for years and probably think that because of your relationship with that person, the two of you will always be able to come to an agreement later, if something good happens with a song.  However, once a song is created, released and starts to gain momentum, people's attitudes can quickly change.  The deal you thought you had with that person regarding the song may not turn out to be the deal that person is now demanding.  If you want to protect your music and your relationships with those who work on your music, discuss the deal before things get to far down the road and put the terms in writing.  That way, no one can argue about what you all have agreed to, which protects your music and your friendships.