How

How's it done ?

If you're serious about your music and want to have a go at composing and publishing music on your PC then you need to buy a digital audio workstation (DAW).
This is a piece of software that enables you to record and playback music on your PC.
I currently use one from a company called Magix, which I downloaded as a free trial version for 30 days before buying. There are many others on the market.
Google 'daw' or 'home studio' and/or visit wikipedia for more information.

You will need a good quality soundcard and speakers and, if you intend to record from a microphone/instrument lead (such as guitar) directly to your PC you will also need a digital audio interface.
Or you can load previously recorded sound onto your PC in the normal way (via CD, memory stick etc).

DAWs differ in their capabilities, but mine can accept and mix audio recordings and also create midi music via the virtual instruments packaged with the software. Additional virtual instruments can be purchased from a variety of suppliers and should be suitable for whichever DAW you've got.

The DAW is a recording studio on your PC.
Here's a picture of one of my projects.
Each blue row is a track (drums, bass,clarinet etc.), and each blue cell within that track is a musical bar (or number of bars). In this example, all the music is composed on virtual instruments, with the sound being generated by the computer software.
Each cell can be edited, either in musical notation, or piano-roll format as seen here.
The length of each blue bar is the length of the note, starting and ending as indicated, and it's position against the piano roll is the note that is played. The height of the vertical blue lines at the bottom indicate the loudness of the individual notes.
Notes can be drawn onto the screen and changed/altered/deleted as required.
If you have a midi keyboard you should be able to plug it in and record what you're playing instead of drawing it in.

DIfferent instruments can be chosen for each track (as seen in image 1) and tracks can be panned left or right and put through various effect such as reverb.

Finally you mix down your recording with the built in mixer.
If you're familiar with physical mixing devices then this layout will easy to follow.
Mix, pan, and add track and/or overall effects.
Save the music to your PC in .wav or .mp3 format (depending on your DAWs capabilities).
Now you can listen to it on your PC, burn it to CD or DVD or upload it onto the internet.

That's a brief summary. To learn more you should search the internet.

The above project is a swingjazza tune called "Just a moonlight walk", arranged and recorded using only virtual instruments by the method described above.