开发者

How to save DynamicSoundEffectInstance or SoundEffectInstance to a File or an Array?

开发者 https://www.devze.com 2023-04-02 09:57 出处:网络
I have a Windows Phone Silverlight Application. I do this to slow down the voice and change the pitch from microphone stream:

I have a Windows Phone Silverlight Application. I do this to slow down the voice and change the pitch from microphone stream:

sound = new SoundEffect(bStream, microphone.SampleRate, AudioChannels.Mono);
SoundEffectInstance soundInstance = sound.CreateInstance();
soundInstance.Pitch -= 1;
soundInstance.Play();

here "bStream" is a byte array. The problem is I cannot save the data with the changed pitch (although I can play it). Is there a way to save my byte array after the pitch has been changed ? I tried DynamicSoundEffectInstance as w开发者_高级运维ell with same result. When I save bStream as a wav file, all the effects are gone.

Thanks for your help and insight.


Do you really need to save it with the pitch adjusted? Why not just save the pitch adjustment amount with the file and re-apply it again (just like you are doing already) after you load the file up.

If you really do need to adjust the pitch of the data, you'll essentially be resampling it. This involves interpolating and/or averaging the values to stretch or compress them in time. I believe NAudio contains C# code for doing this: http://naudio.codeplex.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消