Re: Herfried K. Wagner - HELP!



Thanks for excellent Example. Where did you find the command string
components, i.e., a tutorial or documentation on command strings. I am
trying to convert MP3 files into wav files but have hit brick walls unless I
learn C.
--
Dennis in Houston


"Herfried K. Wagner [MVP]" wrote:

"jer" <gerald.king@xxxxxxxxx> schrieb:
I've noticed you've helped a lot of people that were trying to do sound
recording through VB.net. I'm searched all over the internet, and I'm
still having problems write sound to a wav file.

Please do not address posts to a specific person here. Each thread/question
can/should by answered by all readers.

... So my quesiton... Do you have a similar post or sample application
for vb2005 that will write a wave file from the sound card?

That's not that complicated using good old MCI:

\\\
Private Declare Auto Function mciSendString Lib "winmm.dll" ( _
ByVal lpszCommand As String, _
ByVal lpszReturnString As String, _
ByVal cchReturn As Int32, _
ByVal hwndCallback As IntPtr _
) As MCIERROR

Public Enum MCIERROR
MCIERR_BASE = 256

MCIERR_INVALID_DEVICE_ID = MCIERR_BASE + 1
MCIERR_UNRECOGNIZED_KEYWORD = MCIERR_BASE + 3
MCIERR_UNRECOGNIZED_COMMAND = MCIERR_BASE + 5
MCIERR_HARDWARE = MCIERR_BASE + 6
MCIERR_INVALID_DEVICE_NAME = MCIERR_BASE + 7
MCIERR_OUT_OF_MEMORY = MCIERR_BASE + 8
MCIERR_DEVICE_OPEN = MCIERR_BASE + 9
MCIERR_CANNOT_LOAD_DRIVER = MCIERR_BASE + 10
MCIERR_MISSING_COMMAND_STRING = MCIERR_BASE + 11
MCIERR_PARAM_OVERFLOW = MCIERR_BASE + 12
MCIERR_MISSING_STRING_ARGUMENT = MCIERR_BASE + 13
MCIERR_BAD_INTEGER = MCIERR_BASE + 14
MCIERR_PARSER_INTERNAL = MCIERR_BASE + 15
MCIERR_DRIVER_INTERNAL = MCIERR_BASE + 16
MCIERR_MISSING_PARAMETER = MCIERR_BASE + 17
MCIERR_UNSUPPORTED_FUNCTION = MCIERR_BASE + 18
MCIERR_FILE_NOT_FOUND = MCIERR_BASE + 19
MCIERR_DEVICE_NOT_READY = MCIERR_BASE + 20
MCIERR_INTERNAL = MCIERR_BASE + 21
MCIERR_DRIVER = MCIERR_BASE + 22
MCIERR_CANNOT_USE_ALL = MCIERR_BASE + 23
MCIERR_MULTIPLE = MCIERR_BASE + 24
MCIERR_EXTENSION_NOT_FOUND = MCIERR_BASE + 25
MCIERR_OUTOFRANGE = MCIERR_BASE + 26
MCIERR_FLAGS_NOT_COMPATIBLE = MCIERR_BASE + 28
MCIERR_FILE_NOT_SAVED = MCIERR_BASE + 30
MCIERR_DEVICE_TYPE_REQUIRED = MCIERR_BASE + 31
MCIERR_DEVICE_LOCKED = MCIERR_BASE + 32
MCIERR_DUPLICATE_ALIAS = MCIERR_BASE + 33
MCIERR_BAD_CONSTANT = MCIERR_BASE + 34
MCIERR_MUST_USE_SHAREABLE = MCIERR_BASE + 35
MCIERR_MISSING_DEVICE_NAME = MCIERR_BASE + 36
MCIERR_BAD_TIME_FORMAT = MCIERR_BASE + 37
MCIERR_NO_CLOSING_QUOTE = MCIERR_BASE + 38
MCIERR_DUPLICATE_FLAGS = MCIERR_BASE + 39
MCIERR_INVALID_FILE = MCIERR_BASE + 40
MCIERR_NULL_PARAMETER_BLOCK = MCIERR_BASE + 41
MCIERR_UNNAMED_RESOURCE = MCIERR_BASE + 42
MCIERR_NEW_REQUIRES_ALIAS = MCIERR_BASE + 43
MCIERR_NOTIFY_ON_AUTO_OPEN = MCIERR_BASE + 44
MCIERR_NO_ELEMENT_ALLOWED = MCIERR_BASE + 45
MCIERR_NONAPPLICABLE_FUNCTION = MCIERR_BASE + 46
MCIERR_ILLEGAL_FOR_AUTO_OPEN = MCIERR_BASE + 47
MCIERR_FILENAME_REQUIRED = MCIERR_BASE + 48
MCIERR_EXTRA_CHARACTERS = MCIERR_BASE + 49
MCIERR_DEVICE_NOT_INSTALLED = MCIERR_BASE + 50
MCIERR_GET_CD = MCIERR_BASE + 51
MCIERR_SET_CD = MCIERR_BASE + 52
MCIERR_SET_DRIVE = MCIERR_BASE + 53
MCIERR_DEVICE_LENGTH = MCIERR_BASE + 54
MCIERR_DEVICE_ORD_LENGTH = MCIERR_BASE + 55
MCIERR_NO_INTEGER = MCIERR_BASE + 56

