[C ++] C ++ audio program

xiaoxiao2021-03-06  53

Music frequency in C / C corresponds to list

Audio / sound

C (1)

D (2)

E (3)

F (4)

G (5)

A (6)

B (7)

bass

131 147 165 175 196 220 247 Middleware

262 296 330 349 392 440 494 Treasure

523 587 659 698 784 880 988 high level

1047 1175 1319 1397 1568 1760 1976 Music Festival

A thriller: 2400 is 1/2 beat ............ 1/8 beats in addition to 2

Example: (vc program :)

#include

#include

#include

Int main (int Argc, char * argv [])

{

Unsigned frequency [] = {392, 392, 440, 392, 523, 494,

392, 392, 440, 392, 587, 523,

392, 392, 784, 659, 523, 494, 440,

698, 698, 659, 523, 587, 523};

Unsigned delay [] = {375, 125, 500, 500, 500, 1000,

375, 125, 500, 500, 500, 1000,

375, 125, 500, 500, 500, 500, 1000,

375, 125, 500, 500, 500, 1000,};

Int circle;

For (Circle = 0; Circle <25; Circle )

{

Beep (frequency [circle], delay [circle]);

}

Return 0;

}

Attachment: Output Music Speaker in TC, available functions: Sound (), delay () and nond ().

format:

Sound

DELAY (beat)

Nosound () // sound close

Replace Beep () can be replaced as follows:

For (Circle = 0; Circle <25; Circle ) {

Sound (frequency [circle]);

DELAY (Delay [Circle]);

Nosound ();

}

转载请注明原文地址:https://www.9cbs.com/read-114524.html

New Post(0)