Home Questions Query about dynamic generating sounds

Query about dynamic generating sounds

DWQA QuestionsCategory: Custom Task DevelopmentQuery about dynamic generating sounds
Hi, I am using the Tone player simulink model to generate sounds. But, in my task, the participant is required to follow a track and if the participant deviates from the task, i want a sound signal to keep beeping until the participant gets back into the track. And this should continue till the end of the task until they reach the end of the track. But, the problem that i am facing is that the trigger subsystem in the Tone player model which contains the blocks responsible for the sending the signals gets activated once and then stops. And if i put it in a loop in stateflow then it stays activated and generates sound even when the participant is inside the track. How do i turn on and turn off sound generation subsystem when i need to? Please let me know. Regards, Yokhesh
1 Answers
Duncan McLean Staff answered 3 years ago
Hi Yokhesh, Parallel states in Stateflow will accomplish what you want. MATLAB has lots of documentation on how parallel states work. The quick version is:
  1. Create a large state to contain the parallel sub states
  2. Right click the state and set the decomposition to "AND (parallel)"
  3. Add 2 large "sub states"
  4. The main task logic will be in one of the sub states, the other will be the tone playing system
  5. In the main task logic you can trigger the tone playing states to enter or exit the tone playing state
  6. The tone playing state would need to use the "duration" of the tone to wait in between the e_Play_Tone events
I hope that helps. Please let us know if we can provide any more information. All the best, Duncan