473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

WAV to BMP & Back!

Convert WAV To BMP And Back

On RentaCoder one of the coders thought I just wanted him to change the
extension from WAV to BMP. Another coder brought up the complexities
of actually converting WAVs to JPGs and back again, because JPGs are
compressed. And someone else asked me how they could actually convert
it. It is easiest if we work with BMPs and WAVs because if we worked
with BMP image files you just have to get into the binary code of the
file, and swap the headers around. So as long as photoshop thinks the
WAV is a BMP file you will be able to see what it looks like and modify
it. But I don't expect a representation that looks like a graphical
wav file. I expect a colorful psychedelic mess.

What I suggest is a simple command line interface that has all the
fields for the headers as boxes for input. The number of colors in the
image, the height and width, etc. And all the fields for the type of
sound on the other. And then the user gets to make a manual switch.

It would be nice if we could do all of this live, and while I was
editing in photoshop it could show me a convenient display of what the
WAV file was intended to look like. But we will need to run
experiments to see how the file size of WAVs and BMPs relate to the
headers, minus the size of the headers (which change depending on the
size of the headers fields).
Here is some data...

100x100 pixels: 29.3 KB (30,056 bytes)
1x1 pixels: 60 bytes (60 bytes)

resulution 72 pixels/inch
Color Moder: RGB 8 Bit
Depth 24 Bit

- saved in photoshop -

The content of the files doesn't matter it is all 1s and 0s, the
headers determine the size. We could do another experiment just like
this with a wav file, and see how the size of the file relates to the
wav files headers.
I would like to be able to blend music in photoshop by mixing layers of
wav files. I can take two recordings of someone singing the same song,
and blend them together in photoshop. An example could be taking a
robot voice that sings a song, and then blending it with my voice while
I am singing. To create a more realistic robot. This is one of the
techniques they are using to make music in holywood. And obviously we
could also take real life images or abstract or and see what they
"sound like".

Aug 24 '06 #1
6 6122

<Co********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Convert WAV To BMP And Back
All that sounds like an interesting idea, but there's no C++ language
question here. Perhaps someone in comp.graphics (or comp.dsp?) might be
able to assist in that. Or, a Google search for "photoshop format" or
something. I assume it's a proprietary format, but you might find
information somewhere that will let you convert the header portion from one
format to the other. Not here, though. This forum is specifically for
discussing C++ language issues.

-Howard
Aug 24 '06 #2
Incase you are interested, here is the dissasembled output of two BMP
files from 010 Edit, a Hex Editor. With C++ you can go in their and
convert a BMP to a WAV by understanding outputs like these. And I'm
looking for coders I can hire to do the job.

1x1 BMP
-------

