Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 17th, 2007, 8:15 PM   #11
formasfunction
Newbie
 
Join Date: Feb 2007
Posts: 6
Rep Power: 0 formasfunction is on a distinguished road
Removing the wav header

Ha. Well, would you be able to point me in the direction of how to remove the wav header that your code added? Also, how would I remove the header of a jpg BEFORE turning it into a wav with your code? I'd like to remove the header of jpg, turn it into a wav, manipulate the wav in an audio program and then pull the wav header off and put a fresh jpg header on there. I'd like to see how that effects the image. Maybe thats a tall order but I'm hoping its all pretty much the same code, just specifying a few different parameters. Thanks for all of your help already.
formasfunction is offline   Reply With Quote
Old Feb 17th, 2007, 8:46 PM   #12
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,005
Rep Power: 5 lectricpharaoh will become famous soon enough
DaWei's method is a good example of how to do the image-to-sound conversion (indeed, it should work for any arbitrary sequence of binary data, whether that is an image, program, or whatever). However, it seems to me that if you pumped something like a .JPG or .GIF into it, it wouldn't work for your purposes. Sure, the digital output of the program could be converted back to its original form (since there were no lossy algorithms employed in the conversion to PCM data in the first place), but once you store it on analog media (such as vinyl), you will not have this exactness. For formats that are compressed or otherwise encoded in some manner, this will probably cause the decompressor/decoder to choke on the data.

However, it seems to me it would be entirely possible to treat the analog data as raw image data. A Windows .BMP file is a good example. You digitize the analog data, then when you know the amount, you can build a bitmap image from it by writing the header that describes the image (width, height, pixel format, etc), then following it with the digitized data (note that a Windows .BMP sometimes requires padding bytes after each scanline to maintain alignment, so this needs to be accounted for).

You could then convert this to a .JPEG file if you wanted. My point is that when converting an image to sound, use raw image data (no headers, palette table, etc). When converting it back, you will (hopefully) get a fairly close reproduction of the original, but there will be some 'noise' in the image, as there will be some loss of signal in the digital -> analog -> digital conversions. Also, you may find it a good idea to have your image start with a series of all-black pixels followed by a white pixel. You would use this to find the 'start' of the signal. Otherwise, your data would probably not be aligned to the right bit, and it would throw the whole thing off.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old Feb 17th, 2007, 10:31 PM   #13
Indigno
Professional Programmer
 
Indigno's Avatar
 
Join Date: Dec 2005
Location: Anywhere non-productive
Posts: 267
Rep Power: 0 Indigno is an unknown quantity at this point
Send a message via AIM to Indigno Send a message via MSN to Indigno Send a message via Yahoo to Indigno
I believe that there was a failed video format that worked on similar technology. Failed in the sense that it didn't catch on, not that it didn't work. I'm too tired to look it up, but I believe that it's somewhere in wikipedia's video formats/ recorders area. It may be a good way to get some background information.

Also consider that if you press this onto a vinyl record, anyone listening to it will probably get some pretty nasty sound, so I would definetly reccomend clearly marking your records for your listerners' sake.
__________________
Perhaps I should have a sticky topic for all of the times I "return" to this forum instead of a new one every time.
Indigno is offline   Reply With Quote
Old Feb 18th, 2007, 5:35 AM   #14
Eoin
Hobbyist Programmer
 
Eoin's Avatar
 
Join Date: Jun 2006
Location: Ireland
Posts: 152
Rep Power: 3 Eoin is on a distinguished road
It seems to me that the key here is you need a way of encoding digital data into analog sound and then back again. As a bonus you probably wouldn't need 100% perfect transmission as you could use an image format which would be somewhat error tolerant.

Unfortunately the decoding step will not be automatic, you'd also need to provide a utility for that purpose.
__________________
Visit my website BinaryNotions.
Eoin is offline   Reply With Quote
Old Feb 18th, 2007, 7:09 AM   #15
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
You could, for instance, convert a digital movie to NTSC (analog), reproduce/play that as sound, then replay it as a TV movie while recapturing the digital with something like FRAPS.
__________________
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
DaWei is offline   Reply With Quote
Old Feb 18th, 2007, 9:55 AM   #16
formasfunction
Newbie
 
Join Date: Feb 2007
Posts: 6
Rep Power: 0 formasfunction is on a distinguished road
image formats

What image format do you think is going to have the greatest tolerance? Someone mentioned BMP.

I'm guessing that whatever format I use I should convert it to a wav file only after I remove the image header so that any distortion in the analogue realm doesn't affect the format's ability to be read when decoded it only affects the quality of the image.

A small utility would then decode the information and put a fresh image header back onto the data.

Where can I go to learn more about pulling headers off of files and adding headers to files?

Last edited by formasfunction; Feb 18th, 2007 at 10:24 AM.
formasfunction is offline   Reply With Quote
Old Feb 20th, 2007, 2:03 AM   #17
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,005
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by formasfunction
Where can I go to learn more about pulling headers off of files and adding headers to files?
My usual resource for file format structures is Wotsit's Format.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Question: Reading Bitmaps prototype_angel C++ 6 Dec 8th, 2006 4:48 AM
Questions about extra Sound and Graphics libraries Soulstorm C++ 2 May 15th, 2006 10:42 AM
Attitudes Oddball Coder's Corner Lounge 29 Mar 18th, 2006 9:34 PM
might sound like a stupid question... jobobshishkabob HTML / XHTML / CSS 11 Jan 29th, 2006 11:55 AM
turning integers into sound? clam Visual Basic .NET 2 Aug 23rd, 2005 1:28 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:45 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC