# How to play sample with notes?

**URL:** <https://in-thread.sonic-pi.net/t/how-to-play-sample-with-notes/2487>\
**Category:** Community\
**Created:** [June 15, 2019, 10:47am UTC](https://in-thread.sonic-pi.net/t/how-to-play-sample-with-notes/2487 "2019-06-15T10:47:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ethancrawford](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@ethancrawford](https://in-thread.sonic-pi.net/u/ethancrawford)\
**Post date:** [June 18, 2019, 3:52am UTC](https://in-thread.sonic-pi.net/t/how-to-play-sample-with-notes/2487/5 "2019-06-18T03:52:40Z")

</div>

Yes, you can use `pitch:` or `rpitch:` when calling `sample` in your own function so that you can pass the function a note, and it works out the right pitch for the sample to play at. (The other topic I linked above - [Tune samples with a note input](http://in-thread.sonic-pi.net/t/tune-samples-with-a-note-input/1703) shows an example: Robin’s `:plAmbiChoir` function there takes a note to play at, a note _length_, and a number representing the ratio between the note’s sustain and release values, for a basic sound envelope, and plays the sample at the correct pitch). I’m sure you could use a similar function with your own samples - you’d just need to work out the basic pitch of your un-modified sample, as Robin describes in his thread.  
Feel free to have a go at adapting Robin’s example if you like - I’m happy to help you if you want.

---

_[View the full topic](https://in-thread.sonic-pi.net/t/how-to-play-sample-with-notes/2487)._
