Search code examples
c#media-playeraudioduration

How can I play a sound with defined start- and end-time in .Net


In my C# project I want to play a sound with a specified start- and end time.

I used the System.Media.SoundPlayer with the .Play() function. But with this function I can only play the whole sound file or can abort it after I have counted the runtime.

In fact I want to say, that the given sound file should start for example at time 1m:25s:30ms and should end at time 1m:50s:00ms or after a duration of 10s or so.

Does anybody know a simple solution for his problem?

Thanks 4 help.


Solution

  • In the End I use the NAudio library. That can handle this - not in a perfect way but ok. see https://stackoverflow.com/a/13372540/2936206