Astronomia.cpp
#include <bits/stdc++.h>
#include <unistd.h>
const int q_do = 262;
const int qre = 294;
const int qmi = 330;
const int qfa = 349;
const int qso = 392;
const int qla = 440;
const int qsi = 494;
const int _do = 523;
const int re = 578;
const int mi = 659;
const int fa = 698;
const int so = 784;
const int la = 880;
const int si = 988;
const int _do1 = 1046;
const int re1 = 1175;
const int mi1 = 1318;
const int fa1 = 1480;
const int so1 = 1568;
const int la1 = 1760;
const int si1 = 1976;
const int sq_do = 277;
const int sqre = 311;
const int sqfa = 370;
const int sqso = 415;
const int sqla = 466;
const int s_do = 554;
const int sre = 622;
const int sfa = 740;
const int sso = 831;
const int sla = 932;
const int s_do1 = 1046;
const int sre1 = 1245;
const int sfa1 = 1480;
const int sso1 = 1661;
const int sla1 = 1865;
// q前缀为低音,1后缀为高音,s前缀为半音阶
using namespace std;
void Beep(int x, int len) {
string a = "beep -f " + to_string(x) + " -l" + to_string(len);
system(a.c_str());
}
void init() { system("sudo apt install beep -y ; sudo modprobe pcspkr; "); }
void init_manjaro() {
system("sudo pacman -S beep -y ; sudo modprobe pcspkr; ");
}
void debug() {
usleep(1);
Beep(la, 200);
exit(0);
}
int main() {
int f;
cout << "Initialize?" << endl;
cin >> f;
if (f)
init();
int pai = 400, ban = 200;
int ting = 128;
while (1) {
for (int t = 1; t <= 4; ++t)
Beep(_do, ban);
for (int t = 1; t <= 4; ++t)
Beep(mi, ban);
for (int t = 1; t <= 4; ++t)
Beep(re, ban);
for (int t = 1; t <= 4; ++t)
Beep(so, ban);
for (int t = 1; t <= 4; ++t)
Beep(la, pai);
Beep(la1, pai << 1);
Beep(re, ban);
Beep(_do, ban);
Beep(qsi, ban);
Beep(qso, ban);
vector<pair<int, int>> vice = {
{qfa, ban}, {_do, ban}, {fa, ban}, {la, ban}, {_do1, ban},
{la, ban}, {fa, ban}, {_do, ban}, {qso, ban}, {re, ban},
{so, ban}, {si, ban}, {re1, ban}, {si, ban}, {so, ban},
{re, ban}, {qla, ban}, {mi, ban}, {la, ban}, {_do1, ban},
{mi1, ban}, {_do1, ban}, {la, ban}, {mi, ban}, {qla, ban},
{mi, ban}, {la, ban}, {mi, ban}, {qso, ban}, {mi, ban},
{so, ban}, {mi, ban}};
vector<pair<int, int>> Main = {
{qla, pai / 3}, {qmi, pai / 3}, {q_do, pai / 3}, {qla, ban},
{mi, ban}, {re, pai}, {_do, pai}, {qsi, pai / 3},
{qso, pai / 3}, {qre, pai / 3}, {qsi, ban}, {qsi, ban},
{re, pai}, {_do, ban}, {qsi, ban}, {qla, ban},
{qmi, ban}, {qla, ban}, {_do1, ban}, {si, ban},
{_do1, ban}, {si, ban}, {_do1, ban}, {qla, pai},
{qla, ban}, {_do1, ban}, {si, ban}, {_do1, ban},
{si, ban}, {_do1, ban},
};
// for(auto t:vice)
// Beep(t.first,t.second);
for (int t = 1; t <= 3; ++t)
for (auto t : Main)
Beep(t.first, t.second);
}
return 0;
}
博客保留所有权利,谢绝学步园、码迷等不在文首明显处显著标明转载来源的任何个人或组织进行转载!其他文明转载授权且欢迎!