# How to setup array structure for melody sequences

**URL:** <https://forum.arduino.cc/t/how-to-setup-array-structure-for-melody-sequences/1404240>\
**Category:** Programming\
**Created:** [August 26, 2025, 11:17am UTC](https://forum.arduino.cc/t/how-to-setup-array-structure-for-melody-sequences/1404240 "2025-08-26T11:17:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [August 26, 2025, 2:02pm UTC](https://forum.arduino.cc/t/how-to-setup-array-structure-for-melody-sequences/1404240/6 "2025-08-26T14:02:41Z")

</div>

> [@Petjepet](#):
>
> startup”.
> 
> How to set this up in an easy way?

- create a single-dimension array containing tones and durations. Format this array text for visual separation of songs.
- The first element of each "song" in this array will be the "song" number
- the second element will contain length of "song"
- make an enum() of song titles.
- when you call the "playSong(songName)" function, you search for the enum() song number, and extract the song length.
- play the song

You could also make a sequencer. Here is a link to a simple LED sequencer. If you make this into a music sequencer of twelve rows, each row could be a half-step note. Each song would look like sheet music.

> [@Uno/Nano DIO Sequencer](https://forum.arduino.cc/t/uno-nano-dio-sequencer/1364441/3):
>
> Version 4 added PROGMEM to preserve RAM previous limit was 250 elements of 10 rows // DIO sequencer version 4 - using PROGMEM // - char arrays are flat (one long string, no comma separators) // - edit array elements using (star) "\*" for "ON" and (dot) "." for "OFF" // - each row in an array must be the same length // https://forum.arduino.cc/t/uno-nano-dio-sequencer/1364441 #include \<avr/pgmspace.h\> // to offload arrays from RAM to PROGMEM byte ledPin[] = {4, 5, 6, 7, 8, 9, 10, 11, 12}; //…

> **[LEDsequencer - Wokwi ESP32, STM32, Arduino Simulator](https://wokwi.com/projects/425863953438420993)**
>
> Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!

---

_[View the full topic](https://forum.arduino.cc/t/how-to-setup-array-structure-for-melody-sequences/1404240)._
