none
Audio Recorder - To record Skype conversion RRS feed

  • Question

  • Dear Friends,

    I want to learn how to create a program to record the Skype conversion (Audio only); I prefer to have this program to start recording (without manually start the Recorder) whenever the Skype starts.  

    I've never done any programming on Audio file...

    Can you please guide me on this?

    Kind regards

    Thanks

    VKSBK


    A Real Novice Programmer !


    • Edited by V.K.S.B.K Sunday, November 12, 2017 12:24 PM
    Sunday, November 12, 2017 11:35 AM

Answers

  • This will record whats playing on the speaker. You will have to figure how to start it.

    Option Strict On
    'records media player playing mp3 etc
    'must set realtek stereo mix as default in control panel sound recording 
    Imports System.Runtime.InteropServices
    Imports System.Text
    
    ' http://msdn.microsoft.com/en-us/library/windows/desktop/dd798661%28v=vs.85%29.aspx how to set commands
    'https://social.msdn.microsoft.com/Forums/vstudio/en-US/3f771824-56b8-4ebf-b941-7afe40a52895/record-audio?forum=vbgeneral
    
    Public Class SoundRecorder1
    
        Private sb As New StringBuilder
    
        <DllImport("winmm.dll", EntryPoint:="mciSendStringW")> _
        Private Shared Function mciSendStringW(<MarshalAs(UnmanagedType.LPWStr)> ByVal lpstrCommand As String, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpstrReturnString As StringBuilder, ByVal uReturnLength As Integer, ByVal hwndCallback As IntPtr) As Integer
        End Function
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Text = "Sound recorder via output"
            Button2.Enabled = False
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            mciSendStringW("stop capture", sb, 0, IntPtr.Zero)
            Using sfd As New SaveFileDialog
                sfd.FileName = "Untitled"
                sfd.DefaultExt = "wav"
                sfd.AddExtension = True
    
                If sfd.ShowDialog = DialogResult.OK Then
                    Button2.Enabled = False
                    Dim saveas As String = Chr(34) & sfd.FileName & Chr(34)
                    mciSendStringW("save capture " & saveas, Nothing, 0, IntPtr.Zero)
                End If
            End Using
            mciSendStringW("close capture", sb, 0, IntPtr.Zero)
            Button2.Enabled = False
            Button1.Enabled = True
        End Sub
    
        Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
            Button2.Enabled = True
            Button1.Enabled = False
            mciSendStringW("open new Type waveaudio Alias capture", sb, 0, IntPtr.Zero)
            mciSendStringW("set capture time format ms bitspersample 16 channels 2 samplespersec 48000 bytespersec 192000 alignment 4", Nothing, 0, IntPtr.Zero)
            mciSendStringW("record capture", Nothing, 0, IntPtr.Zero)
        End Sub
    End Class


    • Edited by tommytwotrain Sunday, November 12, 2017 12:12 PM
    • Marked as answer by V.K.S.B.K Sunday, November 12, 2017 6:41 PM
    Sunday, November 12, 2017 12:08 PM

All replies

  • This will record whats playing on the speaker. You will have to figure how to start it.

    Option Strict On
    'records media player playing mp3 etc
    'must set realtek stereo mix as default in control panel sound recording 
    Imports System.Runtime.InteropServices
    Imports System.Text
    
    ' http://msdn.microsoft.com/en-us/library/windows/desktop/dd798661%28v=vs.85%29.aspx how to set commands
    'https://social.msdn.microsoft.com/Forums/vstudio/en-US/3f771824-56b8-4ebf-b941-7afe40a52895/record-audio?forum=vbgeneral
    
    Public Class SoundRecorder1
    
        Private sb As New StringBuilder
    
        <DllImport("winmm.dll", EntryPoint:="mciSendStringW")> _
        Private Shared Function mciSendStringW(<MarshalAs(UnmanagedType.LPWStr)> ByVal lpstrCommand As String, <MarshalAs(UnmanagedType.LPWStr)> ByVal lpstrReturnString As StringBuilder, ByVal uReturnLength As Integer, ByVal hwndCallback As IntPtr) As Integer
        End Function
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Text = "Sound recorder via output"
            Button2.Enabled = False
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            mciSendStringW("stop capture", sb, 0, IntPtr.Zero)
            Using sfd As New SaveFileDialog
                sfd.FileName = "Untitled"
                sfd.DefaultExt = "wav"
                sfd.AddExtension = True
    
                If sfd.ShowDialog = DialogResult.OK Then
                    Button2.Enabled = False
                    Dim saveas As String = Chr(34) & sfd.FileName & Chr(34)
                    mciSendStringW("save capture " & saveas, Nothing, 0, IntPtr.Zero)
                End If
            End Using
            mciSendStringW("close capture", sb, 0, IntPtr.Zero)
            Button2.Enabled = False
            Button1.Enabled = True
        End Sub
    
        Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
            Button2.Enabled = True
            Button1.Enabled = False
            mciSendStringW("open new Type waveaudio Alias capture", sb, 0, IntPtr.Zero)
            mciSendStringW("set capture time format ms bitspersample 16 channels 2 samplespersec 48000 bytespersec 192000 alignment 4", Nothing, 0, IntPtr.Zero)
            mciSendStringW("record capture", Nothing, 0, IntPtr.Zero)
        End Sub
    End Class


    • Edited by tommytwotrain Sunday, November 12, 2017 12:12 PM
    • Marked as answer by V.K.S.B.K Sunday, November 12, 2017 6:41 PM
    Sunday, November 12, 2017 12:08 PM
  • Hi tommytwotrain,

    Thanks for the help.  Will this record the microphone also while recording the output from the Speaker, ie: my part and the person who I am speaking to on Skype (Capture the microphone & the Speaker)?

    Thanks

    Regards

    VKSBK


    A Real Novice Programmer !

    Sunday, November 12, 2017 12:20 PM
  • Hi tommytwotrain,

    Thanks for the help.  Will this record the microphone also while recording the output from the Speaker, ie: my part and the person who I am speaking to on Skype (Capture the microphone & the Speaker)?

    Thanks

    Regards

    VKSBK


    A Real Novice Programmer !

    I think it records whats playing on the speaker line out. If you hear it playing on the speaker it will record it I think but I don't really know. Why dont you try it and let us know.

    Or maybe someone else knows?

    Sunday, November 12, 2017 12:28 PM
  • Dear tommytwotrain,

    I tried this on Skype and found it is working - record the entire conversion - both side. Thank you very much.

    Any guidance for starting this tiny program to start whenever Skype starts? This would be highly appreciated...

    Thanks

    Kind regards

    VKSBK.


    A Real Novice Programmer !

    Sunday, November 12, 2017 12:34 PM