clang:在 Win10 上编译 MIDI 音乐程序(二)

先从 Microsoft C++ Build Tools - Visual Studio

下载 1.73GB 安装 "Microsoft C++ Build Tools“

访问 Swift.org - Download Swift
找到 Windows 10:x86_64
下载 swift-5.10-RELEASE-windows10.exe  大约490MB
建议安装在 D:\Swift\ ,安装后大约占2.56GB

简单来说,Clang是一个编译器,目前用来编译C、C++、Objective-C语言。

where clang
D:\Swift\Toolchains\5.10.0+Asserts\usr\bin\clang.exe

cd D:\Swift\testc

短笛伴奏《祝你生日快乐》,编辑  happy_birthday_2u.cpp  如下

#include <iostream>
#include <windows.h>  
#include <mmsystem.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 // F大调
{H1 = F2, H2 = G2, H3 = A2, H4 = B2, H5 = C3, H6 = D3, H7 = E3,J1 = F3, J2 = G3, J3 = A3, J4 = B3, J5 = C4, J6 = D4, J7 = E4,K1 = F4, K2 = G4, K3 = A4, K4 = B4, K5 = C5, K6 = D5, K7 = E5,L1 = F5, L2 = G5, L3 = A5, L4 = B5, L5 = C6, L6 = D6, L7 = E6,LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,_ = 0xFF
};
// score: Happy birthday to you
int hb2u[] = {J5,J5,J6,J5,K1,J7,J5,J5,J6,J5,K2,K1,J5,J5,K5,K3,K1,J7,J6,K4,K4,K3,K1,K2,K1,
};
// 时长数组 MIDDLE_SPEED
int shichang[] = {400,400,800,800,800,1600,400,400,800,800,800,1600,400,400,800,800,800,800,800,600,200,800,800,800,2000,
};
// 力度
int lidu[] = {1,0,0,2,0,0,1,0,0,2,0,0,1,0,0,2,1,0,0,2,2,0,0,2,1,
};
// 演奏歌曲《祝你生日快乐》
void happy_birthday()
{HMIDIOUT handle;midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL); // 打开midi设备midiOutShortMsg(handle, 72 << 8 | 0xC2); // 设置通道2的乐器为 72:短笛unsigned char sd = 0x90 | (2 & 0x0F); // statusByte: 0为声道unsigned short note = 0;    //音符编号unsigned short v = 120; // velocity 力度值,范围通常在0-127int n = sizeof(lidu) / sizeof(lidu[0]); cout <<"n= " << n << endl;for (int i=0; i < n; i++) {note = hb2u[i];if (lidu[i] ==0) v = 40;else if(lidu[i] ==1) v = 80;else if (lidu[i] ==2) v = 120;unsigned long noteOnMsg = (((unsigned long)v <<16) | (((unsigned long)note) <<8) | (unsigned long)sd);midiOutShortMsg(handle, noteOnMsg); // 发送MIDI消息Sleep(shichang[i]); // 停顿,给音节演奏的时间midiOutShortMsg(handle, 0x7BB2); // 停止通道2上的演奏}midiOutShortMsg(handle, 0x7BB2); // 停止通道2上的演奏midiOutClose(handle); // 关闭midi设备
}int main()
{happy_birthday();return 0;
}

编译  clang happy_birthday_2u.cpp -o happy_birthday_2u.exe

运行  happy_birthday_2u.exe


钢琴伴奏《祝你生日快乐》,编辑  happy_birthday_2y.cpp  如下

