f



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

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!
0
kmj.work (178)
7/6/2013 3:26:14 AM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
615 Views

Similar Articles

[PageSpeed] 7

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.
0
phil986 (332)
7/6/2013 1:53:09 PM
Thanks for your help, Phil. The windows Beep() function works nicely!
0
kmj.work (178)
7/7/2013 6:23:11 PM
Reply:

Similar Artilces:

Error while obtaining sizes from MEX S-function 'forward' in block 'dummy/Dynamic_Model/S-Function'. MATLAB error message:.
Hi to everybody, I created the file forward.dll using the command: mex -DWIN32 -output forward model_d.c model_s.c sdlib.c assigns.c contact.c derivs.c gmc.c impact.c inits.c invert.c lcp_solver.c lmdif_c.c mathtools.c object.c output.c pipetools.c readmuscles.c readtools.c sdfor.c spring_based.c wrapping.c gcvspl.c user_def.lib forward.lib acpp.lib qhull.lib solid.lib wrap.lib I need to run the command: set_param([subsystemname,'/','S-Function'],'function name','forward','parameters','[0],[0],[0],[0],[0],[0],[1 0 0 0 20],[0]'); ...

Is it possible to use matlab DLL's within C mex files?
We have the following: * MatlabLibrary compiled with MATLAB compiler. contaians various .m Files ==> MlGeneric.dll * C++ User library uses some functions form MlGeneric.dll as well as mx Commands and C++ code ==> void foo() ==> foo.dll * C++ application uses MlGeneric.dll, foo.dll ==> application.exe ===> We want to use foo() from foo.dll in MATLAB! ===> Idea: Create a C++ mex file and call foo() from mex gateway routine (mxFunction= ===> This works until the first call of a MATLAB function (mxGetInf() in this case) ===> What may be wrong? ===&g...

It's on-it's off-it's on, it's off -WHY?
IS THIS THE CORRECT FORUM? Hope so. We have three computer networked at home...all with Windows XP. one of those is a laptop. Some mornings all 3 can see each other and transfer files...then mysteriously one or more will disappear. No contact....then later it's back. The laptop is the worst. Most often it won't let us in...but sometimes it will. No obvious reason. The most INFURIATING part is the message "see your administrator". Dammit Bill Gates...don't you realize that most networks are small offices without a Majestic Royal Administrator sitting his i...

MatLab's 'movie' function
Hi! Using MatLab's 'movie' function you can play a movie recorded by the 'getframe' command. It is possible to specify the number of times the movie is played and the frames per second. Unfortunately, I've not found a way to stop the playback of a movie. Is it possible to, let's say I've specified the movie should be played 20 times, to disrupt the playback after an user interrupt?! Thanks a lot, Chris On Sat, 12 Feb 2005 10:40:06 +0100, Christoph ROLZ wrote: >Hi! > >Using MatLab's 'movie' function you can play a movie recorded by...

Matlab's 'graycomatrix' function
I have one question: Is Matlab's 'graycomatrix' function actually in accordance with original Haralick's 1973 paper? I mean, are they supposed to be the same algorithm? If yes, I don't think Matlab did a good job on this. For example, try it on this matrix (i.e., 'image'): 0 0 1 1 0 0 1 1 0 2 2 2 2 2 3 3 This matrix is in Haralick's original paper and the results can be compared. Can anybody ellaborate if you used it? Thank you. "Bulent Bayraktar" <bayrakta@purdue.edu> writes: > I have one question: Is Matlab's 'graycomatrix' function actually in > accordance with original Haralick's 1973 paper? > I mean, are they supposed to be the same algorithm? If yes, I don't > think Matlab did a good job on this. > > For example, try it on this matrix (i.e., 'image'): > 0 0 1 1 > 0 0 1 1 > 0 2 2 2 > 2 2 3 3 > > This matrix is in Haralick's original paper and the results can be > compared. > > Can anybody ellaborate if you used it? You do need to understand a bit about the conventions used in the software you are using. For example, the Image Processing Toolbox's default black-to-white range for double-precision inputs is [0, 1]. The reference page for graycomatrix describes in detail what it does. By default, for example, it quantizes the range [0, 1] into 8 levels, resulting in an 8-by-8 co-occurrence matrix. But for your matrix, it is seeing 5 &qu...

use 'mean' in a c-mex S-function
Hey, i have a certain outputs from a c-mex file that i need to know their mean Value before re-using them in the code.... the problem is 'mean' function is not recognized in a c-mex file... i tried to do it manually: initially sum=0; Output1= [vector]; sum=sum+Output1; mean=sum/number_of_points; problem: 1/ sum is another vector and not a single value; any suggestion would be appreciated. maybe there's a matlabmath library that recognize the 'mean' function that i should include in the code... Best Regards! CSA ...

i wonder result's difference between 'solve function' and 'circcirc function'
i calculate intersection point between two circles. first way, i used solve function. second way, i used circcirc function. By the way two way result is similar. but, The result is the same five-digit decimal. i wonder result's difference between 'solve function' and 'circcirc function' five-digit decimal. >> five decimal places On 7/11/14 7:03 AM, 김영재 wrote: > i wonder result's difference between 'solve function' and 'circcirc function' solve is much more general. Try finding the intersections between y=x^3 and y=9*x us...

MATLAB's SOUND() function in C
Is there a way to implement MATLAB's sound function under C? For those who don't use MATLAB, it's essentially a simplistic, static, mono sound function that converts a series a numbers into a sound at a given sampling rate. nothing fancy. all the Sound APIs begin by discussing all the fancy drivers and buffers and crazy shit i don't really care about. Thanks. In article <1151779016.882805.282580@d56g2000cwd.googlegroups.com>, sluox@yahoo.com wrote: > Is there a way to implement MATLAB's sound function under C? > > For those who don'...

s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii')
when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') ??? Error using ==> load Unknown text on line number 1 of ASCII file C:\Users\Lubna\matlab\2_1.wav "RIFFX". "ABC " <looma.amir.ali@gmail.com> wrote in message <jn3vqv$edk$1@newscl01ah.mathworks.com>... > when im trying to load a .wav file as ascii, im getting following error , can anybody resolve it??????? > s=load('C:\Users\Lubna\matlab\2_1.wav', '-ascii') &...

Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']?
Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']? The range() just can generate the numeric list. On Apr 9, 2007, at 3:29 AM, =E4=BA=BA=E8=A8=80=E8=90=BD=E6=97=A5=E6=98=AF=E5= =A4=A9=E6=B6=AF=EF=BC=8C=E6=9C=9B=E6=9E=81=E5=A4=A9=E6=B6=AF=E4=B8=8D=20 =E8=A7=81=E5=AE=B6 wrote: > Is there a simple function to generate a list like ['a', 'b', 'c', ... > 'z']? The range() just can generate the numeric list. import string list(string.lowercase) 人言落日是天涯,望极天涯不见家 schrieb: > Is there a simple ...

Call Matlab functions from mex (matlab function's input is string)
Here is my mex code: void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){ char errBuff[1]={'A'}; //create mxArray pointer mxArray *mxerr; //copy errBuff to mxArray mxerr = mxCreateString(errBuff); //initialize mxArray with errBuff char array, return to pointer //call matlab function mexCallMATLAB(0,NULL, 1,mxerr, "errorCatcher"); //destroy mxArray mxDestroyArray(mxerr); //destroy mxArray printf("destroyed mex array\n"); }//end of mexFunction errorCatcher accepts string inp...

A function with 'and' , 'not' , 'null' , 'car' and 'cdr'
What's this ? (defun enigma (x) (and (not (null x)) (or (null (car x)) (enigma (cdr x))))) "I suppose I should learn Lisp, but it seems so foreign." - Paul Graham, Nov 1983 On Wed, Oct 07 2015, CAI GENGYANG wrote: > What's this ? > > > (defun enigma (x) > (and (not (null x)) > (or (null (car x)) > (enigma (cdr x))))) Bad taste? It returns T if the list X contains nil as an element. It would be clearer to write (some #'null x). Helmut CAI GENGYANG ...

Trial of Musatov's theory: double spaced 'e x p a n d s' and single spaced 'c o n t r a c t s'. Does the spacing post-processing appear equal? If so, what force was lost and where did it g
Musatov's theory 'The space between spaces expands and contracts.' Would this give time a direction? Musatov ...

Error? s = assignin('base','s',tf('s'));
Hi, I need a little help here. Could anyone please tell me what is wrong with this command? s = assignin('base','s',tf('s')); The matlab syntax is -- assignin(ws, 'var', val) Basically I just want to add s=tf('s') into the base workspace. Jack "Jack" <Jack@Jill.com> wrote in message news:ef3e449.-1@webcrossing.raydaftYaTP... > Hi, > I need a little help here. Could anyone please tell me what is wrong > with this command? > > s = assignin('base','s',tf('s')); > > The matlab syntax is -- assignin(ws, 'var', val) > Basically I just want to add s=tf('s') into the base workspace. What does the error message say? Something about too many output arguments, right? How many output arguments does the documentation for ASSIGNIN show that it should return? How many are you asking it to return? http://www.mathworks.com/access/helpdesk/help/techdoc/ref/assignin.html -- Steve Lord slord@mathworks.com ...

Calling 'foo.c' or 'foo2.c' from my 'main_code.c'
Hello. I don't know if following is possible. I've got 'main_code.c': ............................ char * another_code; another_code = "foo.c"; ............................ I've got 'foo.c': ............................ #include <stdio.h> int main() { printf ("Hello world from 'foo.c'!\n"); return 0; } ............................ I would like to call 'foo.c' main function from 'main_code.c'. Is this possible? Thank you very much and best regards. Francesco Moi <francescomoi@europe.com> scribbled the ...

Output returned by S-function 'xxxxxxx' in 'xxxxx/S-Function' during flag=3 call must be a real vector of length 1
Hi there, I've found several posts where people are experiencing this error "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during flag=3 call must be a real vector of length 1" but I haven't been able to access a definitive solution. My m-files ran successfully with my previously installed version of Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a and now see this error. in InitializeSizes(u): sizes.NumOutputs = 1; sizes.NumInputs = 2; in Output(t,u): if u(2) == 0 u(2) = 1; end sys = u(1)/u(2); Does anyone have any hints? Is there a new syntax? cheers, Mel "Mel Cutler" <melcinasia@yahoo.co.nz> wrote in message news:iq7t6t$2ld$1@newscl01ah.mathworks.com... > Hi there, > > I've found several posts where people are experiencing this error > "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during > flag=3 call must be a real vector of length 1" but I haven't been able to > access a definitive solution. > > My m-files ran successfully with my previously installed version of > Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a > and now see this error. > > in InitializeSizes(u): > sizes.NumOutputs = 1; > sizes.NumInputs = 2; > > in Output(t,u): > if u(2) == 0 > u(2) = 1; > end > sys = u(1)/u(2); > > Does anyone...

if ('A:B:C' =~ /:(.*?)$/) then why the heck is $1 'B:C' and not just 'C'
To repeat the title, in case it is munged by Google Groups: if ('A:B:C' =~ /:(.*?)$/) then why the heck is $1 'B:C' and not just 'C' I've been developing with perl for years; but even simple things in it still sometimes throw up surprises. The regexp /:(.*?)$/ is anchored on the right by $, then comes a non- greedy match which, AIUI, is the "shortest string it can get away with", preceded by a colon. So I would expect this to pick up just the "C", as it does with /([^:]*)$/. Am I assuming/doing something silly? It is frid...

Preventing Matlab's history from data entered through 'Input' function
Whether Matlab's history can be adjusted to prevent recording the data entered from the keyboard through 'Input' function during execution of a script? Thanks you very much in advance. ...

Matlab 'mfilt.cicdecim' and 'filter' functions
I am trying to see the response of a CIC filter for a set of input data. I created the filter using the function Hd = mfilt.cicdecim(100, 1, 3) set(Hd, ... 'InputWordLength', 3, ... 'InputFracLength', 0, ... 'FilterInternals', 'FullPrecision'); I have some signed data in decimal in an input array 'x'. If I do, y = filter(Hd, x) 1. I am getting all zeros in y 2. y is not the form of a vector, but has other data in it. I am puzzled on why y has all zeros? Can somebody help? ...

Performance of Matlab 'zip' and 'unzip' functions
I'm using matlab 6.5 and I just realized that it comes with zip and unzip functions. On the first try it seems that the matlab zip functions are slower than other commonly available programs e.g. winzip, winrar. Anyone has any reliable data about the performance of Matlab zip and unzip functions? Failing that, personal experience is good too. Thanks! Terence Leong wrote: > > > I'm using matlab 6.5 and I just realized that it comes with zip and > unzip functions. On the first try it seems that the matlab zip > functions are slower than other commonly available programs ...

Problem with 'sys' & 'frd' function
Hi, Im trying to get the Time-Domain Impulse Response from Freq Domain. For the same am using the frd & sys functions. Problems while using the same: 1) >> sys = frd(resp,freq,'Hz'); ??? Error using ==> lti.set Property/value pairs must come in even number. Am using the format given in Help,whats the problem? 2) > impulse(sys) ??? Error using ==> rfinputs Not supported for Frequency Response Data models. Says no support. Can someone clarify more on this? Hope will get some inputs. Thanks. Hi Mehul, Regarding 1) The syntax should be >> sys = frd(resp,...

Visual Foxpro program to create a table archive (stores last month's data which isn't needed for this month's report), use visual basic to write??? possible? how?
Hi... I have a foxpro program which is for producing excel reports back ended to foxpro table(.dbf). Since the table is getting bigger and bigger, it slows down my program. I need a program which can create a table archive to store last month's data which isn't needed for this month's report. Therefore, I can run that archive program once a month to save outdated data into the table archive. By doing that, I can keep my current table small. Also I will have a big accumulated backup archive table to store my old data. Thanks... Kate (yenmei20878@hotmail.com) ...

Writing C MEX S-Function from existing Matlab C MEX function
I have an existing Matlab C MEX function (walkode.dll) that returns state derivatives when called by ode23s (walkode,...) from a regular Matlab script or the command line. I would like to incorporate this into a Simulink model, and have done so using a Level 1 M-file S-function, which called walkode in the mdlDerivatives subfunction. However this model runs very slowly. I would prefer to rewrite (recompile?) my .dll as a C MEX S- function (using sfuntmpl_doc.c I believe), but I am unsure as how to go about doing so. This is where my understanding (or more aptly, misunderstanding) of C,...

Which one(s) of the following std::vector's member functions has the possibility/authority to reduce the vector's capacity?
For C++11, I have 4 member functions in question: template <class T, class Allocator = allocator<T> > class vector { public: vector<T,Allocator>& operator=(const vector<T,Allocator>& x); vector<T,Allocator>& operator=(vector<T,Allocator>&& x); vector& operator=(initializer_list<T>); void clear() noexcept; }; For C++03, I have 2 member function in question: template <class T, class Allocator = allocator<T> > class vector { public: vector<T,Allocator>& operator=(const vect...

Web resources about - Is it possible to create 'beep' sound from within c-mex s-function? - comp.soft-sys.matlab

Resources last updated: 3/8/2016 2:31:44 AM