01-04-2012 03:23 PM
Hello All,
I am writing a message board for a test sequence, and I would like to have a timer audio countdown using the text-to-speech (TTS) functions.
Im sorry that I cannot post my code as it exists right now, but here's what Im trying to do:
I have a main loop with an elapsed timer (producer I think), and I have an event structure with the text to speech functions (consumer).
In the main loop, I subtract the elapsed time from the time target to get the time remaining in step. When the time remaining in step reaches values 5, 4, 3, 2, and 1, I want to trigger an event at each to get the text to speech to say the numbers.
I have the text to speech working. I am able to get the main loop to send the different text values to the TTS module. I have tried several methods to trigger the 5 discrete events with no luck. I am always able to trigger the first event, but I think the conditions I set to trigger the event are true for several loops (like 5<elapsed time<4.9), and the events get stored in the queue and each execute. So, starting at the 5 count, I hear "Five, Five, Five..." all while the elapsed timer is counting down, and the other events are happening (4<elapsed time<3.9, 3<elapsed time<2.9, etc).
I hope the question and my progress are clear, sorry again for not being able to post my code.
Thanks,
Carlos
01-04-2012 05:49 PM
Sounds like you just need to refine your criteria for triggering the event. One possible solution: whenever you trigger an event, update a value (in a shift register around the producer loop) that indicates what the most recent event fired was, and only fire an event if it's not equal to the event that was most recently fired. So you might store a value of 5 after triggering the 5 event. When you reach the criteria for the 4 event, 4 != 5, so that event will trigger and you'll store the value 4.
If you can't get it working on your own, you'll be more likely to get good help if you post a simplified version of your code. I would think you could take out the text-to-speech bit and replace it with something else (even a string indicator), and create a simple VI containing only a producer loop with the timer as you have it implemented, and a consumer loop with an event structure.
01-11-2012 01:22 PM
Nathand,
Thank you for the reply. That is a good suggestion triggering off of a changed value in a shift register. I think I can make that work. Thank you very much.