You need so called
volume pedal for that.
I have it, but I must say, that I'm not using it as much as I thought I would. The thing is, to use it meaningful, is not as easy as one might think. What I mean by "meaningful"? Please, listen to
this video and pay attention to organ playing -to sound like that, it requires a LOT of practicing.
Volume pedal can be used for any voice (instrument), but in my opinion, it will only sound "natural" for organ and some woodwind instruments. The volume/loudness of other instruments is better controlled (sounds more natural) with keyboard touch sensitivity: the harder we hit the key, the louder it is.
Of course, depending on setting on keyboard, with volume/expression pedal we can also control many other effects (not only volume).
I'm telling you all that, because volume/expression pedal is quite expensive and so you get an impression of what to expect.
Bogdan