CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    Question 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...

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    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?
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  3. #3
    Join Date
    Dec 2001
    Posts
    6,332

    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?
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  4. #4
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    Exclamation 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
    Last edited by mynick; July 14th, 2005 at 03:22 AM.

  5. #5
    Join Date
    Jun 2005
    Posts
    60

    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
    Last edited by sergelac; July 14th, 2005 at 05:00 AM.

  6. #6
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    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.
    Last edited by Pinky98; July 14th, 2005 at 06:18 AM.
    Mike

  7. #7
    Join Date
    Dec 2001
    Posts
    6,332

    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.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  8. #8
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    Thumbs up 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...

  9. #9
    Join Date
    Dec 2001
    Posts
    6,332

    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)
    Last edited by WizBang; July 16th, 2005 at 06:50 PM. Reason: Delayed Epiphany
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  10. #10
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    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...
    Mike

  11. #11
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    Talking 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

  12. #12
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    Talking 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 .....!!!!!!!!!!

  13. #13
    Join Date
    Dec 2001
    Posts
    6,332

    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!
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  14. #14
    Join Date
    Jun 2005
    Location
    gandhinagar,gujarat
    Posts
    51

    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

  15. #15
    Join Date
    Dec 2001
    Posts
    6,332

    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
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured