Note that there are some explanatory texts on larger screens.

plurals
  1. POfaster alternative to windows.h's Beep()
    primarykey
    data
    text
    <p>I'm working on a personal project. I want to transmit some data over the air with an old ham radio.</p> <p>My first draft application works like that :</p> <p>I construct one byte with 4 "signals" :</p> <ul> <li><p>5000hz means "00"</p></li> <li><p>6khz means "01"</p></li> <li><p>7khz means "10"</p></li> <li><p>8khz means "11"</p></li> <li><p>9khz means same as the previous one</p></li> </ul> <p>then I merge those 4 couple of bits together and start again with the next one. </p> <p>The demodulation works great and should be fast enough, but I'm having an issue with the sound generation... it's slow...</p> <p>Here's my debug code :</p> <pre><code>#include &lt;iostream&gt; #include &lt;windows.h&gt; using namespace std; int main() { Beep( 5000, 100 ); Beep( 6000, 100 ); Beep( 7000, 100 ); Beep( 8000, 100 ); Beep( 9000, 100 ); return 0; } </code></pre> <p>I'm expecting 5 beeps, close together, 100ms each but here's what I get (on top, five "100ms Beeps(), and on the bottom, five "20ms Beeps()" : <img src="https://i.imgur.com/wTnXggT.png" alt="a"> </p> <p>As you can see, what I get is 50ms beeps followed 75ms pause when I want 100ms beeps, and 10ms beeps followed by 100ms pause when I want a 20ms beep.</p> <p><strong>Is there something faster and more accurate than Beep() for Windows ? (something that works with linux as well would be even better because the final application should work on a raspberry pi)</strong> </p> <p>I would get the higher usable bandwidth with 3ms sounds (.... 41 bytes/sec.... which is more than enough for my application)</p> <p>Compiler : g++ (mingw) </p> <p>Os : seven 64bits</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload