BEEP function not present in .NET CF....

  • Thread starter Thread starter amitkhemlani
  • Start date Start date
A

amitkhemlani

The function Beep does not exist for the .NET Compact Framework. Does
anyone know of any other function which does the same work? Or has any
one developed one. And also I want a beep function with a .1 ms
precision. Is that possible at the level we are working at or i will
need to do assembly level programming?

I know of a playsound function that plays WAV files but I do not want
to play a WAV file. I have a stream of bits and want to decide on the
fly what type of sound I need to play. For bit 1, I want a sound of
1000 Hz frequency for a 0.1 ms duration. And for bit 0, I want a sound
of 2000Hz frequency for 0.1 ms.

Hope to hearing from you soon.

Thanks,
Amit
 
The function Beep does not exist for the .NET Compact Framework. Does
anyone know of any other function which does the same work? Or has any
one developed one.

The simplest way is to P/Invoke PlaySound and play the system beep
And also I want a beep function with a .1 ms
precision.

Since the system tick is 1ms, getting 0.1ms precision is going to be tough
with just software.
Is that possible at the level we are working at or i will
need to do assembly level programming?

It's certainly not possible with the CF. You can't get deterministic
behavior from managed code.
I know of a playsound function that plays WAV files but I do not want
to play a WAV file.

Then P/Invoking Playsound as I suggested earlier isn't going to work
I have a stream of bits and want to decide on the
fly what type of sound I need to play. For bit 1, I want a sound of
1000 Hz frequency for a 0.1 ms duration. And for bit 0, I want a sound
of 2000Hz frequency for 0.1 ms.

Playing a tone of a certain frequency will require directly writing data to
a buffer and sending it to the audio driver. Since you know your
frequencies, it's very easy to determine how many data points would lie in a
certain period of time, so you can generate a tone of a specific frequency
for an exact length pretty easily.

That said, I don't really understand what you're trying to do. First,
you'll not be able to "hear" a tine that short. Second, a 1000Hz signal for
0.1ms duration is less than a single wave (1000 waves per second / 10000 =
0.1) so you really can't get a tone from it anyway. What are you trying to
achieve here?

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate
 
The sound is not for people to hear. I have handhelds(through out the
USA) which have data about customers. I need the data transferred to
one central location.

The sound what I am trying to generate is of data which I need to
transfer over modems to a central location. The transfer rate of the
receiver is set at 9600 baud, so I need to generate the sound for such
a less duration of 0.1ms.
 
Well. Right now we have a modem doing it. But we now want the handheld
device to generate sound from its speakers, with the speaker being held
near a phone. So that the data can get sent to the receiving modem
which is set to receive at 9600 baud rate.

I know its a little difficult to do this. Do you think it is possible?
The whole reason behind this is that all the data has to sent to the
central receiving station whenever it is collected. The data is
normally collected on the field by sales reps. They do not have modems
to transfer the data. They get to the nearest phone booth and use the
phone to transfer the data.

Hope to hearing from you soon.

Best Regards,
Amit
 
"Playing a tone of a certain frequency will require directly writing
data to
a buffer and sending it to the audio driver. Since you know your
frequencies, it's very easy to determine how many data points would lie
in a
certain period of time, so you can generate a tone of a specific
frequency
for an exact length pretty easily."

Well I do understand what u mean here but how do i go about with this
problem. Well I mean which functions do I need to use to be able to
send the data to the audio driver?
Thanks.

Amit
 
Well how do i convert my stream of bits to a wave file. Which will then
be the input to the function in the name space you gave me.

I do the following convert each data character to its equivalent ascii,
then i convert ascii to its bit equivalent with the start and stop bits
in place.

Do I need to convert it to a wave file, is there any other way to do
it?

Hope to hearing from you soon. Really appreciate the help.

Best Regards,
Amit

Well we have to try to satisfy client requirements....if its possible..
 
Let's say you can generate sounds with .1 ms duration. That would result in
sound frequency above 1/.1E-3 = 10KHz.
Phone line bandwidth is about 3 KHz which means there's no way this sound
can pass through phone line.
Modems are using sophisticated modulations to pass data in 3 KHz bandwidth
at 9600 bps and higher rates.

However, ~5 bps with DTMF should be possible. With any luck even 300 bps
with FSK might be possible.
Unless you have some DSP developers with 5-6 years modem modulations
experience at your disposal, it's a good idea to continue using modems.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Interesting idea - that's basically what PocketMail
(www.pocketmail.com) does - connect your portable email device to a
mobile phone like the old acoustic couplers and it "sends" the email
via tone.

Are there such beasts as acoustic couplers for "standard" devices like
PPC?
 
As far as I remember, pre-split AT&T won't allow anybody to plug in
anything but AT&T approved phones.
The only way around was the acoustic modem. As soon as that restriction was
lifted, acoustic modems died out pretty quickly.
You can find one in the nearest museum, though.

As to using this today, it's like going back to IBM 360 (also in the
museum).
Pretty much any cell phone on the today's market can be used as a modem via
BT, IR or a wire (for older/cheap models).
Not to mention e-mails you can send from the phone via SMS. So, I can
hardly call this idea interesting.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Ilya,

Totally agree.

But this requirement is for people who don't have modems and want to
transfer the sound.

Can you do that via BT or IR?

Which is what the pocketmail solution does. It seems to have an
"acoustic coupler" on the back that you plug a mobile phone into.

But this requirement is for a phone in a public phone booth. That's not
a mobile phone - which is why I was wondering about some kind of
handheld acoustic coupler.
 
