A lot of piano / keyboard learners, especially people who are self taught wonder how to use the sustain pedal. I myself actually had to self teach myself.
What does the sustain pedal do?
Basically, the sustain pedal will also you to maintain the sound of a note once a key has been depressed. This is required in order to remove any gaps between chord or note transitions. For example Moving from a C major to an F major can be quite a distance, so you would play a C major, press the sustain pedal before releasing C major and then release the sustain pedal immediately before playing the F major chord. That way there will be no gap between the chords. The timing is important, try not to overlap by releasing the sustain pedal too late. Releasing too early to leave a gap.
The difference in the Piano and Electric Piano sustain pedal
The usage of the sustain pedal for the piano is slightly different to an Electric Piano / Rhodes type keyboard. The piano has three pedals however I will only going into the right “sustain” pedal for the moment.
The piano naturally has a decay on release, meaning the sound continues for a short time upon release. This actually makes it easier for the sustain pedal timing. You do not have a be perfectly on time with the release to make a smooth chord transition. However when changing keys / scales it is still important not to overlap.
For the Electric Piano / Rhodes, upon key release the sound cuts of. There is almost zero release unless you have some reverb setting. Due to this, the timing of the sustain piano is extremely important and needs practice if you have never used one. Also note that for Electric keyboard, the sustain is general ON or OFF, even if the pedal looks analogue like the below picture.
For the digital type. You will need to release the pedal at the exact moment you play the next chord and then press again so you can you the same for the following chord.
You will definitely need to release the sustain pedal if you are playing melodies, often with your right hand. If not, the notes will overlap. Press the sustain pedal again to hold the current chord and release at the same time you hit the new chord. It takes some practice.
If you are playing a lot of melodies and improvisations, then you may want to limit the sustain pedal usage. Your general chord transition skills will improve anyway. Playing in a band, the gaps between the chords may not be noticeable too much. However if you are recording a keys track on your DAW, the sustain pedal will be important to smooth things out.
Sustain MIDI data
Something I often do is record Audio and MIDI together. The reason why is because I can edit the MIDI data and then send it back to the Piano / keys track. I often edit the Sustain MIDI data and make adjustments, rather than re-playing a track. Once complete I send it back to the audio track and record automatically. The below example is from Ableton Live