#include <iostream>
#include <windows.h>  
#include <mmsystem.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 // F大调
{H1 = F2, H2 = G2, H3 = A2, H4 = B2, H5 = C3, H6 = D3, H7 = E3,J1 = F3, J2 = G3, J3 = A3, J4 = B3, J5 = C4, J6 = D4, J7 = E4,K1 = F4, K2 = G4, K3 = A4, K4 = B4, K5 = C5, K6 = D5, K7 = E5,L1 = F5, L2 = G5, L3 = A5, L4 = B5, L5 = C6, L6 = D6, L7 = E6,LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,_ = 0xFF
};
// score: Happy birthday to you
int hb2u[] = {J5,J5,J6,J5,K1,J7,J5,J5,J6,J5,K2,K1,J5,J5,K5,K3,K1,J7,J6,K4,K4,K3,K1,K2,K1,
};
// 时长数组 MIDDLE_SPEED
int shichang[] = {400,400,800,800,800,1600,400,400,800,800,800,1600,400,400,800,800,800,800,800,600,200,800,800,800,2000,
};
// 力度
int lidu[] = {1,0,0,2,0,0,1,0,0,2,0,0,1,0,0,2,1,0,0,2,2,0,0,2,1,
};
// 演奏歌曲《祝你生日快乐》
void happy_birthday()
{HMIDIOUT handle;midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);midiOutShortMsg(handle, 0 << 8 | 0xC0); // 设置通道0的乐器为 大钢琴unsigned short note = 0;    // 音符编号unsigned short v = 100; // velocity 力度值,范围通常在0-127unsigned char sd = 0x90 | (0 & 0x0F);// statusByte: 0为声道int n = sizeof(lidu) / sizeof(lidu[0]); cout <<"n= " << n << endl;for (int i=0; i < n; i++) {note = hb2u[i];if (lidu[i] ==0) v = 50;else if(lidu[i] ==1) v = 80;else if (lidu[i] ==2) v = 127;// 组合3个字节的消息到一个DWORD值unsigned long noteOnMsg = (((unsigned long)v <<16) | (((unsigned long)note) <<8) | (unsigned long)sd);// 发送MIDI消息midiOutShortMsg(handle, noteOnMsg);Sleep(shichang[i]); // 停顿,给音节演奏的时间midiOutShortMsg(handle, 0x7BB0); // 停止通道0上的演奏}midiOutClose(handle);
}int main()
{happy_birthday();return 0;
}

编译  clang happy_birthday_2y.cpp -o happy_birthday_2y.exe

运行  happy_birthday_2y.exe


命令行参数化 乐器伴奏《祝你生日快乐》,编辑  happy_birthday_to.cpp  如下

#include <iostream>
#include <windows.h>  
#include <mmsystem.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 // F大调
{H1 = F2, H2 = G2, H3 = A2, H4 = B2, H5 = C3, H6 = D3, H7 = E3,J1 = F3, J2 = G3, J3 = A3, J4 = B3, J5 = C4, J6 = D4, J7 = E4,K1 = F4, K2 = G4, K3 = A4, K4 = B4, K5 = C5, K6 = D5, K7 = E5,L1 = F5, L2 = G5, L3 = A5, L4 = B5, L5 = C6, L6 = D6, L7 = E6,LOW_SPEED = 500, MIDDLE_SPEED = 400, HIGH_SPEED = 300,_ = 0xFF
};
// score: Happy birthday to you
int hb2u[] = {J5,J5,J6,J5,K1,J7,J5,J5,J6,J5,K2,K1,J5,J5,K5,K3,K1,J7,J6,K4,K4,K3,K1,K2,K1,
};
// 时长数组 MIDDLE_SPEED
int shichang[] = {400,400,800,800,800,1600,400,400,800,800,800,1600,400,400,800,800,800,800,800,600,200,800,800,800,2000,
};
// 力度
int lidu[] = {1,0,0,2,0,0,1,0,0,2,0,0,1,0,0,2,1,0,0,2,2,0,0,2,1,
};
// 演奏歌曲《祝你生日快乐》
void happy_birthday(int yinse)
{HMIDIOUT handle;midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL);midiOutShortMsg(handle, yinse << 8 | 0xC1); // 设置通道1的乐器unsigned short note = 0;    // 音符编号unsigned short v = 100; // velocity 力度值,范围通常在0-127unsigned char sd = 0x90 | (1 & 0x0F);// statusByte: 0为声道int n = sizeof(lidu) / sizeof(lidu[0]); cout <<"n= " << n << endl;for (int i=0; i < n; i++) {note = hb2u[i];if (lidu[i] ==0) v = 50;else if(lidu[i] ==1) v = 80;else if (lidu[i] ==2) v = 127;// 组合3个字节的消息到一个DWORD值unsigned long noteOnMsg = (((unsigned long)v <<16) | (((unsigned long)note) <<8) | (unsigned long)sd);// 发送MIDI消息midiOutShortMsg(handle, noteOnMsg);Sleep(shichang[i]); // 停顿,给音节演奏的时间midiOutShortMsg(handle, 0x7BB1); // 停止通道1上的演奏}midiOutClose(handle);
}int main(int argc,char *argv[])
{if (argc > 1){int n = atoi(argv[1]);if (0<=n && n<128) happy_birthday(n);else cout << " 0<=n and n<128 ";} else {cout << " usage: happy_birthday_to n ";}return 0;
}

