From: shab shekan on
hello.
I wrote a function for input audio from microphone,but i want when Frequence is lower or upper a constant frequence, stop the recording.
the noise is not important, but accuracy is important.
From: Rune Allnor on
On 14 Mar, 09:04, "shab shekan" <shabshekan_632...(a)yahoo.com> wrote:
> hello.
> I wrote a function for input audio from microphone,but i want when Frequence is lower or upper a constant frequence, stop the recording.
> the noise is not important, but accuracy is important.

Doing anything real-time in matlab is hard. It would take
a lot of skills and effort to do what you want in real time.

That being said, the task you indicate is a bit unconventional.
You might want to use a recorded signal (e.g. a .wav file) and
see if you can get the algorithm to work as you want, before
you decide to spend all that effort n the real time part. That
is, you split the .wav file into sections according to your
stated criteria.

Rune
From: Walter Roberson on
shab shekan wrote:

> I wrote a function for input audio from microphone,but i want when
> Frequence is lower or upper a constant frequence, stop the recording.
> the noise is not important, but accuracy is important.

Ah, that code is easy in any digital recording system. In any digital
recording system that _ever_ has a change in signal level, you *always*
have frequencies present as high as you care to analyze. They are an
unavoidable artifact of doing a fourier analysis on a system that
implicitly models every sample as a square wave: remember that square
waves and triangle waves in fourier systems contain infinite frequencies...

Thus your code becomes simple: as you read in each sample, compare it to
the previous sample. If it is different in even a single bit, then stop
the recording.