特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”

简介: 特别篇:用c++弹奏音乐“海阔天空”与“孤勇者”

孤勇者

不要悲伤,不要哭泣,快乐的日子终会来临!!!


送给大家一首用c++写的孤勇者,让大家在今天都可以快乐度过!


注意:使用vs、devc++等编译器均可执行代码,只需要创建一个源文件即可。

#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <Windows.h>
#pragma comment(lib,"winmm.lib")
using namespace std;
enum Scale
{
    Rest = 0, C8 = 108, B7 = 107, A7s = 106, A7 = 105, G7s = 104, G7 = 103, F7s = 102, F7 = 101, E7 = 100,
    D7s = 99, D7 = 98, C7s = 97, C7 = 96, B6 = 95, A6s = 94, A6 = 93, G6s = 92, G6 = 91, F6s = 90, F6 = 89,
    E6 = 88, D6s = 87, D6 = 86, C6s = 85, C6 = 84, B5 = 83, A5s = 82, A5 = 81, G5s = 80, G5 = 79, F5s = 78,
    F5 = 77, E5 = 76, D5s = 75, D5 = 74, C5s = 73, C5 = 72, B4 = 71, A4s = 70, A4 = 69, G4s = 68, G4 = 67,
    F4s = 66, F4 = 65, E4 = 64, D4s = 63, D4 = 62, C4s = 61, C4 = 60, B3 = 59, A3s = 58, A3 = 57, G3s = 56,
    G3 = 55, F3s = 54, F3 = 53, E3 = 52, D3s = 51, D3 = 50, C3s = 49, C3 = 48, B2 = 47, A2s = 46, A2 = 45,
    G2s = 44, G2 = 43, F2s = 42, F2 = 41, E2 = 40, D2s = 39, D2 = 38, C2s = 37, C2 = 36, B1 = 35, A1s = 34,
    A1 = 33, G1s = 32, G1 = 31, F1s = 30, F1 = 29, E1 = 28, D1s = 27, D1 = 26, C1s = 25, C1 = 24, B0 = 23,
    A0s = 22, A0 = 21
};
enum Voice
{
    X1 = C2, X2 = D2, X3 = E2, X4 = F2, X5 = G2, X6 = A2, X7 = B2,
    L1 = C3, L2 = D3, L3 = E3, L4 = F3, L5 = G3, L6 = A3, L7 = B3,
    M1 = C4, M2 = D4, M3 = E4, M4 = F4, M5 = G4, M6 = A4, M7 = B4,
    H1 = C5, H2 = D5, H3 = E5, H4 = F5, H5 = G5, H6 = A5, H7 = B5,
    LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,
    _ = 0XFF
};
// 孤勇者
void GYZ()
{
    HMIDIOUT handle;
    midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);
    int volume = 0x7f;
    int voice = 0x0;
    int sleep = 350;
    int gyz[] =
    {
       M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,M2,L7,M1,L6,
       M3,_,_,_,_,_,0,700,M1,M2,M1,300,M3,_,_,_,_,700,0,M1,M2,M1,M2,M3,300,L6,700,0,M1,300,L6,700,0,M1,300,L6,700,0,M1,300,M2,M1,L7,_,_,_,_,_,_,_,
       M3,_,_,_,_,_,0,700,M1,M2,M1,300,M3,_,_,_,_,700,0,M1,M2,M1,M2,M3,300,L6,700,0,M1,300,L6,700,0,M1,300,L6,700,0,M1,300,M3,M2,L7,_,_,_,_,_,_,_,
       0,L6,M1,300,M6,0,700,M6,M6,M5,300,M6,0,M6,M5,M6,M5,M6,M5,700,300,M3,700,_,_,_,_,_,0,L6,M1,300,M6,0,M6,M6,M5,M6,M5,300,M7,700,0,M7,M7,M6,300,M7,0,700,300,M6,0,M3,300,_,_,_,_,
      _,0,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,0,M5,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,_,_,0,M1,M2,300,M3,L6,M1,M3,M2,700,0,M3,M2,700,300,M1,L6,_,_,_,_,_,_,
       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,
       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,
       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,
       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,
       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,
       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,
       _,_,_,_,_,_,_,_, _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,0,M6,M5,300,M6,700,0,M5,M6,M5,M6,M5,300,M6,0,M6,M5,M6,M5,M6,M5,700,M3,700,M3,_,_,_,_,
       0,M6,M5,300,M6,700,0,M5,M6,M5,M6,M5,300,M7,700,0,M7,M7,M6,M7,M6,700,300,M3,700,_,_,700,0,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,700,0,M3,M5,M3,M5,M3,300,M2,700,0,M3,300,M2,700,0,M3,300,M2,_,_,
       0,M1,M2,300,M3,M6,H1,H3,H2,700,0,H3,300,H2,700,300,H1,M6,_,_,_,_,_,
       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,
       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,
       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,
       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,
       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,
       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,
       L6,M1,M3,M7,_,M7,0,M7,M7,300,M6,_,_,_,_,_,_,_,_,L6,M1,M3,M7,_,M7,0,M7,M7,300,M6,_,_,_,_,_,_,_,_,
       0,M6,M7,H1,H2,M7,H1,300,H1,0,H1,M7,H1,H2,M7,H1,300,
       H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,0,M6,M7,H1,H2,M7,H1,300,
       H1,0,H1,M7,H1,H2,M7,H1,300,H1,0,H1,H2,H3,H2,H3,H2,300,H3,0,H3,H2,300,H3,H5,H3,
       H5,H3,700,0,H5,300,H3,700,0,H5,300,0,H3,H5,H6,H3,300,H5,H5,H3,700,0,H5,300,H3,700,0,H5,H3,H5,H6,H3,300,
       H5,0,H5,H5,H3,700,H2,300,H2,0,H1,H3,_,300,H2,H2,0,H1,300,M6,700,_,_,_,_,_,_,
       0,H5,H5,H3,700,300,H2,H2,0,H1,H3,_,300,H2,H2,0,H1,M6,_,_,_,_,_,_,_,
    };
    for (auto i : gyz) {
        if (i == LOW_SPEED || i == HIGH_SPEED || i == MIDDLE_SPEED) {
            sleep = i;//Sleep(i/2);
            continue;
        }
        if (i == 0) { sleep = 175; continue; }
        if (i == 700) { Sleep(175); continue; }
        if (i == _) {
            Sleep(350);
            continue;
        }
        voice = (volume << 16) + ((i) << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }
    midiOutClose(handle);
}
int main(void)
{
    GYZ();
    return 0;
}

