How to capture (record) microphone input

Welcome Forums General PowerShell Q&A How to capture (record) microphone input

Viewing 1 reply thread
  • Author
    Posts
    • #70709
      Del
      Participant
      Topics: 22
      Replies: 19
      Points: 0
      Rank: Member

      I'm working on a script, to go and unmute the speaks on a local or remote computer, send a message using [Speech] Class
      I'll show you the code below. But I was wondering if it's possible to use PowerShell to capture a (Record) Microphone input ??

      # Set Speaker function
      Function Set-Speaker($Volume) {
      $wshShell = new-object -com wscript.shell;1..50 | % {$wshShell.SendKeys([char]174)};1..$Volume | %{$wshShell.SendKeys([char]175)}}
      Set-Speaker -Volume 50
      #
      Invoke-Command -ComputerName $PC -scriptblock {

      Add-Type -AssemblyName System.speech
      $talker = New-Object System.Speech.Synthesis.SpeechSynthesizer
      $talker.speak("Hi there .. Your your password expires today. Please change your password now")
      }

    • #70735
      Keymaster
      Topics: 13
      Replies: 4872
      Points: 1,870
      Helping HandTeam Member
      Rank: Community Hero

      So, because I know there's no PowerShell command for this, I searched ".NET record microphone". You might try that – there are some good examples. You're going to need to translate from C# or VB, because you're basically going to be coding .NET.

      FWIW, I also searched ".net set volume" and got some good results, which might give you something more reliable than that SendKeys approach you're using. That's almost 20 years old and isn't going to be reliable across a lot of different systems.

      • #70805
        Del
        Participant
        Topics: 22
        Replies: 19
        Points: 0
        Rank: Member

        You're correct. I tried to invoke the SendKeys didn't work on all of the AD machines.
        Instead I used "InteropServices"; interface "IAudioEndpointVolume" and It works 🙂

        As for Mic. I found some good C# examples ..

Viewing 1 reply thread
  • The topic ‘How to capture (record) microphone input’ is closed to new replies.