Solved

MMControl  ( for  recording from microphone)

Posted on 2000-02-17
6
818 Views
Last Modified: 2013-12-26
Hello,
I want to record at run time.
I use the MMControl, but I have some difficulties.
I want to be able to record my voice and then save it in wave file. I want that every time I record - it will be saved to a different file. ( I tried, but all the records were saved continuously to the same file ).
( I have the same problem for playing the files ).

Thanks...
0
Comment
Question by:chen_meir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 14

Expert Comment

by:mcrider
ID: 2533874
You have to stop the recording, save the wav file, close the MCI control, and then set the new path to the next wav file and open the MCI device again.

Also dont forget to set the record mode:

    MMControl1.RecordMode = mciRecordOverwrite


Cheers!
0
 

Author Comment

by:chen_meir
ID: 2535813
Adjusted points to 90
0
 

Author Comment

by:chen_meir
ID: 2535814
dear mcrider ...
i did what you said.
i created a button for record ("rec"), a button to stop the record
("sto") and a button to play ("play").
i did some recording but it didnt work.
if it worked ,it was only some times and after that it did whatever it wanted. ( i noticed that some of the files after i closed the project i could not manage delete them (i got the message "access denaied").

here is my code:

'start the play
Private Sub play_Click()

MMControl1.Notify = True
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"

str = "C:\My Documents\" & i & ".wav"
MMControl1.FileName = str
MMControl1.Command = "open"
MMControl1.Command = "play"
MMControl1.Command = "prev"
End Sub



'start the record
Private Sub rec_Click()

MMControl1.Command = "prev"
MMControl1.RecordMode = mciRecordOverwrite
str = "C:\My Documents\" & i & ".wav"
MMControl1.FileName = str
voiceRec(number).voicePath = str
MMControl1.Command = "open"
MMControl1.Command = "record"

End Sub



'stop the record
Private Sub sto_Click()
MMControl1.Command = "stop"
MMControl1.Command = "save"
MMControl1.Command = "close"
End Sub

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Accepted Solution

by:
mcrider earned 90 total points
ID: 2535931
Try this:

In a new project, add a MMControl, a TextBox and 3 Command Buttons... Then paste the following code into the DECLARATIONS Section of FORM1:

Private Sub Command1_Click()
    MMControl1.Notify = False
    MMControl1.Wait = False
    MMControl1.Shareable = False
    MMControl1.DeviceType = "WaveAudio"
    MMControl1.filename = Text1.Text
    MMControl1.To = 10000
    MMControl1.Command = "Open"
    MMControl1.RecordMode = mciRecordOverwrite
    MMControl1.Command = "Record"
End Sub
Private Sub Command2_Click()
    MMControl1.Command = "Save"
    MMControl1.Command = "Close"
End Sub
Private Sub Command3_Click()
    MMControl1.Notify = False
    MMControl1.Wait = False
    MMControl1.Shareable = False
    MMControl1.DeviceType = "WaveAudio"
    MMControl1.filename = Text1.Text
    MMControl1.Command = "Open"
    MMControl1.Command = "Play"
    Do
        If MMControl1.Mode <> mciModePlay Then Exit Do
        DoEvents
    Loop
    MMControl1.Command = "Stop"
    MMControl1.Command = "Close"
End Sub
Private Sub Form_Load()
    Text1.Text = ""
    Command1.Caption = "Record"
    Command2.Caption = "Stop Rec"
    Command3.Caption = "Play"
End Sub




Run the program and type the name of a WAV file (including the .WAV extension) and press the "Record" command button... Talk into your microphone and then hit the "Stop Rec" command button. Then Hit the "Play" command button... You should hear your voice.

Do it again with another file....


Cheers!
0
 

Author Comment

by:chen_meir
ID: 2537427
Dear mcrider!!!!

thank you very very much!!!!
I appreciaite it very much!!

Chen.
 
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2537726
You're welcome! thanks for the points... Glad I could help!


Cheers!
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question