孤勇者


都,是勇敢的


你额头的伤口,你的,不同,你犯的错

都,不必隐藏

你破旧的玩偶,你的,面具,你的自我

他们说,要带着光,驯服每一头怪兽

他们说,要缝好你的伤,没有人爱小丑

为何孤独,不可,光荣

人只有不完美,值得歌颂

谁说污泥满身的不算英雄

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你破烂的衣裳,却敢堵命运的枪

爱你和我那么像,缺口都一样

去吗,配吗,这褴褛的披风

战吗,战啊,以最卑微的梦

致那黑夜中的呜咽与怒吼

谁说站在光里的才算英雄

他们说,要戒了你的狂

就像擦掉了污垢

他们说,要顺台阶而上

而代价是低头

那就让我,不可,乘风

你一样骄傲着,那种孤勇

谁说对弈平凡的不算英雄

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你破烂的衣裳,却敢堵命运的枪

爱你和我那么像,缺口都一样

去吗,配吗,这褴褛的披风

战吗,战啊,以最卑微的梦

致那黑夜中的呜咽与怒吼

谁说站在光里的才算英雄

你的斑驳,与众不同

你的沉默,震耳欲聋

You Are The Hero

爱你孤身走暗巷,爱你不跪的模样

爱你对峙过绝望,不肯哭一场

爱你来自于蛮荒,一生不借谁的光

你将造你的城邦,在废墟之上

去吗,去啊,以最卑微的梦

战吗,战啊,以最孤高的梦

致那黑夜中的呜咽与怒吼


谁说站在光里的才算英雄

海阔天空

长风破浪会有时,直挂云帆济沧海,虽然今天我们没有那么快乐,但是一定也会有人在努力提升自己,让自己变得更优秀。


前方的光明在等着大家,就像海阔天空中的一句歌词一样:多少次, 迎着冷眼与嘲笑,从没有放弃过心中的理想。一首海阔天空送给一直在默默努力奋斗的人们,坚持下来一定会成功!!!

