Visit the audacity official website and download the software. Install it on your computer and double click the program execution icon to run it. You will now see a toolbar on top of the program window. In the middle, you will find a drop-down menu. Click on it and configure the audio source of your audio. Depending on the quality of the video file on YouTube, you can select either "Stereo Mix" or "Mono Mix" from the options.
Now visit YouTube website and search for your favourite music file. Click the video file and when it starts playing, pause it. Drag the slider to the left side - towards its start point and pause it. Wait for the video to load completely. When the faded bar which started from the left side reaches the right end, it means that the video has loaded completely and is ready to be played.
Click the “Record” button in your Audacity window. You can easily locate the “Record” button, as it will have a red circle displayed inside it. Right after you click the “Record” button, the audio track waveform will start moving in the editing window. At this point, you will see the waveform completely flat, as there is no sound to record.
Click play button on your YouTube video. You will now see blue coloured waves forming on your Audacity editing window. This means that the audio is being recorded in your computer. When the video ends, you should click the “Stop” button on Audacity. The “Stop” button will have a golden square box in it. Clicking it will stop the recording process.
Now click the "Skip to Start" button in Audacity, which will take you to the start of the audio you just recorded. Click play and listen to the music you just recorded.