16,016,562 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 8244358 (Top 34 by date)
Member 8244358
22-Oct-12 7:58am
View
thank you for the links :)
but my question is that how can I apply window functions like Hamming window on these wave samples.
Member 8244358
20-Oct-12 11:24am
View
Sir, I changed my way of asking the question by providing more information, in particular, for those who felt I was rude earlier. If anyone feels I should provide more information, of course, I will provide it. I am not getting why you are feeling that I am being rude!
Member 8244358
20-Oct-12 3:31am
View
i have improved my question, thanks.
Member 8244358
20-Oct-12 3:31am
View
i didn't mean to be rude.
Member 8244358
11-Oct-12 9:48am
View
Okay, now I have created a new folder to store the audio data. Then I have also used Dispose() on filestream. But it does not solve my problem. However, I have found a method:
AxWindowsMediaPlayer1.currentplaylist.clear()
I am using this method and also am creating different sound files instead of overwriting a single file.
Member 8244358
11-Oct-12 2:19am
View
This is my Vb.Net Code:
Dim tbar as short
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
tbar=Trackbar1.Value
Select Case tbar
Case 1
Dim filestream1 as new filestream("C:\x.wav", FileMode.Create, FileAccess.Write)
Dim writer as new binarywriter(filestream1)
------Code for creating wave file named "x.wav"-------
writer.close()
filestream1.close()
AxWindowsMediaPlayer1.URL = "C:\x.wav"
AxWindowsMediaPlayer1.Ctlcontrols.play()
Case 2
Dim filestream2 as new filestream("C:\x.wav", FileMode.Create, FileAccess.Write)
Dim writer as new binarywriter(filestream2)
------Code for creating wave file named "x.wav"-------
writer.close()
filestream2.close()
AxWindowsMediaPlayer1.URL = "C:\x.wav"
AxWindowsMediaPlayer1.Ctlcontrols.play()
End Sub
In both these cases I am modifying the sample values in different ways, however, naming the wav file as "x.wav".
The code produced correct results but when I use WindowsMediaPlayer, it gives error of "is used by another process". On the other hand, when I use-
My.Computer.Audio.Play("C:\x.wav")
then I get accurate results.
Can you tell me what is the problem with using WindowsMediaPlayer?
Member 8244358
10-Oct-12 12:10pm
View
Okay, then I'll try to give it shot and then let you know. Thanks :)
Member 8244358
10-Oct-12 11:39am
View
so do you mean that I should create a playlist and each time add the same wave file, that I modify, to that playlist and then use your code? Am I right?
Member 8244358
9-Oct-12 12:00pm
View
Yes, your suggestion worked for me. I am able to overwrite the two files now. I was only using
binarywriter.flush()
and not
binarywriter.close().
Now I am using both and it works fine.
My next question is how do I make Windows media player shift from playing the first wave file to another on clicking second button and back to first wave file on clicking first button, since the wave file name in both the cases is the same?
Member 8244358
9-Oct-12 3:52am
View
yes, i am using Filestream method and i am also closing the binarywriter and filestream using the following code:
binarywriter.close()
filestream.close()
But it is still giving me error!
Member 8244358
29-May-12 13:03pm
View
and these conversions made me do the project in a much simpler and faster way.
Member 8244358
29-May-12 13:03pm
View
actually it is what my project is all about! i have to modify the samples of wav and create a new file using those samples.
Member 8244358
28-May-12 12:47pm
View
I have another question as well. Now I am applying a window function on selected samples of the wav file but in this case i don't know how many samples will be modified at the run time (this is how my processing goes)! Right now, I am modifying these samples in a loop and using a list (of short) to add each modified sample. Then i am converting list into array of short and then byte array and again memory stream and this is how i get to create a new wav file. I want to know whether i am doing the things right? If not, is there any other solution of this problem? Thanks in advance!!
Member 8244358
28-May-12 12:40pm
View
actually i got a new idea where i m converting array of Short values into a byte array, and then writing these byte values into a memory stream. The final wav file can be created using the memory stream. :)
But I appreciate your suggestion. it was of great help too. thanks a lot.
Member 8244358
24-May-12 6:07am
View
ok..i'll give it a try then.
Member 8244358
23-May-12 2:11am
View
thanks, i am already doing that. Do i need to convert the samples into little endian format? if yes, then how can i accomplish that?
Member 8244358
22-May-12 23:54pm
View
Is there any other way to do the things?
Member 8244358
22-May-12 23:54pm
View
First of all, thanks a lot for your kind help.
Basically, in order to make the things simpler, I tried to create a very simple application which is to make a new wav file same as original. Yes, I agree with all what you said. But I still want to know whether I am doing the things in the right way or not!
Member 8244358
22-May-12 23:50pm
View
Can u pls reply?
Member 8244358
21-May-12 5:23am
View
Well, before you have another cup of coffee..I think I should explain the working of my project step-by-step :D
1. I read a 16-bit Single-channel wav file.
2. Its header values such as Chunk-size, chunk Id, sample-rate, format, etc. are being read into separate text-boxes.
3. The data samples (that always begin at position 44 in a wav file) are being read as bytes and these bytes are written into a textfile.
4. So far I have not processed them as I am working to create a new wav file, exactly the same as original.
5. Now in the code for another button, I am using a binary writer to write the header of the new wav file that I want to create. I took that code from www.codeproject.com itself.
Note: So far, the code is working fine.
6. Now I want to add data to the new wav file starting at position 44. This data I have already saved in the textfile (as mentioned in step 3).
So, I am stuck at step 6.
I hope now there will be no confusion. I'll be really-really thankful, if somehow you can explain me the code for step 6. Thanks is advance!! :)
Member 8244358
20-May-12 4:25am
View
Also, i get this type of values (Int16) if I read original wav using ReadInt16 function:
2
-2
2
-2
1
0
0
0
0
-1
2
-3
4
-5
5
-3
0
2
-3
3
Member 8244358
20-May-12 4:16am
View
Yes, I need to create a file, write WAV headers, and then append the binary data from the TXT file.
thank GOD you finally got my question.. hehe.. :D
Anyway, I am able to create the wav file using byte array now. And it plays too. But now the problem is that my wav file plays but there is a very Heavy Distortion. What do I do? I've been working on this problem for 2 months.
Member 8244358
20-May-12 3:00am
View
Yes I am actually doing some processing on the wav data samples. That is why, i am using textfile (as a database you can say). And in that textfile, i am only storing the data sample values. I am writing the header values using binary writer. There are no issues in writing the header values. The problem is just data samples.
Member 8244358
20-May-12 2:43am
View
Right now, my textfile contains the data like this:
255
255
2
0
254
255
2
0
254
255
1
0
0
0
0
0
0
0
0
0
255
255
2
0
253
255
4
0
251
255
5
0
253
255
Member 8244358
20-May-12 2:42am
View
Deleted
I know it is easy..but I am finding it to be a bit complicated as i am not getting how to do it and yes, u can say that its just a case of "write the bytes to a file with a .WAV extension". Now can u tell me, what should I do to solve the problem.
Member 8244358
20-May-12 2:11am
View
Lol :D
Actually I am using byte values to create the copy of a wav file. As wav file data is in Little Endian format, my problem is that I am not getting how to create the wav file from byte values stored in a textfile (The textfile contains original wav samples as byte values and i am creating a copy of original wav file).
Member 8244358
20-May-12 2:07am
View
This code works but still I am not getting the exact values
Member 8244358
18-May-12 23:41pm
View
i am able to read the fle into byte array, but not able to convert byte array into an array of Int16 values
Member 8244358
18-May-12 23:39pm
View
thanks for your code..but i am still not getting the exact values. yes, i want the values in Little Endian format. But actually i am working with wav files. I am reading a wav file into a byte array and want to create a copy of original wav file using the same byte array. Can you suggest me how do i do it? I am using the following code:
Public Function streamfile(ByVal filename As String) As Byte()
Dim fs As New FileStream(filename, FileMode.Open, FileAccess.Read)
Dim data(fs.Length) As Byte
fs.Read(data, 0, System.Convert.ToInt32(fs.Length))
fs.Close()
Return data
End Function
Dim bytes() As Byte = streamfile("C:\filename.doc")
fw.Write(bytes, 0, bytes.Length)
Member 8244358
18-May-12 13:16pm
View
hope u will understand my question better.
Member 8244358
18-May-12 13:14pm
View
Deleted
ok
Member 8244358
18-May-12 13:13pm
View
i want to convert an array of byte values into an array of short. i know that 2 bytes = 1short. But i am not able to do it properly even after searching a lot on Google.
Member 8244358
18-May-12 2:14am
View
Deleted
Pls note that when I read Sound2.wav, the byte values now read are completely different from those I actually had written.
I also want to know how do I create Int16 values from a byte array. Perhaps that will solve my problem.
Member 8244358
18-May-12 2:11am
View
Deleted
Ya I am reading the wavfile in a textfile. Then loading the textfile into a bytearray. And again using Byte Array to create a new wavfile (which is actually same as original) without modifying. But I don't understand how to create it!
Show More