playing sound stored as a project resource


  • My project contains a number of Audio resources that were created from .wav files. I want to play those sounds in the application. I found code samples as follows:

    SoundPlayer s = new SoundPlayer(@"mypath.mysoundfile.wav");;

    However I would rather use the Audio resources that are stored as resources. The IDE shows variables representing these resources such as


    How can I play this Audio resource?


    Saturday, April 8, 2017 5:26 PM


  • Hi friend,

    You could try this code:

    using System.Media;
    Stream str = Properties.Resources.YourWaveSoundFile;
    SoundPlayer player = new SoundPlayer(str);

    Hope it helps.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, April 10, 2017 2:34 AM

All replies