# How to play a Wav on sustain pedal up/down?

**URL:** <https://forum.juce.com/t/how-to-play-a-wav-on-sustain-pedal-up-down/47737>\
**Category:** Audio Plugins\
**Created:** [September 9, 2021, 7:22am UTC](https://forum.juce.com/t/how-to-play-a-wav-on-sustain-pedal-up-down/47737 "2021-09-09T07:22:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![organic-instruments](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/organic-instruments/32/20789_2.png) [@organic-instruments](https://forum.juce.com/u/organic-instruments)\
**Post date:** [September 9, 2021, 7:22am UTC](https://forum.juce.com/t/how-to-play-a-wav-on-sustain-pedal-up-down/47737/1 "2021-09-09T07:22:19Z")

</div>

Hi everyone,

I’m working on a JUCE Plugin, which is just an Instrument VST of a Grand Piano that I’ve sampled.  
I’d like to be able to include samples (wav files mapped with a Memory Mapped Audio Format Reader) that play on Pedal Up/Down MIDI messages (to replicate the sound of the pedal mechanism), and MIDI Note key releases, but can’t work out how to do this.

For some context, this is the thread I’ve used to program the standard notes across the keyboard already: [https://forum.juce.com/t/how-to-add-multiple-samplersounds-for-a-single-note-and-discriminate-by-velocity/16796](https://forum.juce.com/t/how-to-add-multiple-samplersounds-for-a-single-note-and-discriminate-by-velocity/16796)

To add these Pedal and Key release sounds, is it something that I need to further extend from the above topic on overriding other methods, or perhaps some sort of logic in the processBlock, e.g. if(midimessage.isSustainPedalOff()…

Any help would be appreciated for the best way I can implement this functionality.
