convert file

  • 13 years ago

    hi!

    I have a morse application, so I want to convert file text morse code into wav file. Pls help me. How can i convert text file to wav file.

  • 13 years ago

    The hard way is to keep a list of morse code in your program, and then try to play two dots and a dash for one letter, a dash for another, and so on.

     There are 3 thinsg you need to do to get this to work:

    a) A section that opens the text file, and processes it one letter at a time.

    b) A folder full of ready made WAVS - one for each letter

    c) Code to play the WAVS

     

    Assuming you have read the file into a string, and you work though the string letter by letter, just play the WAV which has the same name as the letter.

    (A.WAV, N.WAV, T.WAV... and so on)

    The code to play a WAV file is

     

      Private Declare Auto Function PlaySound Lib "winmm.dll" _
        (ByVal lpszSoundName As String, ByVal hModule As Integer, _
         ByVal dwFlags As Integer) As Integer

        Private Const SND_FILENAME As Integer = &H20000

     

    Public Function PlayWav(ByVal fileFullPath As String) _
            As Boolean

            'return true if successful, false if otherwise
            Dim bAns As Boolean, iRet As Integer = 0

            Try

                iRet = PlaySound(fileFullPath, 0, SND_FILENAME)

            Catch

            End Try
     
           Return iRet

        End Function   

     

     

     

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are 10 types of people in the world, those who can read binary, and those who can't.”