编译  clang happy_birthday_to.cpp -o happy_birthday_to.exe

# 乐器 26:电吉他 爵士
运行  happy_birthday_to.exe 26
# 乐器  40:小提琴
运行  happy_birthday_to  40
# 乐器  42:大提琴
运行  happy_birthday_to  42
# 乐器 65:中音萨克斯风
运行  happy_birthday_to 65


参阅:C语言midi编程钢琴演奏

音色表

/*General MIDI Level 1 旋律乐器对照表Note: 只向某个MIDI通道发送Program Change命令设置乐器,是不能发音的, 想要发音,还必须发出On开音符指令;有些乐器(笛)开始播放后,如果不发Off关音符指令,会持续发音很长时间.
*/
//Piano        1-8              键盘乐器             define = MIDI GM1列表序号 - 1
#define Acoustic_Grand_Piano    0       //平台钢琴
#define Bright_Acoustic_Piano   1       //亮音钢琴
#define Electric_Grand_Piano    2       //电钢琴
#define Honky_tonk_Piano        3       //酒吧钢琴
#define Electric_Piano_1        4       //电钢琴1
#define Electric_Piano_2        5       //电钢琴2
#define Harpsichord             6       //羽管键琴
#define Clavi                   7       //电翼琴
//Chromatic Percussion   9-16	固定音高敲击乐器     
#define Celesta                 8       //钢片琴
#define Glockenspiel            9       //钟琴
#define Music_Box               10      //音乐盒
#define Vibraphone              11      //颤音琴
#define Marimba                 12      //马林巴琴
#define Xylophone               13      //木琴
#define Tubular_Bells           14      //管钟
#define Dulcimer                15      //洋琴
//Organ         17-24	        风琴
#define Drawbar_Organ           16      //音栓风琴
#define Percussive_Organ        17      //敲击风琴
#define Rock_Organ              18      //摇滚风琴
#define Church_Organ            19      //教堂管风琴
#define Reed_Organ              20      //簧风琴
#define Accordion               21      //手风琴
#define Harmonica               22      //口琴
#define Tango_Accordion         23      //探戈手风琴
//Guitar        25-32	        吉他
#define Acoustic_Guitar_nylon   24      //木吉他 尼龙弦
#define Acoustic_Guitar_steel   25      //木吉他 钢弦
#define Electric_Guitar_jazz    26      //电吉他 爵士
#define Electric_Guitar_clean   27      //电吉他 原音
#define Electric_Guitar_muted   28      //电吉他 闷音
#define Overdriven_Guitar       29      //电吉他 破音
#define Distortion_Guitar       30      //电吉他 失真
#define Guitar_harmonics        31      //吉他泛音
//Bass          33-40	        贝斯
#define Acoustic_Bass           32      //民谣贝司
#define Electric_Bass_finger    33      //电贝司 指奏
#define Electric_Bass_pick      34      //电贝司 拨奏
#define Fretless_Bass           35      //无格贝斯
#define Slap_Bass_1             36      //捶钩贝斯1
#define Slap_Bass_2             37      //捶钩贝斯2
#define Synth_Bass_1            38      //合成贝司1
#define Synth_Bass_2            39      //合成贝司2
//Strings       41-48	        弦乐器
#define Violin                  40      //小提琴
#define Viola                   41      //中提琴
#define Cello                   42      //大提琴
#define Contrabass              43      //低音大提琴
#define Tremolo_Strings         44      //颤弓弦乐
#define Pizzicato_Strings       45      //弹拨弦乐
#define Orchestral_Harp         46      //竖琴
#define Timpani                 47      //定音鼓
//Ensemble      49-56	        合奏
#define String_Ensemble_1       48      //弦乐合奏1
#define String_Ensemble_2       49      //弦乐合奏2
#define SynthStrings_1          50      //合成弦乐1
#define SynthStrings_2          51      //合成弦乐2
#define Choir_Aahs              52      //人声“啊”
#define Voice_Oohs              53      //人声“喔”
#define Synth_Voice             54      //合成人声
#define Orchestra_Hit           55      //交响打击乐
//Brass         57-64	        铜管乐器
#define Trumpet                 56      //小号
#define Trombone                57      //长号
#define Tuba                    58      //大号
#define Muted_Trumpet           59      //闷音小号
#define French_Horn             60      //圆号/法国号
#define Brass_Section           61      //铜管乐
#define SynthBrass_1            62      //合成铜管1
#define SynthBrass_2            63      //合成铜管2
Reed          65-72	        簧乐器
#define Soprano_Sax             64      //高音萨克斯风
#define Alto_Sax                65      //中音萨克斯风
#define Tenor_Sax               66      //次中音萨克斯风
#define Baritone_Sax            67      //上低音萨克斯风
#define Oboe                    68      //双簧管
#define English_Horn            69      //英国管
#define Bassoon                 70      //低音管
#define Clarinet                71      //单簧管
//Pipe          73-80	        吹管乐器
#define Piccolo                 72      //短笛
#define Flute                   73      //长笛
#define Recorder                74      //直笛
#define Pan_Flute               75      //排笛
#define Blown_Bottle            76      //瓶笛
#define Shakuhachi              77      //尺八
#define Whistle                 78      //哨子
#define Ocarina                 79      //陶笛
//Synth Lead    81-88	        合成音主旋律
#define Lead_1_square           80      //方波
#define Lead_2_sawtooth         81      //锯齿波
#define Lead_3_calliope         82      //汽笛风琴
#define Lead_4_chiff            83      //合成吹管
#define Lead_5_charang          84      //合成电吉他
#define Lead_6_voice            85      //人生键盘
#define Lead_7_fifths           86      //五度音
#define Lead_8_bass_lead        87      //贝司吉他合奏
//Synth Pad     89-96	        合成音和弦衬底
#define Pad_1_new age           88      //新世纪
#define Pad_2_warm              89      //温暖
#define Pad_3_polysynth         90      //多重和音
#define Pad_4_choir             91      //人生合唱
#define Pad_5_bowed             92      //玻璃
#define Pad_6_metallic          93      //金属
#define Pad_7_halo              94      //光华
#define Pad_8_sweep             95      //扫掠
//Synth Effects 97-104	        合成音效果
#define FX_1_rain               96      //雨
#define FX_2_soundtrack         97      //电影音效
#define FX_3_crystal            98      //水晶
#define FX_4_atmosphere         99      //气氛
#define FX_5_brightness         100     //明亮
#define FX_6_goblins            101     //魅影
#define FX_7_echoes             102     //回音
#define FX_8_sci_fi             103     //科幻
//Ethnic        105-112	        民族乐器
#define Sitar                   104     //西塔琴
#define Banjo                   105     //五弦琴/斑鸠琴
#define Shamisen                106     //三味线
#define Koto                    107     //十三弦琴/古筝
#define Kalimba                 108     //卡林巴铁片琴
#define Bag_pipe                109     //苏格兰风琴
#define Fiddle                  110     //古提琴
#define Shanai                  111     //獸笛,类似唢呐
//Percussive    113-120	        打击乐器
#define Tinkle_Bell             112     //叮铛铃
#define Agogo                   113     //阿哥哥鼓
#define Steel_Drums             114     //钢鼓
#define Woodblock               115     //木鱼
#define Taiko_Drum              116     //太鼓
#define Melodic_Tom             117     //定音铜鼓
#define Synth_Drum              118     //合成股
#define Reverse_Cymbal          119     //逆转钹声
//Sound Effects 121-128	        特殊音效
#define Guitar_Fret_Noise       120     //吉他滑弦杂声
#define Breath_Noise            121     //呼吸杂声
#define Seashore                122     //海岸
#define Bird_Tweet              123     //鸟鸣
#define Telephone_Ring          124     //电话铃声
#define Helicopter              125     //直升机
#define Applause                126     //拍手
#define Gunshot                 127     //枪声

