How to change pitch in node of AudioGraph
in UWP app?
I'm trying to port the application from WP7 to uwp (Windows 10, Mobile). in my WP7 app i use code:
SoundEffect soundEffect = //...(load sound effect).
SoundEffectInstance soundInstance = soundEffect.CreateInstance();
soundInstance.Pitch = pitch;
How to do it in UWP with AudioGraph
?
You should share a little more of your code so far, but you want to use the PlaybackSpeedFactor property, which is included on the AudioFileInputNode:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.audio.audiofileinputnode.playbackspeedfactor
Currently, Microsoft's GitHub has the best examples of using AudioGraph: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/AudioCreation/cs/AudioCreation
In the FilePlayback scenario from that last link, all you have to do is add this line to double the pitch of your audio file:
You can make this change in real-time from anywhere in the program (e.g., have a slider that controls playback speed). This won't be a problem at all for AudioGraph. You can probably also play stuff backwards by settings this value negative!