avatar
Articles
210
Tags
95
Categories
22

Theqiqi_blog
Search

Theqiqi_blog

10.使用C语言创建一个MIDI格式的文件
Created2024-08-22|C_Sound|C•Sound
[toc] 使用C语言在Windows中创建一个MIDI格式的文件1.使用C语言在Windows中创建一个MIDI格式的文件(未能成功)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdint.h>typedef struct { char chunk_type[5]; // Chunk type uint32_t header_size; // Header s ...
9.使用C语言将PCM文件转为对应的音符与频率
Created2024-08-22|C_Sound|C•Sound
[toc] 使用C语言将PCM文件转为对应的音符与频率(毫无准确率)1.准备FFTW64库 使用vcpkg安装fftw3库 2.使用C语言将PCM文件转为对应的频率123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <fftw3.h>#include <math.h>void analyze_pcm(const char* filename) { // 打开 PCM 文件 FILE* file = fopen(filename, "rb"); if (!file) { printf("无法打开文件: %s\n", filename); ...
8.用C语言与音符播放钢琴曲梦中的婚礼
Created2024-08-22|C_Sound|C•Sound•Piano
[toc] 用C语言与音符播放钢琴曲梦中的婚礼1.使用MDI函数播放钢琴曲卡农1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#include <stdio.h>#include <windows.h>#pragma comment(lib, "winmm.lib")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 = 8 ...
6.使用C语言将PCM文件编码成WAV文件
Created2024-08-21|C_Sound|C•Sound
[toc] C语言将PCM编码成WAV文件 准备一个pcm文件 编写代码并编译main.exe 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdint.h>#include <assert.h>#include <sys/stat.h>#pragma warning(disable:4996)size_t getFileSize(const char* filename) { struct stat st; if (stat(f ...
使用C语言在Windows中录制一个PCM音频文件
Created2024-08-21|C_Sound|C•Sound
[toc] 使用C语言在Windows中录制一个PCM音频文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879#define _CRT_SECURE_NO_WARNINGS#include <windows.h>#include <mmsystem.h>#include <stdio.h>#pragma comment(lib, "winmm.lib")#define BUFFER_SIZE 44100 // 1 second of audio at 44.1kHz#define SAMPLE_RATE 44100#define NUM_CHANNELS 1#define BITS_PER_SAMPLE 16typedef struct { WAVEHDR head ...
3.使用C语言在Windows中创建PCM格式的音频文件
Created2024-08-20|C_Sound|C•Sound
[toc] 使用C语言在Windows中创建PCM格式的音频文件PCM文件里面存储的是经过数模转换后存储的二进制文件,需要支持的播放器才能播放。 1.保存do re mi fa so la ti do到PCM文件中12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdint.h>#include <stdlib.h>#include <math.h>// 定义 M_PI#ifndef M_PI#define M_PI 3.14159265358979323846#endif#define SAMPLE_RATE 44100#define NUM_CHANNELS 1#define BITS_PER_SAMPLE 16#define DURATION 0.25 // 每 ...
3.使用C语言在Windows中创建WAV格式的音频文件
Created2024-08-20|C_Sound|C•Sound
[toc] 使用C语言在Windows中创建WAV格式的音频文件1. 创建WAV格式的音频文件12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <math.h>#include <stdint.h>#include <string.h>#include <stdlib.h>#define SAMPLE_RATE 44100#define DURATION 0.1 // 每个音符的持续时间(秒)#define AMPLITUDE 32767 // 最大振幅(16位音频)// 定义 M_PI#ifndef M_PI#define M_ ...
2.C语言在Windows中播放特定频率的声音
Created2024-08-20|C_Sound|C•Sound
[toc] C语言在Windows中播放特定频率的声音1.C语言在Windows中使用Beep播放特定频率的声音12345678910111213141516171819#include <windows.h>#include <stdio.h>int main() { // 播放432Hz的声音,持续0.5秒 Beep(432, 500); // 播放440Hz的声音,持续0.5秒 Beep(440, 500); // 播放1000Hz的声音,持续0.5秒 Beep(1000, 500); // 播放2000Hz的声音,持续0.5秒 Beep(2000, 500); return 0;} 2.C语言在Windows中使用waveOut播放特定频率的声音1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 ...
2.3.C语言在Windows中播放do_ re _mi_fa_so_la _ti_do
Created2024-08-20|C_Sound|C•Sound
[toc] C语言在Windows中播放乐谱1.C语言在Windows中通过音符相关函数播放一秒432HZ的声音123456789101112131415161718192021222324252627282930#include <stdio.h>#include <windows.h>#include <math.h>#pragma comment(lib, "winmm.lib")void PlayTone(double frequency, int duration) { HMIDIOUT handle; midiOutOpen(&handle, 0, 0, 0, CALLBACK_NULL); int volume = 0x7f; // 最大音量 int sleep = duration; // 每个音符的持续时间 // 计算432Hz对应的MIDI音符 int midiNote = (int)(69 + 12 * log2(frequency / 440.0)) ...
33.在x86_64中不用call指令修改返回地址调用函数
Created2024-08-16|c+windows+hacking|C•Windows•Hacking•assembly
在x86_64中不用call指令修改返回地址调用函数修改返回地址调用函数hello 准备环境vs2022。 start.asm 123456789101112131415161718192021222324252627282930313233343536373839404142434445;assembly.asmextrn hello : PROC.codefunnormal PROC; 正常调用函数 ; shadow space 32 bytes sub rsp, 40 ; 保持16字节对齐 + 预留 shadow space mov ecx, 123 ; RCX = 第一个参数(Windows x64 ABI) call hello ; 正常调用函数 add rsp, 40 xor eax, eax ; return 0 retfunnormal ENDPvulnerable PROC;修改返回地址调用函数 push rbp mov rbp, rsp ; retu ...
1…111213…21
avatar
Theqiqi
Articles
210
Tags
95
Categories
22
Follow Me
Announcement
This is my Blog
Recent Post
101.使用Grop网站提供的api2026-01-03
9.压测2025-03-27
8.Linux Socket并发模型http服务器2025-03-27
7.web服务器中收发REST接口2025-03-27
6使用c语言与linux系统写一个web服务器,解析并响应get与post请求2025-03-27
Categories
  • C with Socks16
  • C_Sound10
  • C_Windows_Graphi9
  • Cpp5
  • Cpp_Socket4
  • C语言在Windows中实现抓包4
  • C语言的万种用法9
  • Debian1
Tags
C++ Websocket Socks5 REST API rufus ISO cmake c_windows_driver OpenGl Debian MySql mysql Drvier x86汇编程序 System qemu Http http AI first pragram Direct2D TCP 64位汇编程序 Linux Desktop make WindowsDriver link nasm Socks html ipv6 Cmake Python windows driver Ipv6 sql UltraISO Capture Socket
Archives
  • January 20261
  • March 202558
  • February 202523
  • September 20242
  • August 202471
  • June 20242
  • March 20245
  • February 20248
Info
Article :
210
UV :
PV :
Last Update :
©2020 - 2026 By Theqiqi
Framework Hexo|Theme Butterfly
Search
Loading the Database