تنغيم

Hardware micro-tuning musical instrumentArabic tuning systems and beyond

The Tanghim prototype seen from the front on black sand, powered: record red, play green, sequencer steps gold and cyan, three keyboard controls purple, the navigation buttons and the slider stars in yellow, cyan and green
Tanghim from the rear, angled: USB-C, the six CV and gate jacks, MIDI in, out and thru, and the four 6.35 mm audio jacks, the panel lit behind them

The drawings

The front and the rear

Hidden-line drawings of the current prototype, from its 3D model. The 3D viewer shows it from every side, in each of its boxes.

The front

the panel, the headphones and the card slot
Tanghim, the front: outline drawing (MX + TL16, pla_mix box, keycap Option 1 Flat) Tempo · Volume RV16 tempo, RV15 volume (Alps RK09K, 9 mm) LED windows an RGB LED under each star: visual feedback for the sliders 8 sliders 45 mm, centre detent (RV1 - RV8): tuning and sequencer notes 6 control knobs RV9 - RV14 Function · Patterns the left column's upper keys: SW17 function, SW18 patterns Record · Play SW19 record, SW20 play (Cherry MX, RGB LED per key) Phones 3.5 mm headphone output, front Sequencer / keyboard 8 x 2 16 Cherry MX keys (SW1 - SW16), an RGB LED in each OLED screen 1.54 in, 128 x 64 (SSD1309) 6 encoders ENC1 - ENC6, push to click 6 navigation buttons control / navigation: Lakeview TL16 RGB (SW25 - SW30) 6 keyboard controls keyboard / sequencer: octave up / down; the others to be defined microSD card slot, front

The rear

audio, MIDI, CV and gate, USB-C
Tanghim, the rear: outline drawing (MainMXTL16TRS, pla_mix box) USB-C USB-C 5 V power in, USB MIDI and data CV IN GATE IN CV OUT 1 GATE OUT 1 CV OUT 2 GATE OUT 2 CV / gate 6 mini jacks, 3.5 mm: CV and gate, in and out IN OUT THRU MIDI IN / OUT / THRU, 3.5 mm TRS, type A OUT L OUT R IN L IN R Audio 4 x 6.35 mm (Neutrik NMJ6HCD2): stereo out L / R, stereo in L / R

The instrument

The instrument, block by block

Tanghim is a desktop instrument, 250 × 176 mm. Inside it, one chain: a tuning that sets every pitch, keys and sequencers that play it, engines that give it a voice, and effects that shape it.

  1. Tuning
  2. Keys · Sequencer
  3. Sound engine
  4. Filter · Dynamics
  5. Time
  6. Digital
  7. Audio · MIDI · CV · USB

01

The micro-tuning quantizer

The heart of the instrument: every note lands on an exact pitch of a tuning system, a maqām in its own degrees and its own intervals, never rounded to twelve equal steps. The sliders tune each degree, the root turns the mode, and a modulation moves to another maqām on a shared note, the way a player does. And beyond the archive: build your own micro-tuning scales, degree by degree, and play them like any maqām.

  • 28 historical tuning systems
  • 145 maqāmāt
  • Your own scales

In development on the STM32H7 (Arm Cortex-M7); your own scales planned.

02

The keyboard

The 16 keys play the maqām: by degree, on the white keys, or chromatic with each key retuned, with octave up and down. The same tuning goes out over MIDI to other instruments: MPE, MIDI Tuning Standard, pitch bend.

In development on the STM32H7 (Arm Cortex-M7).

03

The sequencer

Two tracks of patterns that stay inside the maqām, each in its own mode:

  • 2 tracks
  • Step
  • Euclidean
  • Markov chains
  • Trees
  • and stranger ones

Step and Euclidean in development on the STM32H7 (Arm Cortex-M7); the two tracks, the Markov, tree and other modes planned.

04

The sound engines

Each one plays the maqām's own pitches. Ours first: physical models of the maqām's instruments, strings, bodies and pipes, tuned by the maqām itself.

Watarوتر

Physical model · the oud

The risha plucks paired strings, digital waveguides, while six open courses ring in sympathy, all through the body of a real oud: its recorded impulse response, and resonators set from the measured modes of an oud soundboard.

In development on the STM32H7 (Arm Cortex-M7).

Kasabقصب

Physical model · the pipe

Pipes and reeds modelled as air columns: the wind instruments of the maqām, beside the strings of Watar.

In research.

Polyphonic FM

Ratios from the tuning

Operators whose ratios can come from the tuning itself, a note of the maqām or of its tuning system: the intervals of the maqām become the timbre's harmonics.

