Playing Back A .wav On One Buffer And MIDI Input On Another?


My system I’m trying to do this on is a Pi 4 32 with latest version of Raspbian Bullseye/latest version of Sonic Pi, using a USB MIDI keyboard—can furnish more details if needed:

I was able to set up code to be able to play and record a .wav file of me playing some notes on my USB MIDI keyboard—not but can provide if needed the brand and model of keyboard except to say the only I/O it has is USB.

I was also able to make code to play back the .wav file I’d made of myself playing the notes on the keyboard as a sample in one buffer.

Here’s where I’m looking for help: when playing the .wav as a sample in one buffer, then going to another buffer to get the MIDI keyboard loop going, the .wav file plays but I get no response when trying to play the keyboard over it. I make sure to click the Play button for the block with the MIDI stuff in it but every time, the .wav plays back fine but the MIDI input loop makes no response.

What I’m trying to do is play back the .wav file of me playing notes on the keyboard and be able to basically accompany that .wav file with me playing new notes with the keyboard and record that—a kind of duet I guess :slight_smile:

Is this something that can even be done with Sonic Pi by putting a bit of code or changing the settings in the application (or even in the sound settings of Raspbian itself) to allow the .wav output to play and for MIDI input and pass-through to the speakers happen simultaneously or am I coming across a limitation to my resources and should maybe consider Audacity or another software or hardware approach here?

Thank you:)