Friday, August 13, 2021

NanoEuclid - An Arduino Based Euclidean Sequencer

 NanoEuclid

Arduino-based Euclid Rhythm Sequencer

Features

This sequencer is inspired by Euclidean Circles v2 by vpme.de.

It has 4 channels: A, B, C, D

Internal (with tempo control) or external clock operation

Each channel can adjust the pattern length (1-16) and number of active spots in the pattern (1 to pattern length) and the offset of the pattern start within the cycle

The euclidean “algorithm” places the active beats within the pattern of a given length in a way that spreads them equally as much as possible.




A 16 color led circle shows the parameters and a rotary encoder at the center of the ring is used as the main interactive control

The module provides 4 gate signals for Eurorack.

Each channel can have a different pattern, and the 4 channels together with their patterns constitute a “patch”.

Up to 16 patches can be saved and later loaded from EEPROM, so if you got something cool, it will not be lost..

The module has a play/stop button, and once playing can be triggered from an internal clock whose rate is controlled with a potentiometer, or switched to use an external clock from Eurorack.

User Interface

  1. int/ext toggle switch - setting the clock source

  2. Tempo pot. - used when clock is internal to set the tempo BPM

  3. 16 RGB Led circle (Nano Pixels) to show setup, pattern and real time playback

    1. Channel Colors are Yellow, Orange, Light Red and Red, where the leds in those color show the pattern length.

    2. According to the mode (selected by pushing the rotary encoder), the actrive beats are shown in Purple (edit number of active), Blue (edit pattern offset), Cyan (edit pattern length).

    3. When in play mode, the current step is highlighted in green

    4. In Store mode (entered by long clicking the rotaty encoder), the whole 16 pixels are turned red (if the corresponding slot is free) or green (if the corresponding memory slot is taken). Selected memory position is highlighted in white. Selected position is moved with the rotary encoder. Clicking the CHN/store button stores the current pattern to the selected position (overriding existing stored pattern if there was one). If the selected position is a programmed one (Green), clicking the PLAY/load button loades the stored patch to the active pattern.

  1. PLAY push button (toggles between start and stop modes)

  2. Rotary encoder with push button action to set parameters as described above

  3. CHN Select push button - cycles between the 4 channels



User Interface

The circuit is based on an Arduino Nano Every board, as shown below.

  1. Clock input - a 2N3904 transistor is used as an inverting buffer to protect the arduino, two resistors and a diode are connected (one resistor from input to base, one resistor from collector to +5V, diode cathode to base, anode to ground). Input from collector to D10.

  2. Gate outputs - digital pins 2,3,4,5 go to gate output

  3. NeoPixels ring - digital pin 6 drives the LED ring

  4. Rotary encoder inputs - D7, D8

  5. Rotary encoder switch - D9

  6. Play/Stop push connected as INPUT PULLUP to ground and D11

  7. Channel select push is connected to ground and to A3, A3 connected with 1M resistor to v+

  8. Int/Ext Switch - ground to D12


Storage

EEPROM size on Nano Every is 256 bytes, we would like to store patches into it, so they can be called upon later and survive power downs.

This section explains the arrangement of the data in this rather small memory space.

Each patch consists of 4 channels, each channel has 3 parameters: pattern length, number of active beats and offset. Each parameter can be stored in 4 bits, so the channel data is stored in 1.5 bytes, and the whole 4 channels in 8 bytes.

As the GUI consists of 16 LEDS, we will limit the pattern storage to 16 patches, to simplify the user interface.

To simplify managing the memory, we can store 2 bytes of 16 bits telling us if the respective slot is already stored.


offset

Byte 0

Byte 1

0

Magic Pattern ($AAAA)

2

Bitmap of taken slots for patches (1=taken)

4

PATCH #0

Pattern Length A

PATCH #0

Active Beats A

PATCH #0

UNUESDE Nibble (0x00)

PATCH #0

Offset A

6

PATCH #0

Pattern Length B

PATCH #0

Active Beats B

PATCH #0

UNUESDE Nibble (0x00)

PATCH #0

Offset B

8

PATCH #0

Pattern Length C

PATCH #0

Active Beats C

PATCH #0

UNUESDE Nibble (0x00)

PATCH #0

Offset C

10

PATCH #0

Pattern Length D

PATCH #0

Active Beats D

PATCH #0

UNUESDE Nibble (0x00)

PATCH #0

Offset D

12

PATCH #1

Pattern Length A

PATCH #1

Active Beats A

PATCH #1

UNUESDE Nibble (0x00)

PATCH #1

Offset A

14

PATCH #1

Pattern Length B

PATCH #1

Active Beats B

PATCH #1

UNUESDE Nibble (0x00)

PATCH #1

Offset B

16

PATCH #1

Pattern Length C

PATCH #1

Active Beats C

PATCH #1

UNUESDE Nibble (0x00)

PATCH #1

Offset C

118

PATCH #1

Pattern Length D

PATCH #1

Active Beats D

PATCH #1

UNUESDE Nibble (0x00)

PATCH #1

Offset D


Storage

The source code is available at this repo here:
https://github.com/iroth/nanoeuclid
See the readme for additional info, and feel free to comment, or branch...


No comments:

Post a Comment