473,320 Members | 1,988 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,320 software developers and data experts.

WAV to BMP

Convert WAV To BMP And Back

On RentaCoder one of the other 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 graphical
representation that looks like a traditional wav file. I expect a 1
dimensional colorful psychedelic mess. I might have to add more
dimensions to the image, depending on the frequency of the samples in
the music. It just depends on how many colors I have to work with.

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. The content of the files doesn't matter it is all 1s and 0s,
the headers determine the size.

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.

I have the software to do the job now. I've downloaded 010 Editor,
which is a Hex Editor that understands how to interpret binary file
formats and has a scripting side program that can let you make
automatic conversions between files. Sweet!
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


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 -

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
:
:

Aug 24 '06 #1
9 2394
On 24 Aug 2006 13:10:54 -0700, vi***********@gmail.com wrote in
comp.lang.c:
Convert WAV To BMP And Back
[snip]

Completely off-topic here, just go away.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Aug 24 '06 #2
What you want to do is "goofy".
WAV files are sound and BMP files are pictures.
Do a little more homework first before asking a question.

later.....

<vi***********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Convert WAV To BMP And Back

On RentaCoder one of the other 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 graphical
representation that looks like a traditional wav file. I expect a 1
dimensional colorful psychedelic mess. I might have to add more
dimensions to the image, depending on the frequency of the samples in
the music. It just depends on how many colors I have to work with.

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. The content of the files doesn't matter it is all 1s and 0s,
the headers determine the size.

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.

I have the software to do the job now. I've downloaded 010 Editor,
which is a Hex Editor that understands how to interpret binary file
formats and has a scripting side program that can let you make
automatic conversions between files. Sweet!
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


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 -

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
:
:

Aug 24 '06 #3
In message <11**********************@h48g2000cwc.googlegroups .com>,
vi***********@gmail.com writes
>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.
It may be ... using audio editing software not bloody photoshop -
pillock

--
"I can't wait to fall in love, as last I'll know exactly who the
enemy is. - Peter Ustinov
Aug 24 '06 #4
***** charles wrote:
What you want to do is "goofy".

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>

Brian (are we making progress?)

Aug 24 '06 #5
"Default User" <de***********@yahoo.comwrote in message
news:4l***********@individual.net...
***** charles wrote:
What you want to do is "goofy".


Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>
I understand the "rules" perfectly. I thought that since the message
was soooo long and my response was so short, why should I have
to scroll all the way to the bottom to see it. I think that is just a
waiste of my and others time. And I didn't expect a quality response.

later.....
>
Brian (are we making progress?)

Aug 25 '06 #6
***** charles <so*****@out-there.comwrote:
I understand the "rules" perfectly. I thought that since the message
was soooo long and my response was so short, why should I have
to scroll all the way to the bottom to see it. I think that is just a
waiste of my and others time. And I didn't expect a quality response.
You could have just trimmed the quoted text appropriately.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Aug 25 '06 #7
***** charles wrote:
"Default User" <de***********@yahoo.comwrote in message
news:4l***********@individual.net...
***** charles wrote:
What you want to do is "goofy".

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>

I understand the "rules" perfectly.
Apparently not.
I thought that since the message
was soooo long and my response was so short, why should I have
to scroll all the way to the bottom to see it. I think that is just a
waiste of my and others time. And I didn't expect a quality response.
Read what I posted again. See the part about "properly trimmed quotes"?
You didn't trim anything, then used that netiquette violation to
justify a further one.

Brian (bad form, innit)

Aug 25 '06 #8
***** charles wrote:
"Default User" <de***********@yahoo.comwrote in message
>***** charles wrote:
>>What you want to do is "goofy".

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>

I understand the "rules" perfectly. I thought that since the message
was soooo long and my response was so short, why should I have
to scroll all the way to the bottom to see it. I think that is just a
waiste of my and others time. And I didn't expect a quality response.
Then why didn't you treat it properly and trim the portion which
did not apply to your reply. Then you can post properly at the
bottom, and the whole thing makes sense.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html
Aug 25 '06 #9
vi***********@gmail.com wrote:
Convert WAV To BMP And Back
A novel, yet fairly pointless idea. Use a sound editor. Those do come with
appropriate visualisation aids.

You could conceivably think up a translation of sound data to image data in
such a way that the image editor's operations ultimately do something
useful. There's little point to doing so, however, since almost any useful
operation you can imagine this way can be done by professional sound editing
software (possibly using a custom filter).

More to the point, however: this is comp.lang.c, and there isn't a C
question in there anywhere. You could implement a conversion algorithm in C,
and if you do and have any questions about doing so, you could post here.

S.
Aug 26 '06 #10

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

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.