Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Speech Application Results from an SQL Server

Posted on 2006-03-21
8
Medium Priority
?
282 Views
Last Modified: 2010-04-16
I am trying to find the best way to retrieve results from an SQL query and read the results back to the caller. They would input their information and it would query the database and check for a record, and if a record existed, read the record back to them. How would this be done? I know ADO.NET, so the actual select clause doesnt matter, the problem I'm having is passing my results back to the speech application as an answer to the customer.
0
Comment
Question by:N2hockey19
  • 3
  • 3
7 Comments
 
LVL 12

Expert Comment

by:AGBrown
ID: 16253331
Do you have a speech application that you are using? Or do you need to find one? There is a TTS (text to speech) audio handler distributed with the windows OS. You can create a reference to it from the COM library "Microsoft Speech Object Library" through Visual Studio, or a similar application.

There is also a speech SDK on MSDN to help with things like this, and, for what it's worth, there will be even more extensive support in Vista for all of this.
http://msdn.microsoft.com/academic/techdown/techprod/speech/default.aspx

Andy

PS here is a code example for the TTS:

      SpVoice myVoice = new SpVoice();
      ISpeechObjectTokens voices = myVoice.GetVoices(string.Empty, string.Empty);
      myVoice.Voice = voices.Item(0); // just use the first voice returned
      SpAudioFormatClass format = new SpAudioFormatClass();
      format.Type = SpeechAudioFormatType.SAFT11kHz16BitMono; // play with the file types to trade off compression and quality
      mySpeechFileStream.Format = format;

      //      this has to be done using an output stream, so open it and get it ready
      mySpeechFileStream = new SpFileStream();
      mySpeechFileStream.Open(audioFileNameAndPath, SpeechStreamFileMode.SSFMCreateForWrite, false);
      myVoice.AudioOutputStream = mySpeechFileStream;
      myVoice.Speak(stringOfTextToSpeak, SpeechVoiceSpeakFlags.SVSFlagsAsync);
      myVoice.Rate = -5;
      myVoice.WaitUntilDone(System.Threading.Timeout.Infinite);

From some recent research I did, I think there's also a HIP code example on MSDN that uses this (just search HIP in MSDN and you'll find it)
0
 

Author Comment

by:N2hockey19
ID: 16253400
Sorry, forgot to add and remembered while I was on the road. I'm using Microsoft Speech Server 2004 Standard with SASDK 1.1. I am trying to create a simple application where the user enters information through a DTMF setup using the information they provide, and the application return the first record to them. I have QA and Natural number controls. I want to take the semantic items and insert them into a select statement to find their record, then return the result back. Building the select statement is easy, but how to get a prompt or QA control to read that result back has got me confused. Can the result be assigned to a variable in the codebehind and then accessed through a prompt function?
0
 
LVL 12

Expert Comment

by:AGBrown
ID: 16253409
Unfortunately I am out of my depth, and someone else needs to help you :-) Sorry. Sounds fascinating though, I'd love to play with something like this.

Andy
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:N2hockey19
ID: 16254816
I think I may have found a temporary fix. I will have to refine my code later if possible. Basically what I did was on my last prompt (a NaturalNumber prompt) was tell it to autopostback and execute a function, this function did a select statement and read the first record, this record was concatenated into a string and the string was assigned to a textbox I have. After the postback, the next QA prompt loads and references to a prompt function which gets the value (via javascript code since that is what a prompt function consists of) and returns the value back to the QA prompt control for voice output. Thats some fine e-duct tape i used. I just have to push out a beta for one of my bosses, the kinks can be ironed out in a tech review.
0
 

Author Comment

by:N2hockey19
ID: 16388924
Well, after taking off the e-duct tape and understanding the SASDK 1.1 and refining my code, I basically told the last control in the series on a page (questions page) to postback or execute a function that saved the input to Session variables and then to a Server.Transfer over to the results page, where page_load executed a function if postback is false and builds the sql query string and returns the prompt and assigns it to the InlinePrompt of the qaResults control that will say the results back to the user. I'm not sure which way is best to do, but I found my own way out of all the articles I've read (none helping me out on how to query DB data and return it in the manner I wanted.) Sara Rea's example was to build a dynamic grammar file on execute. Well, the records we store are in the hundreds of thousands and I felt that a simple select statement and a datareader to return maybe 10 results at the max was enough since its a read-only operation on the IVR end.
0
 
LVL 12

Expert Comment

by:AGBrown
ID: 16391122
It sounds like you've got a good solution then. Just to check - do you pass the variables between the two pages using Session, or using Context.Items? If you are doing Server.Transfer to get the new page, then I would definitely use Context.Items. Session will leave your data hanging around in the session, and if you have two pages posting back at the same time trying to access the same session variables, you could get strange results. Context.Items is specific to an individual Server.Transfer, and is then discarded when the transfer has returned to the client. Sometimes you need a combination of the two to ensure that the Server.Transfer has its own data, but that the "last postback wins" in the session to keep the data there for future reference.

Given that you've found a solution, I recommend you to ask the mods for this question to be PAQ'd with a refund.

Andy
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 16584901
PAQed with points refunded (250)

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question