MCIERR_WAVE_OUTPUTSINUSE = MCIERR_BASE + 64
MCIERR_WAVE_SETOUTPUTINUSE = MCIERR_BASE + 65
MCIERR_WAVE_INPUTSINUSE = MCIERR_BASE + 66
MCIERR_WAVE_SETINPUTINUSE = MCIERR_BASE + 67
MCIERR_WAVE_OUTPUTUNSPECIFIED = MCIERR_BASE + 68
MCIERR_WAVE_INPUTUNSPECIFIED = MCIERR_BASE + 69
MCIERR_WAVE_OUTPUTSUNSUITABLE = MCIERR_BASE + 70
MCIERR_WAVE_SETOUTPUTUNSUITABLE = MCIERR_BASE + 71
MCIERR_WAVE_INPUTSUNSUITABLE = MCIERR_BASE + 72
MCIERR_WAVE_SETINPUTUNSUITABLE = MCIERR_BASE + 73

MCIERR_SEQ_DIV_INCOMPATIBLE = MCIERR_BASE + 80
MCIERR_SEQ_PORT_INUSE = MCIERR_BASE + 81
MCIERR_SEQ_PORT_NONEXISTENT = MCIERR_BASE + 82
MCIERR_SEQ_PORT_MAPNODEVICE = MCIERR_BASE + 83
MCIERR_SEQ_PORT_MISCERROR = MCIERR_BASE + 84
MCIERR_SEQ_TIMER = MCIERR_BASE + 85
MCIERR_SEQ_PORTUNSPECIFIED = MCIERR_BASE + 86
MCIERR_SEQ_NOMIDIPRESENT = MCIERR_BASE + 87

MCIERR_NO_WINDOW = MCIERR_BASE + 90
MCIERR_CREATEWINDOW = MCIERR_BASE + 91
MCIERR_FILE_READ = MCIERR_BASE + 92
MCIERR_FILE_WRITE = MCIERR_BASE + 93

MCIERR_NO_IDENTITY = MCIERR_BASE + 94

' all custom device driver errors must be >= than this value
MCIERR_CUSTOM_DRIVER_BASE = MCIERR_BASE + 256
End Enum

Private Function mciSimpleSendString(ByVal Command As String) As MCIERROR
Return mciSendString(Command, Nothing, 0, IntPtr.Zero)
End Function

Private Sub StartRecording()
mciSimpleSendString("close all")
mciSimpleSendString("open new type waveaudio alias capture")

' Set capturing options here.
'mciSimpleSendString("set capture bitspersample 16")
'mciSimpleSendString("set capture samplespersec 44100")
'mciSimpleSendString("set capture channels 2")
mciSimpleSendString("record capture")
End Sub

Private Sub StopRecording()
mciSimpleSendString("save capture C:\sample.wav")
mciSimpleSendString("close capture")
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


.



Relevant Pages

  • Re: Regex Capture problem
    ... "learned" my regex using a freeware utility that had slightly different ... was trying to capture instead of. ... I have used Regex utilities before, so I understand the concepts of text ... Function RESub(str As String, SrchFor As String, ReplWith As String) As String ...
    (microsoft.public.excel.programming)
  • Re: SQL - Capture Specific Text and Copy to New Column/row
    ... The script is: ... Please advise of how I may capture only the date/time data. ... wildcard characters as characters in the string. ... by the Option Compare setting of the module. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Regular Expression Hangs
    ... You wouldn't need a regular expression to ... a single fixed string. ... Those patterns are defined by rules that are expressed in the ... will capture the following: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: how to get all repeated group with regular expression
    ... string, such as string '123456', i tried re.findall*, ... nature to all regx engine or only to Python? ... issues that I can perfectly understand why Python works the way it does, ... Yes, you are right, but this way findallcapture only the 'top' group. ...
    (comp.lang.python)
  • Re: how to get a wav file track length
    ... String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long ... Dim sBuffer As String ... Dim sFileName As String ... used to separate parameters in the MCI command string. ...
    (microsoft.public.vb.general.discussion)