Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Is it possible to create 'beep' sound from within c-mex s-function?

Subject: Is it possible to create 'beep' sound from within c-mex s-function?

From: Kate J.

Date: 6 Jul, 2013 03:26:14

Message: 1 of 3

I have a c-mex s-function that I would like to generate a beep (or similar warning/alert sound) as a user interacts with it. The regular Matlab 'beep' command causes an error when compiled. From my searches, I see that this has been asked by others previously, but I haven't encountered any answers to this question. I don't see this issue mentioned in the Matlab documentation.

I believe it also may be possible to play a .wav or other audio file on command, if a simple beep function/sound isn't available; however, my searches of the documentation haven't revealed how to do this, either.

Thanks in advance for your help!

Subject: Is it possible to create 'beep' sound from within c-mex s-function?

From: Phil Goddard

Date: 6 Jul, 2013 13:53:09

Message: 2 of 3

If you're on Windows then you can create your own beep.
Just
include <windows.h>

and then use the function
Beep(Frequency, duration)

Something like
Beep(750,100)
is similar to the standard beep.

Phil.

Subject: Is it possible to create 'beep' sound from within c-mex s-function?

From: Kate J.

Date: 7 Jul, 2013 18:23:11

Message: 3 of 3

Thanks for your help, Phil. The windows Beep() function works nicely!

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us