2015-03-26 09:34:08

hi all. I have such question: how music notes on pitch in bgt are distributed? for example how many it is necessary to take pitch that the note of do, re, mi and so on turned out?

Thumbs up

2015-03-26 23:27:15

The tone_synth object allows both frequency and musical notes when generating tones.
If you need exact frequencies, there's probably a table somewhere, but I just start from middle A = 440 and go from there.
If you're use to a different musical system, C-D-E-F-G-A-B corresponds to do-re-mi-fa-so-la-ti.

This might be useful:

const double HALFSTEP=1.059463;//for on-the-fly transposition

Multiply a pitch by HALFSTEP to raise it by 1 halfstep, divide to lower.
Also keep in mind that the same note, at a higher octave, is pitch*2, and at a lower octave, pitch/2.
(So to reduce rounding errors, it might be better to jump to the nearest octave and transpose by HALFSTeps from there.)

Exponentiation might help, here. If you have a note at "do" and want to raise it to "mi", you could say pitch*HALFSTEP*HALFSTEP*HALFSTEP*HALFSTEP, but it'd be easier to say pitch*power(HALFSTEP, 4);
But if you want to raise a note from "do" to "la", you might have better results with
pitch=(pitch*2)/power(HALFSTEP, 3);

If you need specific notes, and aren't generating tones with the tone_synth or soundtrack, I'd start with the various 'A's, since they're easy to remember (55, 110, 220, 440, 880, 1760), then use the above method for calculating the other notes.

Some of my games
Keep up to date by following @Jeqofire on twitter!
Ear Ninja?

Thumbs up