   Please advice : Unable to record sound with this VB recording program
  Hi Sir,How are you ?I am writing a online radio recording program that will record any sound output from my PC.  I found this Visual basic recording program somewhere, after some debugging, it is bug free now.  However, it cannot record any sound.  When i play the recsound.wav file that it has created by pressing "start" button, it do not emit any sound. Would you please help me in writing this program ?  Thank you.Following is the source code :-)Public Class Form1    Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstyCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer    Dim Button1_Enabled As Boolean    Dim Button2_Enabled As Boolean    Dim Button3_Enabled As Boolean    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load    End Sub    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   Button1_Enabled = True   Button2_Enabled = True   Button3_Enabled = True   mciSendString("Open new type waveaudio alias recsound", "", 0, 0)   mciSendString("Record recsound", "", 0, 0)   Label1.Text = "Recording"   Label1.Visible = True    End Sub    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click   Button1.Enabled = True   Button2.Enabled = True   Button3.Enabled = True   mciSendString("Save recsound c:\recsound.wav", "", 0, 0)   mciSendString("Close recsound", "", 0, 0)   MsgBox("File Created:C:/recsound.wav", MsgBoxstyle.OkOnly, "Success")   Label1.Text = "Stopped"   Label1.Visible = True    End Sub    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click   Button1_Enabled = True   Button2_Enabled = True   Button3_Enabled = True   Label1.Text = "Playing"   Label1.Visible = True   My.Computer.Audio.Play("c:\recsound.wav", AudioPlayMode.Background)    End SubEnd Class Thank you.Best Regards,KF   
  If you load the file in Windows Media player, do you get any sound then? Is the file of some length and not just 0?You should also check the return value from mciSendString, which would be 0 if no errors occur.Another thing you should verify is if you actually have a microphone selected in the control panel for the sound card. Either bring it up by double clicking the speaker icon next to the clock or just click Start -> Run and then "sndvol32".Then select Properties under the Options menu. Select "Recording" under the "Adjust volume for" group box. Click Ok. Make sure that the proper input is selected by clicking the checkbox underneath it.   ;  Dear Tunah,Thank you for your help.After perform the adjustment according to you, I try to use microphone to record some sound just now and playback the file.  It works and can record sound. Thank you.  It can record sound from microphone only.However, my objective of writing this program is to record audio from speakers only, online radio or movies. Anything that come out from the sound card, not the microphone.  Would you please help and guide me to modified this program so that it can perform the following functions ?Honestly, I copy this program somewhere with just a minor modification done myself.  Therefore, I have very less knowledge in MCI functions, include mciSendString command.  I have read many articles in the internet about mciSendString, but cannot totally understand how it works.  Would you please explain and provide some info in this area ?  Woudl you please explain the format and argument in the mciSendString function? Thank you very much, Tunah.I have read quite a lot of article about it but still unable to capture the critical mechanism of how it really works.  :-)Thank you :-)Best Regards,KF ;  If you look at the inputs that are available alongside the microphone, you may find an input named "What U Hear" (pardon the retarded spelling, but that's what they call it.) If that inputs is available, you can record everything that's currently playing.I don't know how to capture the final mixed audio without one of those, unfortunately. I haven't used the MCI API so I can't help you with figuring it out, sorry.Edit: I googled for "what u hear" and found this. The input can be called "Stereo Mix" on some cards. Have a look at this.[Edited by - Tunah on April 15, 2010 3:18:42 AM];  Hi Tunah,Thank you for your advice.  I have done the adjustment accordingly.  It is working now after i select speaker from the recording sound and set it default. It records any sound from speaker. Thank you.However, the selection will automatically switch to microphone or deselect speaker after 25 minutes of recording. the recorded file is silent after 23 minutes of sound-play although it is still running its' record until a few hours. Would you please help me on this ?  Thank you Tunah :-)Best Regards,KF   ;  Hi Tunah,Thank you for assist me and guide me through all the difficuties in my project.  I have not receive you reply for quite some time.  You must be very busy :-)  Tell you a good news of me,  i have find out the root cause of automatic deselection in the recording device occured after sometime testing.  This failure is caused by my Skype IM audio setting. After I reconfigure it, this failure will not happen again.  Anyway, thank you for you help along the way :-)Thank you.Best Regards,KF