|
-
August 4th, 2005, 03:23 AM
#16
Re: How to Convert txt or image file into sound waves
ok tx for a links..
i should re-think now...lol ok duecource i will be happy to know more from you
-
August 18th, 2005, 05:42 PM
#17
Re: How to Convert txt or image file into sound waves
This is a very interesting topic and you all sound like a group of geniuses to me.
I am an artist and musician in the midst of developing a project where I am trying to take a graphic and convert it into audio. My project is seeking a way to "scan" or imput an image (on paper or film or some other medium) and use this to generate sound.
One idea is to experiment with a simple audio sound wave that when viewed in an audio program, a "mountainous" image represents that sound. I think everyone is familiar with this type of image, right? The next step is to recreate this sound wave graphically, whether it be a screen capture from a computer that is printed out, or a simple line that is drawn on a piece of paper, then scanned to generate a sound.
As a model, I'm thinking about the sound track on a filmstrip used on a classic movie projector. That thin strip that contains the information used to generate sound is a clear film with opaque black "scribbles" or mountain shapes. How can import a graphic in a similar way and as a result, create a sound?
I love the idea of broadcasting the sound. As I said before, you sound like a bunch of geniuses!
Thanks for letting me peak at your project.
-
August 18th, 2005, 05:55 PM
#18
Re: How to Convert txt or image file into sound waves
Say you were to go with the standard graphical ""mountainous" veiw. What you would need to do is:
a) some how acquire the scanned picture. (easiest to make the user scan it and then open the image from your app).
b) Identify the graph region.
c) recognise the 0 line throught the wave. This can be tricky as the graphic will almost certainly not be 100% straight. But once you have the graph region, you can appriximate the beginning and end and the assume the 0 line passes linerly through both.
d) work out the deviation of each point from the 0 mark.
e) play the sound. (You will need to know the sampling time or time length of the clip of the grapic to play it back properly.)
This problem is very solvable. But it is not easy. Certainly I would recomend it to a beginner in programming nor in image recognition
Mike
-
August 18th, 2005, 06:40 PM
#19
Re: How to Convert txt or image file into sound waves
Unless I misunderstand you, the shape you describe is called a sine wave, like what Pinky98 did with ASCII characters in an earlier post on this thread (though music does look more "mountainous, thus not a pure sine). If you want to generate the sound from this, that's like doing the reverse of what many popular multimedia players do - showing the waveform of sound being played. In other words, you want to generate the sound from the graph, instead of the graph from the sound, yes? As Pinky98 said, it's not such a beginner-type project, but none-the-less possible. However, the first problem I see it that the image would have to be enormous in order to contain enough information to generate a usable duration of sound. As an alternative, you could use a small image just to establish a frequency, and use DirectX or something to generate a tone of that frequency. This to me seems far more realistic, and quite a bit easier as well, since you could basically just look for the crossover points - that is, the points at which the line goes over the zero-point (middle). Now, you won't be getting the actual values of various points along the waveform, so you can't reproduce the timbre. However if you scanned all points (of a small image), you could theoretically create a sound file, and loop it over and over, like the way a sampler program or keyboard would.
Last edited by WizBang; August 18th, 2005 at 06:46 PM.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
August 18th, 2005, 06:56 PM
#20
Re: How to Convert txt or image file into sound waves
Hey, thanks for the quick response.
Pinky, is there an existing program or technology that I could use to "make noise from my drawing?"
Wiz, you are correct in assuming that I would like to generate the sound from the graph rather than the graph from the sound. The enormous image is not the problem, it's capturing that image that I am struggling with.
The resulting sound quality is not a major concern at this stage of my experimentation. If i can first find the best way to generate the sound, I'll allow myself the time to improve the quality.
-
August 19th, 2005, 03:16 AM
#21
Re: How to Convert txt or image file into sound waves
The best examples that I know of, are professional audio editors such as SoundForge. You can start by creating a new file with just silence, then use a graphics tablet or the mouse to draw a waveform. It would certainly take practice to get anything recognizable as sound, much less music, but it is possible. You could then loop it to create a continuous tone, though you'd have to edit the ends such that they fit together, otherwise you'll get a noticable click sound every time it starts over. Drawing all the waveform necessary for an entire song would probably take decades to get anything listenable. To illustrate this difficulty, a middle C note has a frequency of 256 Hz to 280 Hz (depending on the musical scale you use, though generally considered to be 278.4375 Hz). One second of one middle C note would require drawing about 278 cycles (One cycle of a waveform is one which ends just at the right spot to begin again, repeating the pattern). Over time the pattern of a typical instrument changes, otherwise it would sound like a continuous tone, such as what might be used with a test pattern on a broadcasting station during off-air hours. All 278 of your cycles would need to be formed so that together they produce something at least somewhat pleasant. Unless of course you intend to create some unintelligible noise. Anyway, I'm sure you can see it's far easier to pick up a real instrument and get music out of it, even for the novice. Moreover, all your effort would render only one "instrument".
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
August 19th, 2005, 05:27 AM
#22
Re: How to Convert txt or image file into sound waves
 Originally Posted by WizBang
However, since an image would have up to 16 million colors, you won't be able to use just frequency alone to distinguish every color value.
It should be possible to produce 3 tones to represent 1 pixel. i.e the red value, then green, then blue. This could be used to create a 24 bit device independant bitmap..... It may be more efficient to use a different file format though.
Very interesting idea
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010
-
August 19th, 2005, 06:57 AM
#23
Re: How to Convert txt or image file into sound waves
no not that i know of. you see, drawings are not a very efficient way of storing data, so anyone wanting to store a sound wave would not use a picture to do it. But thats not to say that there isn't one. Just take a look around opn the net and see what you can find.
Mike
-
August 19th, 2005, 07:43 AM
#24
Re: How to Convert txt or image file into sound waves
Thanks again everyone.
I currently use professional audio and MIDI recording software (Pro Tools, Studio Vision Pro, Audacity, Peak and Reason to name just a few) to record music and I am very aware of how sophisticated a sound wave is. WizBang, you are absolutely correct when you said it would take decades to try to reproduce even a few seconds of a song by drawing it. Let's agree that it would be impossible to recreate it in a recognizable way. But for the sake of discussion, let's imagine just for an example that some person with nothing to do for 25 years painstakingly drew a sound wave taken from an actual sound, like a middle "C". And let'say that I have this very accurate black and white drawing of this sound wave that is 2 meters tall and 20 meters wide or something like that. Let's also imagine that it has a recogizable 0 line and everything it would require to identify the graph region and the things Pinky mentioned. Let's just pretend it's in a perfect format. (What is that perfect format?)
With that said, HOW could we get that drawing back into an audio format?
You all are really amazing. I wish I found you 2 years ago when I began this project! I could've been halfway finished drawing that sound wave!
Thanks!
-
August 19th, 2005, 08:42 AM
#25
Re: How to Convert txt or image file into sound waves
Well, to convert such a drawing into a sound file, you'd have to scan the image pixel-by-pixel, looking for the ones which represent the waveform as opposed to the background. If the image is on paper, you'd obviously have to scan it in first like you would any image. The file format matters quite a bit since we're talking about a HUGE image. My guess would be PNG. If you can work directly on the file itself rather than an actual image in memory, that'd save you the trouble of figuring out how to load only part of the file, since you'd never get the entire thing loaded into ram as an image, which means BMP. Even being B&W just isn't practical enough.
Anyway, the Y coordinate of each dot of the waveform give you the amplitude. You'd presumably be scanning from left to right, so you'd already have the X value, which corresponds to your samplerate. There will only be one dot along the Y axis for any given sample, so once you find it, you can stop scanning that position, and shift one pixel to the right. Storing the resulting data as a wave file seems appropriate here, at least until you're done. Then of course you can compress it to whatever you want. The wave format is well documented, so no trouble there. You'll find examples of reading and writing to wave format all over, including PlanetSourceCode.com.
I think you should have little trouble finding info on the PNG format. Decoding it for viewing basically requires the same sort of knowledge as for your purpose. Like I said, the image would never fit into memory on any computer I know of. Certainly if you succeed you'd have one format which would make pirating music more than difficult.
Last edited by WizBang; August 19th, 2005 at 08:44 AM.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
August 19th, 2005, 11:19 AM
#26
Re: How to Convert txt or image file into sound waves
Assume you had a perfect black and white picture (no noise, absolutely straight). And assume you had the zero line....
For each column (i.e. a moment in time) simply find the pixel (should only be one in a perfect picture) which is black. The distance of the pixel from the zero line must then be stored as the value of the sound wave at that instance of time.
Mike
-
August 19th, 2005, 11:50 AM
#27
Re: How to Convert txt or image file into sound waves
I'm going to begin the scanning process on a scaled down graphic, and use a simple flatbed scanner to import the image into Photoshop. That will allow me to choose a file format, so I start by converting it to a PNG, then a TIF, BMP, etc...
Now once I have the PNG file, a program such as SoundForge might be able to import the balanced and aligned graphic and convert it to an audio wave. Does that sound like a possibility?
If that works at a very small scale (legal sized paper), it will most likely produce an extremely brief "blip" at most, unless I dramatically slow the rate down before the playback of the audio. Just to be able to hear it for more than a fraction of a second would be ideal.
If I wanted to scan something at a larger scale, I am limiting my options as the image gets larger. I wonder if there is something like a fax machine where a really long piece of paper could be imput into it and the image could be scanned in that manner? Maybe I could scan the image that way on it's finest resolution and fax the data to my computer? Never tried to fax my computer before. Maybe a Ham Radio Operator could advise me?
Hmmmmm.......
-
August 19th, 2005, 02:51 PM
#28
Re: How to Convert txt or image file into sound waves
 Originally Posted by dorseydevice
...Now once I have the PNG file, a program such as SoundForge might be able to import the balanced and aligned graphic and convert it to an audio wave. Does that sound like a possibility?...
Nope. Audio editors don't work that way. They use audio file types, not images, though the user interface of such programs essentially does the opposite, which is showing the audio as a waveform on a graph.
This is certainly a matter of programming, since there isn't software available to do it for you. I'd really suggest drawing the waveform on the computer. That will save a whole lot of trouble. I find a graphics tablet far easier to control than a mouse. Still, it will take practice to get usable results. Probably more frustrating and time-consuming than learning to play an instrument.
Audio editors will come in handy at some point though, like for filtering and applying envelopes. It would be a lot easier to apply tremolo after you're done drawing than to actually draw it that way.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
August 19th, 2005, 02:54 PM
#29
Re: How to Convert txt or image file into sound waves
SoundForge?? Mmmm might be able to import a png, but I haven't heard of it doing such a thing.
Mike
-
August 22nd, 2005, 05:00 AM
#30
Re: How to Convert txt or image file into sound waves
Just a small thought on this...
why not forget about what type of document you are looking at ...
use the raw file.. ????.jpg, ????.txt ???.doc.
now start your sound on a unique note ( or string of notes ), this is your start key..
Playout all the respective bytes from the file ( using a prebuilt array of note sounds for each byte), all of a fixed length + maybe a timing code to keep it in sync.
Then end off with a unique end of note key..
on the reciever side .. you now have a start -- data --- end chain of sound comming through.
decode and you have the raw file again ..
like i said, just a small thought..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|