Solved

Recording wav; formatting

Posted on 1998-12-16
7
398 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now