Solved

Recording wav; formatting

Posted on 1998-12-16
7
407 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

785 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