arduino_midi_player/arduino-music-box-master
2025-03-24 14:30:56 +08:00
..
.github/workflows 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
docs 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
midi-storage 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
src 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
.gitignore 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
LICENSE 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
package-lock.json 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
package.json 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00
README.md 添加一些关于midi播放的项目 2025-03-24 14:30:56 +08:00

arduino-music-box

It's Node.js + Arduino project to play any midi file.

使用node.js把指定的midi文件转为频率和时间然后串口发送给arduino播放。

Prerequisites

  1. You need to provide the following environment variables to make it works (the easiest way is to create .env file in the project root folder)
SERIAL_PORT=<NAME_OF_SERIAL_PORT>
BOUD_RATE=<BOUD_RATE>
MIDI_STORAGE_FOLDER=<MIDI_STORAGE_FOLDER>
  1. Electronics:
    • Arduino Uno
    • Piezo buzzer
    • Wires (optional)
  2. Circuit scheme
    1. v1 - https://github.com/simonchuryakov/arduino-music-box/blob/master/docs/circuit_v1.jpg
    2. v2 - https://github.com/simonchuryakov/arduino-music-box/blob/master/docs/circuit_v2.jpg

How to run

To run the project you have to:

  1. Upload sketch file from src/arduino/play.ino to your Arduino Uno using Arduino IDE or whatever you use for arduino development
  2. Keep Arduino Uno connected to your computer
  3. Run in the terminal:
npm install
node src/node/index.js

By default it will start playing files from midi-storage (you can change it in the index.js)