#include <iostream>
#include <Windows.h>
#pragma comment(lib,"winmm.lib")
using namespace std;
enum Scale
{
    Rest = 0, C8 = 108, B7 = 107, A7s = 106, A7 = 105, G7s = 104, G7 = 103, F7s = 102, F7 = 101, E7 = 100,
    D7s = 99, D7 = 98, C7s = 97, C7 = 96, B6 = 95, A6s = 94, A6 = 93, G6s = 92, G6 = 91, F6s = 90, F6 = 89,
    E6 = 88, D6s = 87, D6 = 86, C6s = 85, C6 = 84, B5 = 83, A5s = 82, A5 = 81, G5s = 80, G5 = 79, F5s = 78,
    F5 = 77, E5 = 76, D5s = 75, D5 = 74, C5s = 73, C5 = 72, B4 = 71, A4s = 70, A4 = 69, G4s = 68, G4 = 67,
    F4s = 66, F4 = 65, E4 = 64, D4s = 63, D4 = 62, C4s = 61, C4 = 60, B3 = 59, A3s = 58, A3 = 57, G3s = 56,
    G3 = 55, F3s = 54, F3 = 53, E3 = 52, D3s = 51, D3 = 50, C3s = 49, C3 = 48, B2 = 47, A2s = 46, A2 = 45,
    G2s = 44, G2 = 43, F2s = 42, F2 = 41, E2 = 40, D2s = 39, D2 = 38, C2s = 37, C2 = 36, B1 = 35, A1s = 34,
    A1 = 33, G1s = 32, G1 = 31, F1s = 30, F1 = 29, E1 = 28, D1s = 27, D1 = 26, C1s = 25, C1 = 24, B0 = 23,
    A0s = 22, A0 = 21
};
enum Voice
{
    X1 = C2, X2 = D2, X3 = E2, X4 = F2, X5 = G2, X6 = A2, X7 = B2,
    L1 = C3, L2 = D3, L3 = E3, L4 = F3, L5 = G3, L6 = A3, L7 = B3,
    M1 = C4, M2 = D4, M3 = E4, M4 = F4, M5 = G4, M6 = A4, M7 = B4,
    H1 = C5, H2 = D5, H3 = E5, H4 = F5, H5 = G5, H6 = A5, H7 = B5,
    LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,
    _ = 0XFF
};
void HKTK()
{
    HMIDIOUT handle;
    midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);
    int volume = 0x7f;
    int voice = 0x0;
    int sleep = 400; int tmp = 0;
    int hktk[] =
    {
     X4,(H7 - 1),_,H6,_,_,_, H5,H4,H3,H2,_,(L7 - 1),M1,M4,(X7 - 1),_,_,_,_, (L7 - 1),M1,M4,(X7 - 1),_,_,_,_,(L7 - 1),M1,M5,M4,_,_,_,_,_,M4,_,M3,_,_,_,
     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,
     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,
     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,
     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,
     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,
     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,
     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,
     1000,M3,0,M2,700,300,M1,_,_,_,_,_,_,0,M3,M4,300,M5,0,M5,M5,300,_,M6,700,M5,_,_,
     0,M6,M7,300,H1,0,H1,300,H1,700,H1,H1,M7,0,M6,300,M5,700,0,M6,300,_,_,_,_,_,
     M6,M5,M5,_,_,M5,M3,_,M3,M4,M3,M2,M2,0,M3,M2,300,_,_,M3,0,M2,M2,_,300,M1,M1,0,M1,M1,300,_,_,M2,M1,M1,_,_,_,_,_,_,
     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,
     M6,M6,M7,M6,M7,H1,_,_,_,0,H1,H1,300,H2,H1,H2,H3,_,_,_,H3,H2,_,_,0,H2,H3,300,H1,_,_,_,_,_,
     _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,
      _,0,M6,M7,300,H1,0,H1,H1,_,300,H1,M7,M6,0,M5,300,M5,700,M5,_,0,M3,300,M2,700,M1,_,_,_,_,0,H1,H1,300,H1,0,H1,H2,_,300,H2,0,H1,300,H2,700,H3,_,_,_,H3,0,H2,300,H1,700,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,_,_,0,M5,M5,300,H3,_,H2,_,H1,_,_,_,
     _,0,H1,H1,300,H1,0,H1,H2,300,_,0,H2,H2,H1,300,M7,700,H1,_,_,_,_,_,_,_,
    };
    for (auto i : hktk) {
        if (i == LOW_SPEED || i == HIGH_SPEED || i == MIDDLE_SPEED) {
            sleep = i;
            continue;
        }
        if (i == 0) { sleep = 200; continue; }
        if (i == 700) { Sleep(200); continue; }
        if (i == _) {
            Sleep(400);
            continue;
        }
        if (i == 1000) { tmp = +5; continue; }
        voice = (volume << 16) + ((i + tmp) << 8) + 0x90;
        midiOutShortMsg(handle, voice);
        cout << voice << endl;
        Sleep(sleep);
    }
    midiOutClose(handle);
}
int main(void)
{
    HKTK();
    return 0;
}

