You could use a combination of some of the examples that come with the Bela IDE:
PureData/envelope-trigger/ shows how to generate a trigger from an input signal. Then for playback, you can use Pd's classic [soundfiler] / [tabplay~] or [readsf~] or investigate some of the more complex options available in the Bela examples, e.g.:PureData/accelerometer/playAudioFile~.pd, which provides fade in/fade out and pitch control.