Hi everyone.
I recently did a little experiment of trying to inject
librubberband into sfml. For those of you that don't know, this library is for time stretching/pitch shifting, and what I wanted to achieve was true pitch shifting, ie. not just 2x faster playback at 2.0 pitch. What I was able to do so far (not much lol) is on this
github fork ("rubberband" branch). Basically, you can load up a sf::Music, set the pitch, and play it back.
What doesn't work:
- Changing pitch safely during playback
- (Probably) seeking
Also, there's a weird sound fragment coming up when a looping track rewinds to start.. don't really know yet where that's coming from. The quality is.. well, not too good, but we get this much without doing any previous preprocessing-pass (pitch is shifted on the fly). I could try and add a pre-pass, but that would delay playback by a couple seconds, which is not nice. Also, I will need to try out some other fine-tuning parameters for rubberband.
So, is there anybody else out there who ever trying getting correct pitch-shifting working on sfml? Or is there possibly a far easier way I just overlooked all the time?
I think I really do want this feature (for myself), so I might work a bit more on it later (also for sf::Sound). I'm not really sure what to do next because I have absolutely no experience in digital audio. =P
Edit:
Oh yeah, actually I was hoping that sfmidi would work with my changes out of the box, but somehow it doesn't seem to work at all. The way I understand it, sfmidi preloads the entire audio data into RAM, and then just feeds that into the stream.. is this wrong? I can't seem to figure out what's wrong..
By the way, because I absolutely suck at build systems (qmake is the only one I barely manage to use), I didn't integrate librubberband via cmake or anything, so when you link against the SFML libraries built from my tree, make sure to add "-lrubberband" to the linker flags.