<commit_before># Arduino MusicBox

Arduino control code for a music maker board and a trellis keypad.

Hardware parts:
* Adafruit Feather 32u4 Basic Proto
* Adafruit FeatherWing MusicMaker
* Adafruit Trellis PCB, Elastomer, LED
* Amplifier
* Rotary Decoder
* LiPolymer 3.7V Akku

The control code shall
* read trellis keys
* on key press play a music file from the micro SD card from a specific folder and blink the respective key
* on pressing the same key or when playback stops jump to the next file in the folder, until all music is played
* read the rotary decoder to change the volume, the maximum volume can be configured
* detect when a headphone is plugged in and mute the amplifier for the internal speakers
* switch the music box  off automatically after an idle period


## Checkout this code
```
git clone https://github.com/joergkeller/arduino-musicbox.git
cd arduino-musicbox
git submodule init
git submodule update
```

## Prepare micro SD card
Copy \<musicbox\>/extras/config/*.cfg in root directory of the SD card.\
Create/fill folders album1 .. album16 with your music files.\
Stories and songs for NFC-chips can be in separate folders, list NFC id in nfc.cfg.


## Howto install using Arduino IDE

File > Preferences > Sketchbook locations:\
\<musicbox\> folder containing src, libraries, extra folders<commit_msg>complemented notes after debugging second device<commit_after># Arduino MusicBox

Arduino control code for a music maker board and a trellis keypad.

Hardware parts:
* Adafruit Feather 32u4 Basic Proto
* Adafruit FeatherWing MusicMaker
* Adafruit Trellis PCB, Elastomer, LED
* Amplifier
* Rotary Decoder
* LiPolymer 3.7V Akku

The control code shall
* read trellis keys
* on key press play a music file from the micro SD card from a specific folder and blink the respective key
* on pressing the same key or when playback stops jump to the next file in the folder, until all music is played
* read the rotary decoder to change the volume, the maximum volume can be configured
* detect when a headphone is plugged in and mute the amplifier for the internal speakers
* switch the music box  off automatically after an idle period


## Checkout this code
```
git clone https://github.com/joergkeller/arduino-musicbox.git
cd arduino-musicbox
git submodule init
git submodule update
```

## Remarks on the hardware
* Cut the "RESET" bridge on the Adafruit MusicMaker FeatherWing (otherwise a reset of the mp3 chip will also reset the arduino board).
* Set dip switches on the NFC board to use I2C (1: ON, 2: OFF)

## Prepare micro SD card
Copy \<musicbox\>/extras/config/*.cfg in root directory of the SD card.\
Create/fill folders album1 .. album16 with your music files.\
Stories and songs for NFC-chips can be in separate folders, list NFC id in nfc.cfg.


## Howto install using Arduino IDE

File > Preferences > Sketchbook locations:\
\<musicbox\> folder containing src, libraries, extra folders
{'fraction_non_alphanumeric': 0.05530897917377945, 'fraction_numerical': 0.006828269033799932, 'mean_word_length': 4.3369763205828775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2155284', 'n_tokens_mistral': 883, 'n_tokens_neox': 793, 'n_words': 426}