A
A
Alek_dr2016-04-12 23:28:45
.NET
Alek_dr, 2016-04-12 23:28:45

c# audio playback issues. How to get rid of extraneous sound?

Tried to play mp3 in c# in the following ways:
1) Using WindowsMedia:
Uri p = new Uri(path.ToString());
_mediaPlayer.Open(p);
_mediaPlayer.Play();
2) Using NAudio
WaveStream mainOutputStream = new Mp3FileReader(path.ToString());
WaveChannel32 volumeStream = new WaveChannel32(mainOutputStream);
WaveOutEvent player = new WaveOutEvent();
player.Init(volumeStream);
player.Play();
Both methods work, but the problem is this - when Play is called in both cases, a clattering sound is heard before playback (as if the speakers were plugged into the laptop).
If it matters:
OS Windows 10

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alek_dr, 2016-04-16
@Alek_dr

the problem was solved, it was necessary to call player.Dispose ()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question