방탄소년단 버터의 멜로디를 아두이노 피에조 부저를 이용하여 재생하는 코드입니다. 

아두이노 우노 / NodeMcu / ESP32 DevKit용 예제 스케치입니다. 

 

방탄소년단 Butter 피에조부저 악보

 

 

 

Uno_bts_butter.zip
0.00MB
nodeMcu_bts_butter.zip
0.00MB
esp32_melody_butter.zip
0.00MB

uint8_t Tempo = 110;
float tempoRatio = float(Tempo)/60.0;
uint8_t KeySign = 4;
uint8_t octaveTemp = 4;
// float beatTime = 4/4; // 박자표 - 멜로디 코드에서는 사용하지 않는다.(Simple Melody 앱만 사용)

const note_t Mnote[] PROGMEM= {
NOTE_G,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_A,NOTE_A,NOTE_G,NOTE_MAX,NOTE_G,NOTE_G,NOTE_F,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_A,NOTE_G,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_C,NOTE_C,NOTE_C,
NOTE_MAX,NOTE_D,NOTE_E,NOTE_A,NOTE_A,NOTE_A,NOTE_C,NOTE_MAX,NOTE_G,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_A,NOTE_G,NOTE_MAX,NOTE_G,NOTE_G,NOTE_F,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_MAX,
NOTE_G,NOTE_F,NOTE_E,NOTE_C,NOTE_MAX,NOTE_C,NOTE_C,NOTE_MAX,NOTE_D,NOTE_E,NOTE_A,NOTE_A,NOTE_A,NOTE_A,NOTE_MAX,NOTE_MAX,NOTE_E,NOTE_E,NOTE_E,NOTE_E,NOTE_MAX,NOTE_E,NOTE_E,NOTE_E,NOTE_A,
NOTE_MAX,NOTE_E,NOTE_E,NOTE_E,NOTE_E,NOTE_MAX,NOTE_E,NOTE_E,NOTE_A,NOTE_MAX,NOTE_E,NOTE_E,NOTE_E,NOTE_E,NOTE_MAX,NOTE_E,NOTE_E,NOTE_E,NOTE_A,NOTE_E,NOTE_F,NOT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,1,2,1,1,2,4,
};

 

2023년 2월 7일 업데이트 파일

esp32_melody_butter_update.zip
0.00MB
nodeMcu_bts_butter_update.zip
0.00MB
Uno_bts_butter_update.zip
0.00MB

 

 

https://youtu.be/1BuKugzsEFs

 

 

자막에 설명 있습니다.

https://youtu.be/onkxA5WYSqc

 

butter.note
0.01MB

 

 

[arduino] - 아두이노/ESP32 - 피에조 부저, 악보를 보고 동요 멜로디 코딩하기(동요 겨울밤, 다람쥐, 옹달샘, 작은별)

[arduino] - arduino - Simple Melody 이용 피에조 부저 멜로디 코딩하기, Esp01, EEPROM

[arduino] - 아두이노 - 피에조 부저 멜로디 BTS DNA

[arduino] - 아두이노 - 피에조 부저 멜로디 Hwasa Maria

[Arduino] - 아두이노 - 피에조 부저 멜로디 BTS Dynamite

반응형

+ Recent posts