Ardour is a very powerful free digital audio workstation. To quote from the project website, the features include:
...and more besides!
In addition to all this, version 3.0 (currently being developed) will include full MIDI support.
To help you get started with what is quite a complex piece of software, there's this online manual and tutorial.
Although it's free software, to download directly from the project website includes an optional payment to support development, with OS X users getting a demo version if they opt to not pay. The Linux version doesn't come with any restrictions, and in any case it's included in the repositories of popular Linux distributions.