-
How to Convert txt or image file into sound waves
Hello friends...
I am going to start a new project (offcource for my personal interest) and as I know vb so I prefere to develope it in vb6.0
My project is to convert a txt file or a image file in to wave file
In simple I want to develope a programm that convert a TXT file into sound file reading its line one by one and generate perticular sound for a perticular character including all other character like ( ,),#,@, space etc
And other target is, program should scan(not in scanner !!!) a image file from top to bottom and convert it into waveform i.e it should sound different for each pixel
And vice-versa i.e if we input this converted sound through microphon it should convert back it into txt or image what may be the case....
plsease suggest the way or any control that i can start this as soon as possible
I think this would be the uniq thread in this site...
please do something my friends...
-
Re: How to Convert txt or image file into sound waves
why dont you just dial the internet, then pick up another phone on the same line and put it to your ear?
-
Re: How to Convert txt or image file into sound waves
Tisk, tisk cjard...
What you describe seems similar to something Creative Labs did called "SoundFont". It basically allows a sort of text file to be heard like a person speaking, but I think the text is not like we normally type. Are you trying to develope a text-to-speech engine of some kind?
As for the image file, would the sounds actually be recognizable as something, or just different tones for each of the 16 million colors?
-
Re: How to Convert txt or image file into sound waves
first of all tx who even reply for this thread
Cjard you should think over the thread first....
Sorry , I know how text-to-speech works ,i had used it also...
My project is different .when program scan the text or asccii files it sounds in different frequney tone for diffrent charector... the only purpose is to put this sound on wireless and one can get back that txt file conevrting the sound in to text...
the same for Image files...Programm shound scan picture top to bottom or left to right all its pixcel should convert in specific rythamic tone..this tone may be converted back in to image....
now is it clear Cjard...?
Tx wizbank ,hoping reply
-
Re: How to Convert txt or image file into sound waves
Quote:
Originally Posted by WizBang
What you describe seems similar to something Creative Labs did called "SoundFont". It basically allows a sort of text file to be heard like a person speaking
Creative Labs called it "text-to-speech"
and used it in the program "DR. Sbaitso" (Sound Blaster Acting Intelligence Text to Speech Operator)
the voice of DR. Sbaitso sounded better than the current windowsXP text-to-speech
SoundFont are for playing .MID files : http://www.soundblaster.com/soundfont/faqs
-
Re: How to Convert txt or image file into sound waves
He doesn't want a text to speech system he wants a modulator (and to get the sound back a demodulator).
mynick... make a series of sounds (probably best to vary frequency only, not phase nor amplitude), and store them in memory. Create a map to link each ascii character to a particular memory location where the sound is stored.
For the sounds I would store a pure frequency of several cycles each (you could possibly only store one cycle and repeat it if required). The longer you make the sample the better.
Start all samples in the same way... e.g. from the zero crossing on a increasing slope:
Code:
AlwaysStore this:
_ _ _
/ \ / \ / \
\_/ \_/ \_/
But DONT store it like this:
_ _ _
/ \ / \ / \
/ \_/ \_/ \_
NOR this:
_ _ _
/ \ / \ / \
\_/ \_/ \_/
(Not the different starting points)
(For best results apply a window to the wave sample such as a "boxcar" or "gaussian" rather than a simple square... If you have no idea what I just said then not worry about it.)
To generate the sounds select a sampling frequency (typically 44K, 22K or 11K...). Use a simply sin function to generate points on the wave at the selected frequency and store this in the memory. Store a fixed TIME of the sample not a fixed number of cycles (i.e. higher frequencies have more cycle stored than lower ones). Keep the frequency of each wave between 50 Hz and half the sampling frequency.
Try if possible to prevent any two characters from having frequencies which are whole number multiples of each other (easier for demodulating).
Then open a text file and for each character add append the corresponding wave sample to a file. Add a .wav header describing the waves properties and your done.
Note: This may give you lots of "clicks" between characters. That can be solved selecting a good windowing function.
BTW I would not recomend VB... rather use C++, since you are using memory buffers and pointers.
-
Re: How to Convert txt or image file into sound waves
Quote:
Originally Posted by sergelac
Creative Labs called it "text-to-speech"
and used it in the program "DR. Sbaitso" (Sound Blaster Acting Intelligence Text to Speech Operator)
the voice of DR. Sbaitso sounded better than the current windowsXP text-to-speech
SoundFont are for playing .MID files :
http://www.soundblaster.com/soundfont/faqs
Oooops...You are correct. I guess the word "font" threw me. Anyway they had (or have) stuff for reading some sort of text files with synthesized speech, as you noted. I know there's something called "Texto'LE". But, it seems mynick isn't looking to do anything like that.
Pinky98: Why create sounds in memory? DirectX can be used to make all sorts of sounds, so I might do it with that. Then the tones would be created on-the-fly.
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. A modem uses PCM, which is probably a good choice in this case as well, so you'd essentially be reinventing the modem. The comment made by cjard, though in jest, may not be as far off as it seems. You could use an ordinary modem on each end, with the wireless part instead of the phone cable to link the two.
-
Re: How to Convert txt or image file into sound waves
Tx to Pnky98,Sergelac and ofcource winbang....
I vary much impressed of pinky98 who has given vary discriptive answer with drwaing
First of all I should clear why I need this programm.I am a Ham radio Operator having Gr-II licenese of Govt. And that is the licence to operate VHF as well as HF wireless equipment and I have cleared the exam and prctical test..
I m clearinging this here beacause one can give hi/her reply keeping in mind the above fact..
I think Pinky98 is vary much understood the question and offcource Winbang also...AS per as this project is concered I have a flow chrt in my mind how to start this project..AS i have seen and used many best programs for digital communication (like packet radio..sstv. etc) but I want to make a simple one that any one can configure a programm vary easily,
Winbang aand Cjard ...ya there are many medem thouse works on COM ports.. but I want to convert this files (txt and jpg or bmp) into sound ..so that i can simply transmit it through Radio...I have a hardware to connect a PC to wireless equipment...
As i think that i should declere or store in memeory, a different tone for each charector and readling a txt file it would sound diffrently but in specific rythom....
so , pls give me some code sample how to generate diffrent tone frquency...
-
Re: How to Convert txt or image file into sound waves
Ah!! Now we're talking!!
Well, the frequency range is even more narrow for Ham radio. However, are you planning to use SSB or ESSB? At most ESSB would give you a range of 50 Hz ~ 6.05 kHz. I really recommend using a modem for this, as the bandwidth for standard telephony is well within the range of ESSB. As for standard SSB, this might give a few problems, since it's a bit less than the telephone bandwidth of 180 Hz to 3.2 kHz, even at its widest specification. This is of course if you intend to use the full spectrum, as in 56k.
I see no technical reason why it would not work, though there may be certain problems/limitations due to phase shifting. The biggest hurdle might be the handshaking that must occur before the actual transmission, though I seem to recall a protocol that lets you send without waiting for a response from the receiving end. If that's true, then I'd try that. You could test with two transceivers: one for sending, and one for receive. Have you tried sending a fax transmission over ESSB? That might be my first test. I might be inclined to manually switch between send and receive during handshaking, just to see it work. Obviously, requiring two channels is really not an option.
Yes, a modem is definitely the way to go. Then anyone with a modem would be able to use your software. With a small adapter, hooking up to the modem on the PC is easy. This idea is not new of course. It has been done for years before windows and 56k came along.
<EDIT>
Oh boy! This takes the idea of P2P to a whole new level :) Ham radio has been on the decline, but if people start getting the idea to create their own wireless internet via Ham Radio, that just opens up a whole new world. Imagine the RIAA triangulating on someone's Ham signal LOL. (I'm not suggesting this though)
-
Re: How to Convert txt or image file into sound waves
Quote:
Originally Posted by WizBang
Pinky98: Why create sounds in memory? DirectX can be used to make all sorts of sounds, so I might do it with that. Then the tones would be created on-the-fly.
True... I was simply thinking of speed. If you have to calculate the sounds each time it would be slower that calculating the sin wave each time... But of course with Dx frequency production is a sinch (didn't think of using it)! But then everyon using this has to have Dx...
-
Re: How to Convert txt or image file into sound waves
Tx to all who replied to this thread
It might be known to you both that ham radio is the basis of intenet.. Actualy before intenet came ham radio operator were used the wireless network to send txt and images . So,ham radio is the pioneer of Intenet.
Ok, as you talked the problem of hand shaking of two pcs via wireless. But here i want to tell that i have used this type of many softwres successfuly and it doesnot have any probelm..The only difference is i used a hardware to connect the soundcard of PC to wireless and it works fine to transmit and receive..It works fine ,,But the software used are deep configurable and new ham operator might not ne configure each and every setup in the software...So, I want to develope a simple and easy configurable software in VB .
AND I again repeat is that I want to know how to create sound using VB6 ...and than i will do the whole juglarry.....lol
tx alll again
-
Re: How to Convert txt or image file into sound waves
I can generate "ding dong" like sound but i want to generte diffrent tone of diffrent frequency for diffrent character
no help from gurus .....!!!!!!!!!!
-
Re: How to Convert txt or image file into sound waves
You **could** use the Ascii value of each character (8 bit byte), and a simple routine to equate to a unique frequency. That's a total of 256 individually distinguishable tones. There are spectrum analyzer/oscilloscope/tone generator examples on PlanetSourceCode.com which you could use as a starting point.
However, as I stated before, it would be far better to use existing modem technology. There are good reasons why data isn't sent down the phone lines in the way you describe. It's not just a matter of frequencies for bytes. Consider the S/N ratio of HAM just for starters. Even if you get it to work, it will be quite slow. Though a good learning experience, and perhaps a lot of fun, the method you seek is impractical. From your descriptions it seems like you are looking for something others would want to use, even purchase. Please understand that I'm not trying to put down the concept. In fact, I've tinkered with a number of things along these lines. Transmitters, receivers, companders, etc, using ultasonics, Infrared, and basically all over the radio spectrum. It's great fun, but in a practical application, you'd need better (if you even get it to work that way). I'm simply pointing out a far more viable solution, trying to save you trouble.
A modem already does the toughest parts for you. I'm fairly certain I've used some modem protocol to send data without waiting for a reply. This could work in your application, and the modem wouldn't even know there wasn't a phone line.
Whatever you do with this, good luck and of course have fun!
-
Re: How to Convert txt or image file into sound waves
tx wizbang
ya i have download a tonegenerater from the site wich you have mentioned..but as i have stated earlier that it generate only "ding dong" typle tone...
one more thing i want to clear that though i m an civil engineer i am also a electronics hobbiest. if you surf hamradio site ,for digital communication now a days soundcard interfaces are available and any one can purchase or can make himself olso.That is why i am using soundcard interface which is made by me..Ok i have no deep knowledge of vb in this direction i have to follow others.. I think you have done more works on this filed of ellectronics you will be the better guide in this subject..As you told that as my requirement is diffretnt rather non-practical but there is so many software available of didgital communaation vis sound siganl...
I DONT KNOW WHERE SHOULD I STOP....LOL
-
Re: How to Convert txt or image file into sound waves
There are certainly methods which use the sound card, but they are very limited in baud rate. With all the methods which have been devised, I see no point in inventing yet another which suffers from the same problems and limitations. Perhaps now with ESSB, the speed can be increased, which is the main basis of what I'm suggesting.
It just seems that the methods simply have not kept up with the technology. The one thing I can't be sure of without serious investigation, is whether the phase shifting of ESSB would be too large a problem.
In any case, the currently available methods essentially use the same techniques that standard modems already do very well. The advantage of using a modem however, is that the difficult parts are already done. Much more time and money has been spent on telephony modems than all the hams in the world combined. I see no reason not to take advantage of all that research. Here is a link to a site detailing various methods of digital Ham radio: http://home.teleport.com/~nb6z/about.htm
-
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
-
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.
-
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
-
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.
-
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.
-
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".
-
Re: How to Convert txt or image file into sound waves
Quote:
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 ;)
-
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.
-
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!
-
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.
-
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.
-
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.......
-
Re: How to Convert txt or image file into sound waves
Quote:
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.
-
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.
-
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..
-
Re: How to Convert txt or image file into sound waves
I guess I thought that there was an existing technology that would allow me to output this image as a sound once I had it scanned and alighned, etc... I'm rethinking this and I think I have an idea that I'll have to discuss with an old school audio specialist. I think I might need some 1970's technology to do this.... I'll keep you posted with any progress. I apreciate all your help as this has been a great source for information.
Talk to you soon.