This project has moved. For the latest updates, please go here.

how to get latency after applying effects to Buffered Wave Provider

Jan 24, 2011 at 1:09 PM

I am trying to synchronize visual content with an MP3 that has pitch shifting applied to it.

I need to know how much latency the effect processing is adding so I can offset the position of the visual content.

I also need 1/60 second resolution for the "Actual Play Position (mp3 position - latency)".

How do I need to configure the DirectSound settings to get the chunks processed in smaller than 1/60 second intervals and get the latency factored in?

Basically I need, "what you are hearing now is at xxxxx milliseconds in the source MP3 file".

Great library by the way.

Jan 25, 2011 at 9:16 PM

Hi,

I wrote a class named AdvancedBufferedWaveProvider, since I had a similar problem/question.

[Just some credits: it is based on code from trentdevers (http://naudio.codeplex.com/Thread/View.aspx?ThreadId=54133)]

There is an event there: PlayPositionChanged, which has a property on the Event Argument named: PlayTime

It should give you what you're looking for. Just subscribe to the event and you get the current playing time.

http://code.google.com/p/practicesharp/source/browse/trunk/PracticeSharpApp/Core/AdvancedBufferedWaveProvider.cs

 

To check out the whole project:

http://code.google.com/p/practicesharp/source/checkout

 

Hope this helps,

Yuval

Author of Practice#