In development on the STM32H7 (Arm Cortex-M7).

Additive

Partials on the tuning

A sound built partial by partial, its harmonics free to sit on the tuning's own intervals.

Planned.

05

Filter and dynamics

A filter to shape the tone, and the dynamics to hold it: the envelope, compression, the limiter.

The envelope in development; the filter and dynamics planned.

06

Time effects

The space around the sound:

  • Delay
  • Reverb

Planned.

07

Digital effects

The grain of the machine, by choice:

  • Sample-rate reduction
  • Bit reduction
  • Trance gate
  • and more

Planned.

08

Connections

Tanghim speaks to the studio and to the computer: it plays other instruments in the maqām's tuning, and other instruments play it.

  • Audio in and out
  • MIDI in, out and thru
  • CV and gate in and out
  • USB MIDI
  • USB audio

On the board's design; the software in development; USB audio planned.

The panel
16 keys in 2 × 8 with a light in each · Function, Patterns, Record, Play · 6 keyboard controls · 8 sliders with an RGB light under each · 6 knobs, Tempo, Volume · 6 encoders and 6 navigation buttons · a 1.54 in screen, 128 × 64
The rear
Stereo audio in and out, 6.35 mm · MIDI in, out and thru, 3.5 mm TRS (type A) · CV and gate in and out, six 3.5 mm jacks · USB-C, power and USB MIDI (USB audio planned)
The front
Headphones, 3.5 mm · microSD card slot

TanghimOS

The software inside the instrument

TanghimOS is Tanghim's own software: the maqām theory at its heart, the sound engines, the sequencer, MIDI and the screen's interface, written in C++ for the instrument: every block above is built on it. It is developed for the STM32H7, an Arm Cortex-M7, on its evaluation board, and the core is checked against reference answers.

The maqām engine

  • 28 historical tuning systems · from al-Mawṣilī (850), al-Kindī and al-Fārābī to al-Ṣabbāgh and Allami (2025)
  • 145 maqāmāt and 44 ajnās · their ascending and descending forms
  • Transposition that keeps each tuning's own intervals
  • Modulation, and 193 suyūr · the melodic paths of al-Shawwā, al-Ḥilū and al-Ṣabbāgh

Around the theory

  • The blocks above · the quantizer, the keyboard, the sequencer, the engines and the effects
  • MIDI in and out · the maqām's tuning sent to other instruments
  • A screen that speaks Arabic and Latin

Built on DiArMaqAr

Tanghim's knowledge of the maqām comes from DiArMaqAr, the Digital Arabic Maqām Archive, by Dr. Khyam Allami with Ibrahim El Khansa at the Music Intelligence Lab, American University of Beirut.

The data is theirs. The tuning systems, ajnās, maqāmāt and suyūr that Tanghim plays are DiArMaqAr's, read from their archive, with the sources it documents for each one.

The code is ours. Their algorithms (the pitch tables, the transpositions, the modulations) inspired TanghimOS's maqām engine: we studied them and wrote our own from scratch, in C++, for the instrument. No line of DiArMaqAr's code is in Tanghim. We check our engine against DiArMaqAr's own answers.

What we add. The instrument around the theory: the blocks above, from the micro-tuning quantizer and the sequencers to the physical models of the oud and the pipe, FM and additive on the tuning, and playing the maqām live, on keys, sliders and MIDI.

DiArMaqAr's data is published under CC BY-NC-SA 4.0; the tables Tanghim derives from it keep that licence.

In development for the STM32H7 (Arm Cortex-M7), on the evaluation board.

Words

واعلم أن كل صوت له نغمة وصفية وهيئة روحانية، خلاف صوت آخر، وأن الهواء من شرف جوهره ولطافة عنصره يحمل كل صوت بهيأته وصفته، ويحفظها لئلا يختلط بعضها ببعض، … إلى أن يبلغها إلى أقصى مدى غاياتها عند القوة السامعة، لتؤدّيها إلى القوة المتخيلة … وذلك تقدير العزيز الحكيم

— إخوان الصفا وخلّان الوفاء

“Know that every sound has its own tone, its own quality and a spiritual form, unlike any other sound; and that the air, by the nobility of its substance and the subtlety of its element, carries each sound with its form and its quality, and keeps them so that they do not mix with one another … until it brings them to the farthest reach of their course, at the faculty of hearing, which passes them on to the faculty of imagination … That is the decree of the Mighty, the Wise.”

The Brethren of Purity (Ikhwān al-Ṣafāʾ), Rasāʾil, 10th century. English: our translation.