Solved

Recording wav; formatting

Posted on 1998-12-16
7
403 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 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

18 Experts available now in Live!

Get 1:1 Help Now