What you want to look for is a Digital Audio Workstation (DAW) software package.
A not-free option is Reaper which is is free fully functional trial that does not lock you out after the trial period. The license is $60. I have used this before and it works very well.
An open source option is Ardour. I have not used this. It looks like they have free source code, but to download a ready-to use binary there is a minimum charge, possibly a dollar.
Both of the above work on Linux, mac or windows, and there are many more options.
In a DAW you add a midi (or audio) track, and then attach a drum/instrument to it. You can edit the midi or you can record you manipulating a drum machine midi surface etc.
I have used Reaper for guitar and I have a midi expression pedal. I record the dry guitar signal only and use VST programs attached to the track to simulate an amplifier, and I attach a midi "envelope" to the audio track to record in real time my midi expression pedal for wah.
There are tons of free VST programs that you can attach to tracks for audio manipulation. If you have guitars, you can check out ( http://www.simulanalog.org/guitarsuite.htm ) which has free guitar amplifier and pedal simulators for us in a "VST Host" (a DAW is also a VST Host application).
That's a lot to take in, but start reading about and watching videos about using a DAW for electronic music and pay careful attention to the vocabulary they use to help you track down more resources.
It is better to do software searches for "open source" rather than "free," and then look carefully at the installers to ensure you aren't installing extra "advertising software" (aka foistware).
As @Chris mentioned, Audacity is a good choice for single audio file editing, and you will want to use that as part of your toolkit, but a DAW is audio file compositing.