音码表

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/319411.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《金融研究》:普惠金融改革试验区DID工具变量数据(2012-2023年)

数据简介&#xff1a;本数据集包括普惠金融改革试验区和普惠金融服务乡村振兴改革试验区两类。 其中&#xff0c;河南兰考、浙江宁波、福建龙岩和宁德、江西赣州和吉安、陕西铜川五省七地为普惠金融改革试验区。山东临沂、浙江丽水、四川成都三地设立的是普惠金融服务乡村振兴…

手撸Mybatis(二)—— 配置项的获取

本专栏的源码&#xff1a;https://gitee.com/dhi-chen-xiaoyang/yang-mybatis。 配置项解析 在mybatis中&#xff0c;一般我们会定义一个mapper-config.xml文件&#xff0c;来配置数据库连接的相关信息&#xff0c;以及我们的mapperxml文件存放目录。在本章&#xff0c;我们会…

docker-compose启动mysql5.7报错

描述一下问题经过&#xff1a; 使用docker compose 部署mysql5.7 文件如下: 使用命名卷的情况下&#xff0c;匿名卷不存在该问题 services:mysql:restart: alwaysimage: mysql:5.7container_name: mysql-devports:- 3306:3306environment:- MYSQL_DATABASEdev- MYSQL_ROOT_PAS…

