Seamlessly looping sample with a variable rate, using Pulp audio with sdk library

Hi,
I have a game with a train that plays a sound effect when it is running. The effect changes rate depending on the trains speed. Currently, I'm getting a strange dull pause inbetween looping when played at a lower rate. Is there a way to make this more seamless?

	import "CoreLibs/crank"
	
	soundEffect=playdate.sound.sampleplayer.new("audio0")
	soundEffect:play(0)
	function playdate.update()
		soundEffect:setRate(playdate.getCrankPosition()/360)
	end

The other question was if there was a way to use Pulp audio directly with the sdk, instead of the pulp-audio library. Would prefer to export out with .wav or other formats that the sdk can use so can take advantage of it's greater functionality.

audio0.wav.zip (20.7 KB)

example.zip (21.2 KB)

It might be related to this thread:

Matt suggests using fileplayer instead.

Hmm, that seems to removes the dull beep noise, but it doesn't sound seamless. There's also a bit of grainess instead when it starts to loop.

I'd file this as a bug, given you have files to reproduce it.

My feeling is that when changing pitch the playback buffer is somehow not taken into account.