海闊天空

今天我 寒夜裡看雪飄過

懷著冷卻了的心窩漂遠方

風雨裏追趕 霧裡分不清影蹤

天空海闊你與我 可會變 (誰沒在變)

多少次 迎著冷眼與嘲笑

從沒有放棄過心中的理想

一剎那恍惚 若有所失的感覺

不知不覺已變淡 心裡愛 (誰明白我)

原諒我這一生不羈放縱愛自由

也會怕有一天會跌倒 oh-no

背棄了理想 誰人都可以

哪會怕有一天只你共我

今天我 寒夜裡看雪飄過

懷著冷卻了的心窩漂遠方

風雨裏追趕 霧裡分不清影蹤

天空海闊你與我 可會變 (誰沒在變)

原諒我這一生不羈放縱愛自由

也會怕有一天會跌倒 oh-no

背棄了理想 誰人都可以

哪會怕有一天只你共我 oh-yeah

仍然自由自我

永遠高唱我歌 走遍千里

原諒我這一生不羈放縱愛自由

也會怕有一天會跌倒 oh-no

背棄了理想 誰人都可以

哪會怕有一天只你共我 oh-yeah

(原諒我這一生不羈放縱愛自由) oh-yeah

(也會怕有一天會跌倒) oh-oh

(背棄了理想 誰人都可以) whoa-oh

(哪會怕有一天只你共我)

目录
相关文章
|
6月前
|
存储 SQL 人工智能
新年将至,为大家推荐一款开源AI红包封面制作神器AiCover!
新年将至,为大家推荐一款开源AI红包封面制作神器AiCover!
108 2
|
5月前
|
JSON 人工智能 数据格式
在PAI Artlab一键实现欧洲杯粉丝专属贴纸制作
嘿,各位足球狂热分子,准备好迎接欧洲杯的狂欢了吗?你的加油装备还缺了点啥?别担心,ArtLab平台一键贴纸生成工作流,来给这足球盛宴加点料啦!快来,让我们一起把激情和创意混搭出新高度!
在PAI Artlab一键实现欧洲杯粉丝专属贴纸制作
|
人工智能 开发者
人人当导演 | 魔搭社区一站式电影短片制作
人人当导演 | 魔搭社区一站式电影短片制作
|
安全 JavaScript 前端开发
足球直播网站轻松搭建,专业级赛事直播竞猜系统源码分享
足球直播网站在现代社会中越来越受欢迎,吸引着众多体育爱好者。如果您想要创业在体育直播领域,建立一个自己的足球直播网站可能是一个不错的选择。
|
JavaScript 前端开发 Java
体育足球直播开发,有哪些赛事观看源代码推荐
大家对于体育赛事的热爱与日俱增,体育直播平台已然成为现代体育产业不可或缺的一部分。如要开发一款优秀的体育直播平台,不仅要良好的使用体验长期稳定的技术支持外,还需有完善的赛事源代码。
|
机器学习/深度学习 人工智能 算法
一键生成“网红”海报原理揭秘!
当前,人工智能(AI)技术在各种场景下得到了广泛的应用。其中之一是设计领域,AI设计工具逐渐走进人们的视野,成为了创意设计的有力助手。本文主要介绍AIGC(Artificial Intelligence Graphic Composer)工具,以其技术为例,解读AI设计工具的原理及其应用。
284 0
|
数据采集 Python
Python爬虫系列16-采集网易音乐百万好听的歌曲进行批量下载
业精于勤而荒于嬉,行成于思而毁于随。 吃得苦中苦,方为人上人,受得累中累,方成富贵人。完全赞同
Python爬虫系列16-采集网易音乐百万好听的歌曲进行批量下载
|
存储 编解码 弹性计算
案例分享——趣拍|学习笔记
快速学习 案例分享——趣拍
150 0
|
安全 运维
精彩回放|《安全说道》节目合集
用声音传递安全价值,用专业守护云上安全
3467 0
精彩回放|《安全说道》节目合集