团队经理口才训练教案(3篇)

团队经理口才训练教案&#xff08;3篇&#xff09; **篇&#xff1a;基础口才训练 一、教学目标 让团队经理了解口才在团队管理中的重要性。 教授基础口才技巧&#xff0c;如发音、语速、语调等。 二、教学内容 口才的重要性 强调团队经理的口才能力对团队凝聚力、沟通…

详细介绍ARM-ORACLE Database 19c数据库下载

目录 1. 前言 2. 获取方式 2.1 ORACLE专栏 2.2 ORACLE下载站点 1. 前言 现有网络上已有非常多关于ORACLE数据库机下载的介绍&#xff0c;但对于ARM平台的介绍不多&#xff0c;借此机会我将该版的下载步骤做如下说明&#xff0c;希望能够一些不明之人提供帮助和参考 2. 获…

分享一篇关于AGI的短文:苦涩的教训

学习强化学习之父、加拿大计算机科学家理查德萨顿&#xff08; Richard S. Sutton &#xff09;2019年的经典文章《The Bitter Lesson&#xff08;苦涩的教训&#xff09;》。 文章指出&#xff0c;过去70年来AI研究走过的最大弯路&#xff0c;就是过于重视人类既有经验和知识&…

Flutter笔记:美工设计.导出视频到RIVE

Flutter笔记 美工设计.导出视频到RIVE - 文章信息 - Author: 李俊才 (jcLee95) Visit me at CSDN: https://jclee95.blog.csdn.netMy WebSite&#xff1a;http://thispage.tech/Email: 291148484163.com. Shenzhen ChinaAddress of this article:https://blog.csdn.net/qq_28…

目标跟踪—卡尔曼滤波

目标跟踪—卡尔曼滤波 卡尔曼滤波引入 滤波是将信号中特定波段频率滤除的操作&#xff0c;是抑制和防止干扰的一项重要措施。是根据观察某一随机过程的结果&#xff0c;对另一与之有关的随机过程进行估计的概率理论与方法。 历史上最早考虑的是维纳滤波&#xff0c;后来R.E.卡…

原生IP和住宅IP有什么区别?

原生IP和住宅IP在多个方面存在显著的区别。 从定义和来源来看&#xff0c;原生IP是指未经NAT&#xff08;网络地址转换&#xff09;处理的真实、公网可路由的IP地址&#xff0c;它直接从互联网服务提供商&#xff08;ISP&#xff09;获得&#xff0c;而不是通过代理服务器或VP…

【MATLAB】解决不同版本MATLAB出现中文乱码的问题

