Beep command basics..

Hey all,

Didn't know which forum to post this in as it may not be language specific and just its limitations....

The system beep command works well in my win32 console app but i have a few queries about the beep itself..

For some reason, if the duration is longer than a certain length (not established what yet) the beep is a pulse not a long note. Is this usual behaviour for the system beep? Ideally i'd want it to play a long continuous note based on the duration and not pulsing on and off..

Sorry if i'm not making total sense haha.

Paul
Last edited on
Just as an edit, when I do a simple Beep(256, 2000); command on a blank project, the beep is continuous. It must be something in my full code that's causing it to pulse like that grrr. Need to review my code and work out why..

Below is a very simplied version of my main code but in reality, the only differences are that I'm parsing user input to the arrays rather than expressly stating them as below. The code below acts as I'd like it to but my actual main code, anything say over 1000ms plays not as a continuous note but a pulse of them. Why?

I could attach my full program code if anyone has time to run and check? :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
#include <windows.h>

using namespace std;

int i;
int freq[4];
int duration[4];


int main(void)
{

	freq[0] = 256;
	freq[1] = 350;
	freq[2] = 6000;
	freq[3] = 4500;
	duration[0] = 1000;
	duration[1] = 2000;
	duration[2] = 3000;
	duration[3] = 500;

	for (i = 1; i < 5; i++)
	{
		Beep(freq[i - 1], duration[i - 1]);
	}
}
Just running a few tests, it seems that only notes C and D seem to do it. At first i thought it was because of the frequency they are at and a limitation with the beep command and its lowest playable frequency but even other notes on a lower octave with a much much lower frequency seem to play perfectly grrrrr
Topic archived. No new replies allowed.