I have created a point-to-point reaching task and would like to have a sound effect play when the end target is reached. I have tried a couple of different methods (e.g. (1) creating a triggered subsystem that uses the ‘from media file’ and ‘to audio device’ blocks, (2) using the Matlab functions ‘wavread’ and ‘sound’ in an embedded Matlab function block), but have not been successful in getting any of those to work. I am wondering if anyone has been able to implement sound effects in their tasks?
There are a couple of ways to make sounds happen during your task. The best approach will depend on:
a) how real-time does the sound need to be
b) what complexity of sound do you want
If you look in the forums there is a tone player demo. This is a non-real-time sound player where you run a program on the GUI computer that listens for commands from the real-time computer.
You can make use of the Analog outputs on the NI card in your system as well. You would need to connect one of the analog outputs on the B-Box to an amplifier. I’m told these are not the best sounds.
You can also purchase and install real-time compatible sound cards. You will need to look in the Simulink library under xPC Target->Audio to find the cards that are supported. I’ve known of one person who has gone down this path with success.
Let me know if you need more help. Cheers!
As an update to this issue – there is now a real-time sound demo task that makes use of the NI card. The task can be found under Sample Custom Tasks.