Results 1 to 4 of 4

Thread: Check If three is no voice input in the mic _Visual Basic 2010

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2021
    Location
    Kepler-452b
    Posts
    37

    Lightbulb Check If three is no voice input in the mic _Visual Basic 2010

    HI

    Hope you are doing well.

    I have been working on voice recording programme.

    It works and plays the sound as a recorder but I want to know how to check if there is a voice input coming on or not. I mean how to check if the user is still saying something or the user have no more to say. so that I can hit "enter " key for another procedure to run.


    Below is my code

    Code:
    Public Class Form1
    
        Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, _
    
                                                                                       ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, _
    
                                                                                       ByVal hwndCallback As Integer) As Integer
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            ' record from microphone
    
            mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
    
            mciSendString("record recsound", "", 0, 0)
    
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
            ' stop  and save
    
            mciSendString("save recsound c:\record.wav", "", 0, 0)
    
            mciSendString("close recsound", "", 0, 0)
    
        End Sub
    
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    
            ' play audio
    
            My.Computer.Audio.Play("c:\record.wav", AudioPlayMode.Background)
    
        End Sub
    
    End Class


    please help me in it
    < / L R. . . . >

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    Re: Check If three is no voice input in the mic _Visual Basic 2010

    If you would suggest that you need to get the volume from the system then it seems a little hard.
    I have created a mixer control here that will get the mixer button but I don't think I check for the sound volume.
    I get if you can get the sound control and check for the sound volume coming in (not the set get volume of the control itself but the sound coming in volume) maybe you can get something out.
    https://www.vbforums.com/showthread....-mixer-control

    Maybe there is an easier way with newer .net framework because this was written in 2010-2012, or maybe this is the only way.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2021
    Location
    Kepler-452b
    Posts
    37

    Re: Check If three is no voice input in the mic _Visual Basic 2010

    Quote Originally Posted by sapator View Post
    If you would suggest that you need to get the volume from the system then it seems a little hard.
    I have created a mixer control here that will get the mixer button but I don't think I check for the sound volume.
    I get if you can get the sound control and check for the sound volume coming in (not the set get volume of the control itself but the sound coming in volume) maybe you can get something out.
    https://www.vbforums.com/showthread....-mixer-control

    Maybe there is an easier way with newer .net framework because this was written in 2010-2012, or maybe this is the only way.
    okay , I will look into that - as per your suggestion I am thinking is there a way I can use the speech. recognoizer and then check from this class to when the sound is not comming -can you help me in that -so below is my code

    Code:
    imports speech
    imports speech.recognitionEngine
    
    
    'lets say code goes somthing like
    
    
    dim user_voice as speech.recognizer
    
    user_voice.recognizeAsync(mode.mltiple)
    
    'the code which would need help in would something where it can check for no input
    < / L R. . . . >

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,605

    Re: Check If three is no voice input in the mic _Visual Basic 2010

    I haven't used speech namespace ever, sorry.
    I haven't used it but how about using DirectX ? Maybe the Buffer.Volume Property?

    https://docs.microsoft.com/en-us/pre...80955(v=vs.85)
    Last edited by sapator; Apr 15th, 2021 at 01:21 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width