计算机打出音乐 夜空中最亮的星,夜空中最亮的星-逃跑计划

Introduction

"夜空中最亮的星-逃跑计划" is a MIDI music piece in Pop Music style, played by an ensemble of 11 instruments including Acoustic Guitar (steel), Acoustic Grand Piano, Acoustic Bass, Synth Strings 2, Tremolo Strings, and Electric Guitar (muted).

The total duration of this midi music is 3 minutes and 55 seconds, with a total of 3,550 notes, divided into 10 tracks, and a single tempo of 107bpm.

The key signature marked in the MIDI file is C major, the marked beat is 4/4.

Some MIDI events such as pitch wheel, Pan, Channel Volume Control, Sustain pedal are used, to enhance the quality.

Meta Text

start end

start end

start end

start end

start end

start end

start end

start end

start end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下面是一个简单的使用Arduino编写的蜂鸣器演奏“夜空最亮”的代码: ``` int speakerPin = 8; // 蜂鸣器引脚 int melody[] = { // 演奏的音符 262, 262, 392, 392, 440, 440, 392, 349, 349, 330, 330, 294, 294, 262, 392, 392, 349, 349, 330, 330, 294, 392, 392, 349, 349, 330, 330, 294, 262, 262, 392, 392, 440, 440, 392, 349, 349, 330, 330, 294, 294, 262 }; int noteDurations[] = { // 音符持续时间 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 2 }; void setup() { pinMode(speakerPin, OUTPUT); // 将蜂鸣器引脚设置为输出 } void loop() { for (int i = 0; i < sizeof(melody) / sizeof(melody[0]); i++) { int duration = 1000 / noteDurations[i]; // 计算音符持续时间 tone(speakerPin, melody[i], duration); // 播放音符 delay(duration * 1.3); // 等待一段时间后停止播放 noTone(speakerPin); // 停止播放 } } ``` 在这个代码,我们定义了一个蜂鸣器引脚和一个包含所有演奏音符的数组和一个包含每个音符持续时间的数组。在`setup()`函数,我们将蜂鸣器引脚设置为输出。在`loop()`函数,我们使用`for`循环逐个演奏音符。我们使用`tone()`函数播放每个音符,并使用`delay()`函数等待一段时间后停止播放。最后,我们使用`noTone()`函数停止播放。 请注意,这只是一个简单的示例代码,您可以根据自己的需要进行修改和扩展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值