I usually begin by recreating a melody in my head, by playing around with it on a keyboard. My preferred tool for this is a workstation-class synthesizer because it offers a wide range of nice piano sounds, sequencing, and drums. But I have also used stand-alone digital pianos, acoustic uprights, and grand pianos. It’s all good.