Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

But it's okay to eat fish, cause they don't have many feet and ...

3 views
Skip to first unread message

A.D. Fundum

unread,
Oct 24, 2011, 4:12:09 AM10/24/11
to
Like spacing door hinges when hanging a new door, is there a
way/formula/trick to improve the DosBeep()-code below in such a way
that the different frequencies sound as different as possible to a
human, while the difference between two frequencies sounds spaced
properly?

For example, it may be hard to hear the difference between 38,000 and
39,000 Hz while the difference between 100 and 716 Hz is very, very
clear. So a fixed value (here: 616) doesn't work well for all
frequencies.


--

#define INCL_DOSPROCESS
#include <os2.h>
int main(void)
{
ULONG frequency;

for (frequency=100;frequency<4000;frequency+=616)
DosBeep(frequency,(ULONG)250);

return 0;
}

Lars Erdmann

unread,
Oct 24, 2011, 12:50:50 PM10/24/11
to
You need an linear increase in spacing (I think). Frequency ranges double
with every octave.

A : 220 Hz
a1: 440 Hz
a2: 880 Hz
a3: 1760 Hz
etc.

You can fit a curve y = f(x) to these values. The 12 "intermediate" half
notes are evenly spaced on the x axis, the resulting frequency can be found
on the y axis.

Therefore something like this:

for (frequency=100,step=1;frequency<4000;frequency+=(step*C),step++)
DosBeep(frequency,(ULONG)250);

with "C" being a constant.


Lars


"A.D. Fundum" <what...@neverm.ind> schrieb im Newsbeitrag
news:o8uYFJ3iqTdG-pn2-t4dl26oX2GCF@localhost...

James J. Weinkam

unread,
Oct 24, 2011, 7:44:04 PM10/24/11
to
A.D. Fundum wrote:
> Like spacing door hinges when hanging a new door, is there a
> way/formula/trick to improve the DosBeep()-code below in such a way
> that the different frequencies sound as different as possible to a
> human, while the difference between two frequencies sounds spaced
> properly?
>
> For example, it may be hard to hear the difference between 38,000 and
> 39,000 Hz while the difference between 100 and 716 Hz is very, very
> clear. So a fixed value (here: 616) doesn't work well for all
> frequencies.
>
>

You need a geometric sequence, not an arithmetic one; i.e., constant ratio, not constant difference.

If you look at a piano keyboard, the interval between two adjacent keys is a semitone. If even
tempered tuning is used, the ratio of the frequencies of two adjacent keys is 2**(1/12). The A above
middle C is normally tuned to 440Hz (concert pitch). The lowest note on the piano is then 27.5Hz.

A.D. Fundum

unread,
Oct 25, 2011, 6:56:20 AM10/25/11
to
> You need an linear increase in spacing (I think).
> Therefore something like this:

> for
(frequency=100,step=1;frequency<4000;frequency+=(step*C),step++)
> DosBeep(frequency,(ULONG)250);

> with "C" being a constant.

Exactly, thanks! IRL I've another frequency range and a fixed number
of "piano keys", but that;'s an easy adjustment.


--

A.D. Fundum

unread,
Oct 25, 2011, 7:41:36 AM10/25/11
to
> If you look at a piano keyboard, the interval between two
> adjacent keys is a semitone.

Right, an equal interval indeed was the underlying problem.

> If even tempered tuning is used, the ratio of the frequencies
> of two adjacent keys is 2**(1/12). The A above middle C is
> normally tuned to 440Hz (concert pitch). The lowest note on
> the piano is then 27.5Hz.

And thanks for expanding this to the frequency range.


--
0 new messages