arduino_midi_player/arduino-music-box-master/README.md
2025-03-24 14:30:56 +08:00

38 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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>
```
2. Electronics:
- Arduino Uno
- Piezo buzzer
- Wires (optional)
3. 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`)