I listen to music mostly when working on my own projects. I don't talk much about ongoing projects until I have already progressed very far, and when I do I'm deliberately keeping most of the plans and further ideas out of the conversation - I've realized that it's easy to reward myself too much by talking to someone so that afterwards a lot of motivation is not there anymore. I also try no to listen to suggestions too much since it does create some weird obligations in my mind. And, most of all, I try to not ever fall into the mindset of creating something with a specific goal in mind - I find that it's better to focus on the process itself and not on the final product. This means I often pivot ideas or completely abandon then in favor of something that became more interesting.
Also, if you have that option, working in the same room with friends.