none
Listen for emitting sound of a process. RRS feed

  • Question

  • My lay of the land is I want to consolewriteline("sound heard") if any sound is made from the process by the name of "Spotify"

    Thank you.

    My pseudo code representation:

    ...

    private bool soundheard()
    {
     if (audioemits)
     {
     return true;
     }
    
     return false;
    }

    if(process.name("spotify")&&soundheard){

    Console.Writeline("heard sound")}

    else

    {

    keepwaitingforsoundhandler

    }...

    Is there a library I should be aware about? and how could I go about implementing this?

    • Edited by HisKingdom Thursday, June 20, 2019 3:57 AM
    Thursday, June 20, 2019 3:53 AM

All replies

  • Hi HisKingdom,

    Thank for posting here.

    Based on your description, you want to monitor the process that made the sound and name is "Spotify".

    You could try the code in the following link to get list of audio processes.

    https://stackoverflow.com/questions/52030208/c-sharp-get-list-of-audio-processes

    If you want to get the process by name, you could try the following code.

    List<Process> list = new List<Process>();
                foreach (var item in list)
                {
                    if(item.ProcessName == "Spotify")
                    {
                        Console.WriteLine("sound heard");
                    }
                }

    Best Regards,

    Jack


    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 MSDNFSF@microsoft.com.

    Thursday, June 20, 2019 7:41 AM
    Moderator
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,
    Jack


    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 MSDNFSF@microsoft.com.

    Friday, June 28, 2019 2:15 AM
    Moderator