IIya,

I am not an expert in data communications. I need some help on some
calculations.
I have to transmit data at 9600 baud. Each frame has 11 characters(1
Start + 8 Data + 2 Stop). I have to transmit the ascii equivalent of
the characters in data.

Like say if the data is "amit". Its ascii equivalent is 97 109 105 116.
I convert these to bits and pack each character in a frame(total 11
bits).

So if the baud rate is 9600bps. I do the following 9600/11=872
characters per second. I do a reciprocal(1/872) ie 1.146 ms to get the
duration of a character. Since each character is 11 bits then each bit
should be sounded for 1.146/11ms ie 0.104 ms.

Do you think my calulations are right? If not then can you please tell
me the right calculation?

Best Regards,
Amit
 
I have one more question. Can an acoustic which is used over a phone
line to transmit data be replaced by the speaker in the handheld? Can
we get rid of the acoustic, is that possible?

Hope to hearing from you guys soon.

Best Regards,
Amit
 
Your calculations for bit duration seem to be correct.

And your idea of using 1/2 KHz signals to represent 1/0 (commonly known as
FSK http://www.wj.com/pdf/technotes/FSK_signals_demod.pdf ) would work just
fine at about 300 bps or so.
That's the speed of actual acoustic modems from 25-30 years ago which are
indeed using FSK.

It's beyond the scoop of this NG to explain why you can not switch between
1 and 2 KHz signals at a 9600 bps rate without getting out of 3 KHz
bandwidth.
Should it be possible, we'll be using 1GBps modems over phone lines now.
Indeed, if you can switch between 1 and 2 KHz at .1 ms interval, why can't
you switch with 1 Pico second interval or so?

If you'd like to figure out why it's not working, get a piece of paper and
draw 1 and 2 KHz sine waves to scale.
Take a sequence of, say, 101010 and draw it (FSK encoded) on the same paper
by alternating 1/2 KHz every .1 ms or so (all to scale).
If you don't see the problem, try implementing it on a desktop as it has
beep() and look at the resulting signal spectrum.

Again, 300 bps is pretty much all you can get with acoustic channel.
Modern modulations like QAM which are capable of delivering higher speeds
won't work well because of phase/frequency distortions and noise in the
acoustic channel.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Really amazed of your knowledge...

We, the average programmer here, say, in this company, won't know so much
technical about this.

Can imagine how advance are the programmers behind Microsoft and other giant
software makers. (Not to mention hardware design)

"Ilya Tumanov [MS]" said:
Your calculations for bit duration seem to be correct.

And your idea of using 1/2 KHz signals to represent 1/0 (commonly known as
FSK http://www.wj.com/pdf/technotes/FSK_signals_demod.pdf ) would work just
fine at about 300 bps or so.
That's the speed of actual acoustic modems from 25-30 years ago which are
indeed using FSK.

It's beyond the scoop of this NG to explain why you can not switch between
1 and 2 KHz signals at a 9600 bps rate without getting out of 3 KHz
bandwidth.
Should it be possible, we'll be using 1GBps modems over phone lines now.
Indeed, if you can switch between 1 and 2 KHz at .1 ms interval, why can't
you switch with 1 Pico second interval or so?

If you'd like to figure out why it's not working, get a piece of paper and
draw 1 and 2 KHz sine waves to scale.
Take a sequence of, say, 101010 and draw it (FSK encoded) on the same paper
by alternating 1/2 KHz every .1 ms or so (all to scale).
If you don't see the problem, try implementing it on a desktop as it has
beep() and look at the resulting signal spectrum.

Again, 300 bps is pretty much all you can get with acoustic channel.
Modern modulations like QAM which are capable of delivering higher speeds
won't work well because of phase/frequency distortions and noise in the
acoustic channel.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "(e-mail address removed)" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
Subject: Re: BEEP function not present in .NET CF....
Date: 14 Mar 2005 05:57:24 -0800
Organization: http://groups.google.com
Lines: 23
Message-ID: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
NNTP-Posting-Host: 65.88.196.162
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1110808648 5132 127.0.0.1 (14 Mar 2005 13:57:28 GMT)
X-Complaints-To: (e-mail address removed)
NNTP-Posting-Date: Mon, 14 Mar 2005 13:57:28 +0000 (UTC)
In-Reply-To: <[email protected]>
User-Agent: G2/0.2
Complaints-To: (e-mail address removed)
Injection-Info: o13g2000cwo.googlegroups.com; posting-host=65.88.196.162;
posting-account=MCTB7A0AAACKS_rV-5ZTlRG5MLV7rRz5
Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!postnews.google.com!o13g2000cwo
googlegroups.com!not-for-mail
Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.compactframework:73177
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework

IIya,

I am not an expert in data communications. I need some help on some
calculations.
I have to transmit data at 9600 baud. Each frame has 11 characters(1
Start + 8 Data + 2 Stop). I have to transmit the ascii equivalent of
the characters in data.

Like say if the data is "amit". Its ascii equivalent is 97 109 105 116.
I convert these to bits and pack each character in a frame(total 11
bits).

So if the baud rate is 9600bps. I do the following 9600/11=872
characters per second. I do a reciprocal(1/872) ie 1.146 ms to get the
duration of a character. Since each character is 11 bits then each bit
should be sounded for 1.146/11ms ie 0.104 ms.

Do you think my calulations are right? If not then can you please tell
me the right calculation?

Best Regards,
Amit
 
Back
Top