SupportTeam Report post Posted 09/03/2003 04:13 AM A number of users in countries where a language other then English is spoken have commented that they are unable to use the Say Number module to speak amounts -as even after re-recording the sound files in the \voice\ directory the grammar differences in the other language are sufficiently different to that of English that the spoken amounts do not sound acceptable. The solution is to have a Run VBScript module create list of WAV files to be played and then use a Play module to just play that list of Wav files. The VBScript which generates a list of comma separated WAV files given a numeric amount to be spoken is below. Right now it generates a list of Wavs to be spoken according to English number pronunciation rules. Adapting it to pronounce other languages should be relatively straightforward - and if you are having problems with it please drop us a line and we'll try to assist. set VG = CreateObject("VoiceGuide.CommandLink") sWavsToPlay = Amount2WavList($RV[GetAmountToSpeak]) vg.Run_ResultReturn $RV_LINEID, "[WavsToPlay]{" & sWavsToPlay & "}" set VG = Nothing Function Amount2WavList(ByVal AmountToSay) Dim sDollars_WavList, sCents_WavList, s3_WavList Dim iDecimalPlacePos, iCount ReDim Place(9) As String Place(2) = "thousand.wav" Place(3) = "million.wav" Place(4) = "billion.wav" Place(5) = "trillion.wav" ' String representation of amount AmountToSay = Trim(Str(AmountToSay)) ' Position of decimal place 0 if none iDecimalPlacePos = InStr(AmountToSay, ".") 'Convert sCents_WavList and set AmountToSay to dollar amount If iDecimalPlacePos > 0 Then sCents_WavList = GetTens(Left(Mid(AmountToSay, iDecimalPlacePos + 1) & "00", 2)) AmountToSay = Trim(Left(AmountToSay, iDecimalPlacePos - 1)) End If iCount = 1 Do While AmountToSay <> "" s3_WavList = GetHundreds(Right(AmountToSay, 3)) If s3_WavList <> "" Then If iCount > 1 Then s3_WavList = s3_WavList & "," & Place(iCount) End If If sDollars_WavList = "" Then sDollars_WavList = s3_WavList Else sDollars_WavList = s3_WavList & "," & sDollars_WavList End If End If If Len(AmountToSay) > 3 Then AmountToSay = Left(AmountToSay, Len(AmountToSay) - 3) Else AmountToSay = "" End If iCount = iCount + 1 Loop Select Case sDollars_WavList Case "" sDollars_WavList = "0.wav,dollars.wav" Case Else sDollars_WavList = sDollars_WavList & ",dollars.wav" End Select Select Case sCents_WavList Case "" sCents_WavList = "0.wav,cents.wav" Case Else sCents_WavList = sCents_WavList & ",cents.wav" End Select Amount2WavList = sDollars_WavList & ",and.wav," & sCents_WavList End Function '******************************************* ' Converts a number from 100-999 into text * '******************************************* Function GetHundreds(ByVal AmountToSay) Dim Result As String Dim s2_WavList As String If Val(AmountToSay) = 0 Then Exit Function End If AmountToSay = Right("000" & AmountToSay, 3) 'Convert the hundreds place If Mid(AmountToSay, 1, 1) <> "0" Then Result = GetDigit(Mid(AmountToSay, 1, 1)) & ",hundred.wav" End If 'Convert the tens and ones place If Mid(AmountToSay, 2, 1) <> "0" Then s2_WavList = GetTens(Mid(AmountToSay, 2)) Else s2_WavList = GetDigit(Mid(AmountToSay, 3)) End If If Result = "" Then Result = s2_WavList Else Result = Result & "," & s2_WavList End If GetHundreds = Result End Function '********************************************* ' Converts a number from 10 to 99 into text. * '********************************************* Function GetTens(TensText) Dim Result As String Dim sDigitWav As String Result = "" 'null out the s3_WavListorary function value If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19 Select Case Val(TensText) Case 10: Result = "10.wav" Case 11: Result = "11.wav" Case 12: Result = "12.wav" Case 13: Result = "13.wav" Case 14: Result = "14.wav" Case 15: Result = "15.wav" Case 16: Result = "16.wav" Case 17: Result = "17.wav" Case 18: Result = "18.wav" Case 19: Result = "19.wav" Case Else End Select Else ' If value between 20-99 Select Case Val(Left(TensText, 1)) Case 2: Result = "20.wav" Case 3: Result = "30.wav" Case 4: Result = "40.wav" Case 5: Result = "50.wav" Case 6: Result = "60.wav" Case 7: Result = "70.wav" Case 8: Result = "80.wav" Case 9: Result = "90.wav" Case Else End Select sDigitWav = GetDigit(Right(TensText, 1)) 'Retrieve ones place If sDigitWav <> "" Then If Result = "" Then Result = sDigitWav Else Result = Result & "," & sDigitWav End If End If End If GetTens = Result End Function '******************************************* ' Converts a number from 1 to 9 into text. * '******************************************* Function GetDigit(Digit) Select Case Val(Digit) Case 1: GetDigit = "1.wav" Case 2: GetDigit = "2.wav" Case 3: GetDigit = "3.wav" Case 4: GetDigit = "4.wav" Case 5: GetDigit = "5.wav" Case 6: GetDigit = "6.wav" Case 7: GetDigit = "7.wav" Case 8: GetDigit = "8.wav" Case 9: GetDigit = "9.wav" Case Else: GetDigit = "" End Select End Function Attached at end of this post is an Excel Spreadsheet which has the above VB script in it's VBA module, and it can be used to easily test how different numbers will result in different lists of WAVs to be played. Its a good way of testing any modifications to the VB Script as well, when modifying the function to suit other language grammar. Here is a transcript of what the Excel Spreadsheet will show: Amount->WAV files converter test 0 0.wav,dollars.wav,and.wav,0.wav,cents.wav 0.02 0.wav,dollars.wav,and.wav,2.wav,cents.wav 0.18 0.wav,dollars.wav,and.wav,18.wav,cents.wav 0.55 0.wav,dollars.wav,and.wav,50.wav,5.wav,cents.wav 0.7 0.wav,dollars.wav,and.wav,70.wav,cents.wav 1.00 1.wav,dollars.wav,and.wav,0.wav,cents.wav 13 13.wav,dollars.wav,and.wav,0.wav,cents.wav 67 60.wav,7.wav,dollars.wav,and.wav,0.wav,cents.wav 123 1.wav,hundred.wav,20.wav,3.wav,dollars.wav,and.wav,0.wav,cents.wav 1234 1.wav,thousand.wav,2.wav,hundred.wav,30.wav,4.wav,dollars.wav,and.wav,0.wav,cent .wav 12345 12.wav,thousand.wav,3.wav,hundred.wav,40.wav,5.wav,dollars.wav,and.wav,0.wav,cen s.wav Please ensure you have Macros enabled when loading the Excel spreadsheet below - they need to be enabled in order for the VBS scripting to work... Amount2Wav.xls Share this post Link to post
Guest Guest_Rajendra Prasad Report post Posted 09/08/2003 09:55 AM Sir, I've written a code in VB 6.0 to convert Indian number system to wors. It is working fine even with in VoiceGuide. Those who wants the code may contact to me at rajendrarajsri@yahoo.co.in Share this post Link to post
Guest Emre DURGUT Report post Posted 02/16/2004 07:46 AM Add below lines before Do While loop for Turkish Numbers 'One Thousand And One Hundred Control if AmountToSay = "1000" Then sDollars_WavList="thousand.wav" AmountToSay = "" End if if AmountToSay = "100" Then sDollars_WavList="hundred.wav" AmountToSay = "" End if Share this post Link to post
SupportTeam Report post Posted 02/16/2004 07:58 AM These days the "Say Number" module uses the VB Script functions in file lib_num2wav.vbs to generate the list of sound files to be spoken - if changing the way numbers are spoken are required - or if you want to add your own "Say Number" functions then you should edit the lib_num2wav.vbs file. Its best to just add your own Say Number functions to the lib_num2wav.vbs file - that way the new functions will then be visible and selectable in the Script Designer as well! lib_num2wav.vbs can be found in VoiceGuide's \system\vbs\ subdirectory. Share this post Link to post
Guest Murat Selim Ozturk Report post Posted 02/17/2004 08:04 AM To add Turkish support to VoiceGuide 5.1.7 I needed to change lib_num2wav.vbs as the following: It does not solve "1000" problem, but it solves the problem with the numbers 123422, 9122400 and also 100 as well. (Having 1 at the third digit of the digit group of the number) '******************************************** ' Converts a number from 100-999 into .Wavs * '******************************************** Function hundreds2wav(ByVal AmountToSay) If Cint(AmountToSay) = 0 Then Exit Function End If AmountToSay = Right("000" & AmountToSay, 3) 'Convert the hundreds place If Mid(AmountToSay, 1, 1) <> "0" Then If Mid(AmountToSay, 1, 1) <> "1" Then Result = digit2wav(Mid(AmountToSay, 1, 1)) & ",hundred.wav" Else Result = "hundred.wav" End If End If 'Convert the tens and ones place If Mid(AmountToSay, 2, 1) <> "0" Then s2_WavList = tens2wav(Mid(AmountToSay, 2)) Else s2_WavList = digit2wav(Mid(AmountToSay, 3)) End If If Result = "" Then Result = s2_WavList Else Result = Result & "," & s2_WavList End If hundreds2wav = Result End Function Share this post Link to post
Guest fsoudbakhsh Report post Posted 09/28/2004 01:25 AM I am designing multiple languages VG voice to be play by one script. I was successful to play the sound files per caller choose. But the numbers still are in English. To change the numbers to the language that caller chooses I can not modify lib_num2wav.vbs. Because lib_num2wav.vbs is common directory for VG script to access to one language of wav files. Can we have more then one lib_num2wav.vbs directory and some how redirect the VG script to pick the lib_num2wav.vbs from selected path? If we can not do that, How can we adapting VB script to pronounce other languages numbers? should we record the sound files first? If we should do that, where should we save them, that VB script can access them and use them? Please also let me know how I can modify the VB script to also say the number not the dollar only! Thanks Farzad Share this post Link to post
SupportTeam Report post Posted 09/28/2004 01:42 AM You should create within lib_num2wav.vbs a function for each of the language that you are using, and then from within the script have separate 'Say Number' modules for each of the languages. Alternatively you could just use one VBScript module and program it to say the right number depending on what language is used by caller... Share this post Link to post
Guest fsoudbakhsh Report post Posted 09/28/2004 04:46 AM still I don't know how can I adapting VB script to pronounce other languages numbers? should we record the sound files first? If we should do that, where should we save them, that VB script can access them and use them? Please also let me know how I can modify the VB script to also say the number not the dollar only! Thanks Farzad Share this post Link to post
Guest fsoudbakhsh Report post Posted 10/01/2004 05:42 PM I haven't received any response for my previous question. here is the question again. still I don't know how can I adapting VB script to pronounce other languages numbers? should we record the sound files first? If we should do that, where should we save them, that VB script can access them and use them? Please also let me know how I can modify the VB script to also say the number not the dollar only! Thanks Farzad Share this post Link to post
SupportTeam Report post Posted 10/01/2004 09:13 PM You can basically write your own version of the functions contained in the lib_num2wav.vbs file and call them from within the VBScript module. If you do that then the sound files should be in your script's directory. Share this post Link to post
Guest fsoudbakhsh Report post Posted 10/05/2004 06:06 AM I test this code with VG script. but I got error at line: 11, char: 19 error: Expected end of statement. I have no experience in VB script. Do you have any advice to resolves this problem? Share this post Link to post
Guest fsoudbakhsh Report post Posted 10/07/2004 04:37 AM I haven't got any response for my question. would you please answer to this question? I test this code with VG script. but I got error at line: 11, char: 19 error: Expected end of statement. I have no experience in VB script. Do you have any advice to resolves this problem? Share this post Link to post
SupportTeam Report post Posted 10/07/2004 11:31 PM To modify the lib_num2wav.vbs VBScript file you should know VBScript. I'd recommend asking a programmer to do the modifications that you require for you. Share this post Link to post
Guest Leonardo Prieto Report post Posted 06/18/2005 04:27 AM yo compre VoiceGuide, por internet la semana pasada, y todo esta en ingles, me gustaria saber si ustedes tienen el manual de usuario en español y donde o como puedo poner decir los numeros en español. Gracias Share this post Link to post
Guest Rajendrarajsri@yahoo.co.in Report post Posted 06/23/2005 04:12 AM Hello Friend, Please fire your problem in "English" so that I can help you. I've resolve this type of problem. Rajendrarajsri@yahoo.co.in Share this post Link to post
Guest fsoudbakhsh Report post Posted 06/23/2005 04:24 PM I have solved this problem. thanks eveyone who try to help me. Share this post Link to post
XOLimited Report post Posted 02/01/2007 03:12 AM Could someone possibly send me the Excel spreadsheet. It is not allowing me to download it. Thanks Tim tim.gordon@xolimited.com Share this post Link to post
SupportTeam Report post Posted 02/01/2007 05:21 AM Here is the Excel file. Basically it's just running the VBScript which is in the lib_num2wav.vbs file - I think the Excel file has an old version of the lib_num2wav.vbs, yo should update it with latest version to see how the current version behaves. Amount2Wav.zip Share this post Link to post