:struct BITMAPFILEhEADER bmfg
: CHAR bfType[2] BM
: DWORD bfSize 60
: WORD bfReserved1 0
: WORD bfReserved2 0
: DWORD bfOffBits 54
:
:struct BITMAPinfohEADER bmih
: DWORD biSize 40
: LONG biWidth 1
: LONG biHeight 1
: WORD biPlanes 1
: WORD biBitCount 24
: DWORD biCompression 0
: DWORD biSizeImage 6
: LONG biXPelsPerMeter 2834
: LONG biYPelsPerMeter 2834
: DWORD biClrUsed 0
: DWORD biClrImportant 0
:
:struct BITMApLINE lines[1]
: struct BITMApliNE lines[0]
: struct RGBTRIPPLE colors[1]
: struct RGBTRIPlE colors[0]
: UBYTE rgbBlUE 255
: UBYTE rgbGreen 255
: UBYTE rgbRed 255
: UBYTE padBytes[1]
: UBYTE padBytes[0] 0
:
:
:100x100 BMP
:-----------
:
:struct BITMAPFILEhEADER bmfg
: CHAR bfType[2] BM
: DWORD bfSize 30056
: WORD bfReserved1 0
: WORD bfReserved2 0
: DWORD bfOffBits 54
:
:struct BITMAPinfohEADER bmih
: DWORD biSize 40
: LONG biWidth 10
: LONG biHeight 10
: WORD biPlanes 1
: WORD biBitCount 24
: DWORD biCompression 0
: DWORD biSizeImage 30002
: LONG biXPelsPerMeter 2834
: LONG biYPelsPerMeter 2834
: DWORD biClrUsed 0
: DWORD biClrImportant 0
:
:struct BITMApLINE lines[1]
: struct BITMApliNE lines[0]
: struct RGBTRIPPLE colors[100]
: struct RGBTRIPlE colors[0] #FFFFFF
: UBYTE rgbBlUE 255
: UBYTE rgbGreen 255
: UBYTE rgbRed 255
: ...
:
: struct RGBTRIPlE colors[99] #FFFFFF
: UBYTE rgbBlUE 255
: UBYTE rgbGreen 255
: UBYTE rgbRed 255
: ...
:
: struct BITMApliNE lines[99]
: struct RGBTRIPPLE colors[100]
: struct RGBTRIPlE colors[0] #FFFFFF
: UBYTE rgbBlUE 255
: UBYTE rgbGreen 255
: UBYTE rgbRed 255
: ...
: struct RGBTRIPlE colors[99] #FFFFFF
: UBYTE rgbBlUE 255
: UBYTE rgbGreen 255
: UBYTE rgbRed 255
:
:
Howard wrote:
<Co********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Convert WAV To BMP And Back

All that sounds like an interesting idea, but there's no C++ language
question here. Perhaps someone in comp.graphics (or comp.dsp?) might be
able to assist in that. Or, a Google search for "photoshop format" or
something. I assume it's a proprietary format, but you might find
information somewhere that will let you convert the header portion from one
format to the other. Not here, though. This forum is specifically for
discussing C++ language issues.

-Howard
Aug 24 '06 #3
Co********@gmail.com wrote:
[top posted, off topic reply redacted]
What part of off-topic do you not understand?

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Also, please don't top post.

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.4
Aug 24 '06 #4

red floyd wrote:
Co********@gmail.com wrote:
[top posted, off topic reply redacted]

What part of off-topic do you not understand?

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Also, please don't top post.

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.4
You got to follow up on these things.. And here are some dissasembled
WAV files for those of you who are interested in coding converters.

audio code LPCM
Parameters 1 channels 8 bits
32000 Sampling Freq.
256 Bitrate kbps
WAV's made with tools on http://jsoto.posunplugged.com/audiotools.htm
1 sample
--------
:struct WAVRIFFHEADER header
: ID groupID[4] RIFF
: ID groupID[0] 82'R'
: ID groupID[1] 73'I'
: ID groupID[2] 70'F'
: id groupID[3] 70'f'
: long size 37
: ID riffType[4] WAVE
: ID riffType[0] 87'W'
: ID riffType[1] 65'A'
: ID riffType[2] 86'V'
: ID riffType[3] 69'E'
:struct FORMATCHUNk format
: ID chunkID[4] fmt
: ID chunkID[0] 102'f'
: ID chunkID[1] 109'm'
: ID chunkID[2] 116't'
: ID chunkID[3] 32' '
: long chunkSize 16
: short wFormatTag 1
: unsigned shortwChannels 1
: unsigned long dwSamplesPerSec 32000
: unsigned long dwAvgBytesPerSec 32000
: unsigned short wBlockAlign 1
: unsigned short wBitsPerSample 8
:
:struct DATACHUNK data
: ID chunkID[4] data
: ID chunkID[0] 100'd'
: ID chunkID[1] 97'a'
: ID chunkID[2] 116't'
: ID chunkID[3] 97'a'
: long chunkSize 1
: uchar samples[1]
: uchar samples[0] 0
10 sample
---------

