-
I am trying to crate a .wav file through code.
I tried the "open" statment but it didn't craete the .wav file with the initial binary information for windows to regodnize the file as a .wav file.
I hope I'm making sence!?!
I am trying to replicate the action that takes place when one right clicks in a windows directory and is given the option to craete a new .wav file.
Windows automaticaly creates a file with the .wav extention and puts the nececery information in the begining of the file (even though there is no sound recorded yet).
Mabe a shell command will do the job ,but how??
If you are still awake after my post ,your help will be much appreciated.
Thanks
Dan.
-
What you are trying to do is just what i tried three years ago with vb3. Thats right, if you record an empty wavfile, it will contain 44bytes wich contains the structure of the file. I coded a program three years ago (not ready yet) that converts the frequency and maximizes the wave amplitude. And the hard thing was to understand what those 44 bytes really did. Before i help you, I have to ask you, what you want to accomplish? Manipulating the rest of the wavfile, the noise-part would only cause trouble.
-
I am using the multimedia control to record .wav files.
The command: mmcontrol1.command="Save" will only save the recording to an existing file!
That means I have to create an empty .wav file and then
save the recording to that file using the command line:
mmcontrol1.command="Save".
I have feeling I am missing somthing big here because it doesn't make sence that one can only record to an existing .wav file that can not be created through code.
Please tell me I am.
Thanks.
Dan.
-
I Think you just got the answers out there, while i was offline. I saw some posts of how to just create one, I just have the code for how to read the wav file. That might not help you, or? If you need to manipulate the quality of the file, I have the solution. I still i wanted to post my own research here. It's a bit old, and the code is done in vb3 so it may be hard to get anything of it. But try it!
'Check file info
Dim head As String * 1: 'slist.Clear
Open filen For Random As #1 Len = Len(head)
'get first file check size (RIFF)
sbyte = 4
number = 0: For n = 1 To 4: Get #1, sbyte + n, head: number = number + Asc(head) * 256 ^ (n - 1): Next n:
RIFF = 8 + number:
If RIFF <> LOF(1) Then If MsgBox("RIFF-TESTLENGTH SHOWED:" & Str$(RIFF) & " AND FILE LENGTH IS:" & Str$(LOF(1)) & " FILE CAN BE CORRUPTED!", 1) = 2 Then edi.Visible = False: logo.Visible = True: Close #1: Exit Sub
'get second file check size (DATA)
sbyte = 40
number = 0: For n = 1 To 4: Get #1, sbyte + n, head: number = number + Asc(head) * 256 ^ (n - 1): Next n:
RIFF = 44 + number:
If RIFF <> LOF(1) Then If MsgBox("DATA-TESTLENGTH SHOWED:" & Str$(RIFF) & " AND FILE LENGTH IS:" & Str$(LOF(1)) & " FILE CAN BE CORRUPTED!", 1) = 2 Then edi.Visible = False: logo.Visible = True: Close #1: Exit Sub
'get Mono/stereo channels
Get #1, 23, head
Select Case Asc(head)
Case 1: monoon.Value = True
Case 2: option2.Value = True
Case Else: monoon.Value = True: If MsgBox("Stereo/Mono Channels showed:" & Str$(Asc(head)) & " AND SET TO MONO, FILE CAN BE CORRUPTED!", 1) = 2 Then edi.Visible = False: logo.Visible = True: Close #1: Exit Sub
End Select
'get 11/22/44Khz frequency
sbyte = 24
number = 0: For n = 1 To 4: Get #1, sbyte + n, head: number = number + Asc(head) * 256 ^ (n - 1): Next n:
Select Case number
Case 11025: freq(0).Value = True
Case 22050: freq(1).Value = True
Case 44100: freq(2).Value = True
Case Else: freq(0).Value = True: If MsgBox("Frequency:" & Str$(number) & " NOT SUPPORTED AND SET TO 11025 Hz, CONVERT THIS FILE INTO 11/22/44Khz and try again", 1) = 2 Then edi.Visible = False: logo.Visible = True: Close #1: Exit Sub
End Select
'get Bitrate
Get #1, 35, head
Select Case Asc(head)
Case 8: ebit(0).Value = True
Case 16: ebit(1).Value = True
Case Else: ebit.Value = True: If MsgBox("Bit:" & Str$(Asc(head)) & " AND SET 8, FILE CAN BE CORRUPTED!", 1) = 2 Then edi.Visible = False: logo.Visible = True: Close #1: Exit Sub
End Select
'get byte/amp
Get #1, 33, head
byterate = Asc(head)