Solved

Recording wav; formatting

Posted on 1998-12-16
7
414 Views
Last Modified: 2012-05-04
How can I change formatting for recording of a wave file.
For example sample rate, number of bits, etc.

I am using mciSendString function, and I can record wave file, but only with 11.025 kHz, 8-bit mono.

Thanks.
0
Comment
Question by:idjurek
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 4

Expert Comment

by:Chizl
ID: 1450507
I have never tried recording my own Wav file, but would be interested in the code you have so far.
0
 
LVL 2

Expert Comment

by:trillo
ID: 1450508
I could put here a whole bunch of code without knowing what you exactly want, so I'll please ask you to answer these questions.
1) I asume you're using high level API functions ("mciSendString").. Am I right?
2) Do you already know how to record?
3) Do you want to change the parameters before recording some sound?
It'll be a pleasure answering your questions if you answer mine.

Trillo
0
 

Author Comment

by:idjurek
ID: 1450509
Edited text of question
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:idjurek
ID: 1450510
I am using mciSendString function from API WinMM.dll, but only can record with 11.025 kHz and 8-bit mono. I would like to change it for example, to 44.1 kHz and 16-bit stereo.
0
 
LVL 2

Accepted Solution

by:
trillo earned 50 total points
ID: 1450511
Here it is... You shoul use the mciSendString function with the "set" keyword... look a t the following example.

-------------Begin of code-----------------
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 Long

Private Sub Command1_Click()
Me.Print mciSendString("open new type waveaudio alias myaudio", 0, 0, 0)
Me.Print mciSendString("set myaudio channels 2 samplespersec 44100", 0, 0, 0)
Me.Print mciSendString("record myaudio", 0, 0, 0)
End Sub

Private Sub Command2_Click()
Me.Print mciSendString("stop myaudio", 0, 0, 0)
End Sub

Private Sub Command3_Click()
Me.Print mciSendString("save myaudio d:\text2.wav", 0, 0, 0)
Me.Print mciSendString("close myaudio", 0, 0, 0)
End Sub

--------------end of code-------------------
YOu can see the usage in the click event for command1. You can use the following parameters for waveaudio recording:
    alignment integer
    any input
    any output
    audio all off
    audio all on
    audio left off
    audio left on
    audio right off
    audio right on
    bitspersample bit_count
    bytespersec byte_rate
    channels channel_count
    door closed
    door open
    format tag pcm
    format tag tag
    input integer
    output integer
    samplespersec integer
    time format bytes
    time format milliseconds
    time format samples

Trillo.
0
 

Expert Comment

by:squeaksvolvo
ID: 13025551
What is the "input integer" setting? See my question at http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21270770.html if you can help.
0
 
LVL 4

Expert Comment

by:Chizl
ID: 13027813
WOW..  7 years later, I still get an email for this question.. lol
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

860 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