:struct WAVRIFFHEADER header
: ID groupID[4] RIFF
: ID groupID[0] 82'R'
: ID groupID[1] 73'I'
: ID groupID[2] 70'F'
: id groupID[3] 70'f'
: long size 46
: ID riffType[4] WAVE
: ID riffType[0] 87'W'
: ID riffType[1] 65'A'
: ID riffType[2] 86'V'
: ID riffType[3] 69'E'
:struct FORMATCHUNk format
: ID chunkID[4] fmt
: ID chunkID[0] 102'f'
: ID chunkID[1] 109'm'
: ID chunkID[2] 116't'
: ID chunkID[3] 32' '
: long chunkSize 16
: short wFormatTag 1
: unsigned shortwChannels 1
: unsigned long dwSamplesPerSec 32000
: unsigned long dwAvgBytesPerSec 32000
: unsigned short wBlockAlign 1
: unsigned short wBitsPerSample 8
:
:struct DATACHUNK data
: ID chunkID[4] data
: ID chunkID[0] 100'd'
: ID chunkID[1] 97'a'
: ID chunkID[2] 116't'
: ID chunkID[3] 97'a'
: long chunkSize 10
: uchar samples[10]
: uchar samples[0] 0
: uchar samples[1] 0
: uchar samples[2] 0
: uchar samples[3] 0
: uchar samples[4] 0
: uchar samples[5] 0
: uchar samples[6] 0
: uchar samples[7] 0
: uchar samples[8] 0
: uchar samples[9] 0

Aug 24 '06 #5

<Co********@gmail.comwrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
>
red floyd wrote:
>Co********@gmail.com wrote:
[top posted, off topic reply redacted]

What part of off-topic do you not understand?

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Also, please don't top post.

see http://www.parashift.com/c++-faq-lit...t.html#faq-5.4

You got to follow up on these things.. And here are some dissasembled
WAV files for those of you who are interested in coding converters.

audio code LPCM
Parameters 1 channels 8 bits
32000 Sampling Freq.
256 Bitrate kbps
WAV's made with tools on http://jsoto.posunplugged.com/audiotools.htm
1 sample
--------
<snipped stuff no one here is interested in>

This is *off topic*. Try some other newsgroup where it's actually on topic.
Please.
Aug 24 '06 #6
In article <11**********************@h48g2000cwc.googlegroups .com>,
Co********@gmail.com says...
Convert WAV To BMP And Back
First and foremost, you're completely off-topic here.

Second, you're utterly insane. To mix audio files in any useful way, you
need to use software that's written for the job. Photoshop is not, never
has been, and almost certainly never will be intended for mixing audio
files.

What you're asking right now is about equivalent to having heard that
"microwave ovens are more efficient than gas", so you've decided to
replace your car's engine with a microwave oven, and we need to tell you
how big of a microwave to use...

--
Later,
Jerry.

The universe is a figment of its own imagination.
Aug 25 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: mali_djuro | last post by:
Hi all, i used JDOM to create XML file. first, i get data from database and create Document object. in some data i have quotas, so it makes replacment in content of elements. for example: if i...
4
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
7
by: DC Gringo | last post by:
I am having a bear of a time with setting a URL query string as a text value in a dropdownlist and Server.URLEncode does not seem to do its job. theFullLink = theLinkPrefix &...
1
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It...
7
by: GrandpaB | last post by:
While writing this plea for help, I think I solved my dilemma, but I don't know why the statement that solved the problem is necessary. The inspiration for the statement came from an undocumented...
11
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved...
6
by: cj | last post by:
I'm receiving an xml formatted string that I pull data from by reading it into an xml document like this: Dim doc As New Xml.XmlDocument doc.LoadXml(respstr) Dim co_name As Xml.XmlNodeList =...
2
by: FP | last post by:
I have a javascript variable set to the contents of a database comments field. To set the js variable I used the PHP addslashes function which encodes the apostrophe, double quotes and the...
7
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get...
3
by: webmasterATflymagnetic.com | last post by:
Folks, I'm struggling to put the question together, but I have this problem. I have written an HTML form that I can use for data entry. This uses PHP to write a SQL UPDATE command that gets...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.