解决不同版本MATLAB出现中文乱码的问题 方法1&#xff1a;更改保存类型为GBK方法2&#xff1a;记事本打开方法3&#xff1a;Notepad参考 低版本matlab打开高版本Matlab的.m文件时&#xff0c;出现中文乱码问题。比如下图&#xff1a; 出现原因为&#xff1a; 编码格式不统一问…

批量抓取某电影网站的下载链接

思路&#xff1a; 进入电影天堂首页&#xff0c;提取到主页面中的每一个电影的背后的那个urL地址 a. 拿到“2024必看热片”那一块的HTML代码 b. 从刚才拿到的HTML代码中提取到href的值访问子页面&#xff0c;提取到电影的名称以及下载地址 a. 拿到子页面的页面源代码 b. 数据提…

Ansys Speos|进行智能手机镜头杂散光分析

本例的目的是研究智能手机Camera系统的杂散光。杂散光是指光向相机传感器不需要的散光光或镜面光&#xff0c;是在光学设计中无意产生的&#xff0c;会降低相机系统的光学性能。 在本例中&#xff0c;光学透镜系统使用Ansys Zemax OpticStudio (ZOS)进行设计&#xff0c;并使用…

A Bug‘s Life (并查集)

//新生训练 #include <iostream> #include <algorithm> using namespace std; const int N 5000; int p[N], sz[N]; int n, m; int find(int x) {if (p[x] ! x)p[x] find(p[x]);return p[x]; } int main() {int T;scanf("%d", &T);for (int k 1; …

RabbitMQ之顺序消费

什么是顺序消费 例如&#xff1a;业务上产生者发送三条消息&#xff0c; 分别是对同一条数据的增加、修改、删除操作&#xff0c; 如果没有保证顺序消费&#xff0c;执行顺序可能变成删除、修改、增加&#xff0c;这就乱了。 如何保证顺序性 一般我们讨论如何保证消息的顺序性&…

Flask教程3:jinja2模板引擎

文章目录 模板的导入与使用 模板的导入与使用 Flask通过render_template来实现模板的渲染&#xff0c;要使用这个方法&#xff0c;我们需要导入from flask import rander_template&#xff0c;模板中注释需放在{# #}中 模板的第一个参数为指定的模板文件名称&#xff0c;如自定…

gige工业相机突破(一,准备资源)

gige相机能不能绕开相机生产商提供的sdk&#xff0c;而直接取到像&#xff1f; 两种办法&#xff0c;第一&#xff0c;gige vision2.0说明书&#xff0c;第二&#xff0c;genicam 首先你会去干什么事&#xff1f; 好几年&#xff0c;我都没有突破&#xff0c;老虎吃天&#x…

鸿蒙开发仿咸鱼TabBar

鸿蒙开发自定义TabBar&#xff0c;实现tabBar 上中间按钮凸起效果 第一步、定义数据模型 export default class TabItemData{defaultIcon: ResourceselectedIcon: Resourcetitle: stringisMiddle: booleanconstructor(defaultIcon:Resource, selectedIcon:Resource, title:st…

5分钟速通大语言模型(LLM)的发展与基础知识

✍️ 作者&#xff1a;哈哥撩编程&#xff08;视频号同名&#xff09; 博客专家全国博客之星第四名超级个体COC上海社区主理人特约讲师谷歌亚马逊演讲嘉宾科技博主极星会首批签约作者 &#x1f3c6; 推荐专栏&#xff1a; &#x1f3c5; 程序员&#xff1a;职场关键角色通识宝…

Rust web简单实战

一、使用async搭建简单的web服务 1、修改cargo.toml文件添加依赖 [dependencies] futures "0.3" tokio { version "1", features ["full"] } [dependencies.async-std] version "1.6" features ["attributes"]2、搭…

Java发送请求-http+https的

第一步&#xff1a;建议ssl连接对象&#xff0c;信任所有证书 第二步&#xff1a;代码同时支持httphttps 引入源码类 是一个注册器 引入这个类&#xff0c;和它的方法create 注册器&#xff0c;所以对http和https都进行注册&#xff0c;参数为id和item&#xff0c;其中http的…