View Full Version : Play samples at different pitches by MIDI

03-18-2016, 04:56 PM

Today I've mounted the audio board on the Teensy 3.2 that I have received.
After having tried some skecth examples everything seems to be working fine.

Now my project is to build a small MIDI sampler, let's say a MIDI instrument that plays/records samples.
So from the example sketch I know I can play samples at their origin speed (or pitch), now I would like to go further and trigger samples by playing notes by MIDI on my master keyboard.
And of course I would like to be able to play a sample on different notes (at different speeds). The AudioPlaySdWav object has a "play" method, is there a way to change the pitch ?
Let's say by assigning a root note (for the origin speed), for example C3 and then change the pitch according to the MIDI note received.

It would be great to be able to loop a sample too :)

Noob question : what is controlling the optional pot ? I've soldered one but it doesn't adjust the volume level on the minijack output (level which is set in the sketch, that could explain)

Thanks and regards

03-18-2016, 07:43 PM
For pitched playback, check out the thread where they were discussing granular playback. It's not exactly an easy problem to solve.


The pot is tied to A1. Your sketch can read it, and apply it to whatever parameter you wish. For a volume control on the Audio Adapter, do an analogRead(A1), then translate the result to a float and feed it to the sgtl5000.volume() method.