![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2007
Posts: 2
Rep Power: 0
![]() |
I was wondering if it is possible to write a program in C or C++(maybe even Visual Basic, as i m more experienced with that programming language) to convert a .wav file into bytes and save the same file as a text file.
I am a Visual Basic programmer and have little (almost no) knowledge about C or C++ programming. Please Help. By far, I have achieved success in only loading up the .wav file in Visual Basic. I am still wanting to learn how to extract data from the wav file using Visual Basic. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Nov 2007
Posts: 33
Rep Power: 0
![]() |
Re: Convert .wav file into bytes
All files can ultimately be viewed as arrays of bytes.
Look up fopen() and fgetc() and fread()
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Convert .wav file into bytes
A .wav file is already bytes. So are all other files. No conversion needed.
Bytes only have 256 possible values. If you output these values directly to most displays, you will get some characters (which are meaningless) and some undisplayable output which might result in nothing at all, or might cause some funny things to happen on the display. If you want to REPRESENT the values of the bytes on a display, you'll need to decide what representation you want (decimal, hexadecimal, quadricentennialseptisesimus, whatever) and make an appropriate conversion, using an appropriate character set. A .wav file is a file that contains descriptive information as well as binary representations of the sound. For more information, see here.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: Convert .wav file into bytes
If you're in Windows, use the command prompt.
Go to the directory and type 'mv <xxxxx.wav> <xxxxx.txt>', where xxxxx.wav is the filename. (Don't type the <> brackets or the quotes) That's the short answer. You should read DaWei's post, because that concept is very powerful if you understand it. Last edited by Harakim; Nov 18th, 2007 at 3:11 AM. Reason: Chuck Norris |
|
|
|
|
|
#5 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
Re: Convert .wav file into bytes
Perhaps you should take the time to understand the file format, which will clearly tell you the sequence of bytes and what they mean, just try Googling WAV
__________________
Quote:
|
|
|
|
|
|
|
#6 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Convert .wav file into bytes
An example of the format is in the link I posted.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Nov 2007
Posts: 2
Rep Power: 0
![]() |
Re: Convert .wav file into bytes
Erm, well I know that i .wav file is bytes, but what i want is to extract those bytes and save it as a text file or something. This step is just a small part of what i am exactly trying to do. I m trying my luck on .wav steganography and on the basis of a small programming framework that i have made, i guess extracting the bytes would be a crucial step to proceed further. Although i am still researching on how to do .wav steganography, i dont mind learning a few important concepts or skills that i might be able to incorporate in a .wav stegaography program.
By the way, thanks a lot for your instantaneous reply. I surely appreciate it. Erm, since you are more professional at this stuff than me, can i expect a bit of more knowledge about what i am trying to do from you. Thanks again |
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Convert .wav file into bytes
Sure you can, if you avail yourself of the help already given, and apply it. Structures for discerning the format information attached to the sound information are shown there, and are available all over the web.
You have shown no attempt at breaking a sweat, designing your task, writing some code, and asking for help with its problems.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 |
|
Programmer
Join Date: Oct 2007
Posts: 39
Rep Power: 0
![]() |
Re: Convert .wav file into bytes
You know, if you show us an example of exactly what you want you could probably save yourself days of trying to explain it. It's already been 2 and no one understands it yet.
And what's an erm? |
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Convert .wav file into bytes
An erm is a li'l thangy, that when it joins the FBI, becomes a G-erm.
Here's what you do. Go to that link and look at the header format. You'll notice that it's not fixed in size. Read enough of it to determine what its size IS. Then read the remainder of it. Then throw all that in the trash. Read each of the subsequent bytes and convert them to a hexadecimal or decimal or other based value, in a textual representation of that value. Just don't ask for another bite of pablum until you show some effort.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem processing file into a char array | csrocker101 | C++ | 1 | May 8th, 2007 11:50 PM |
| about write bytes to a file | kychan | C++ | 0 | Apr 2nd, 2005 11:05 PM |
| hey guys can anyone tell me how to convert from binary file | midotec | C# | 0 | Mar 10th, 2005 11:30 AM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 9:04 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 4:12 PM |