# TR8S + TidalCycles = ❤️

**URL:** <https://uzu.lurk.org/t/tr8s-tidalcycles/4413>\
**Category:** TidalCycles\
**Tags:** resources\
**Created:** [23 November 2022 00:22 UTC](https://uzu.lurk.org/t/tr8s-tidalcycles/4413 "2022-11-23T00:22:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghales](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ghales/32/2171_2.png) [@ghales](https://uzu.lurk.org/u/ghales)\
**Post date:** [23 November 2022 00:22 UTC](https://uzu.lurk.org/t/tr8s-tidalcycles/4413/1 "2022-11-23T00:22:23Z")

</div>

Hi all. Been having loads of fun tidaling on a [Roland TR-8S](https://www.youtube.com/watch?v=h2O2thk111I). It's an awesome pair for tidal, but quite tricky to get the MIDI mappings right - sharing mine here to (hopefully) save someone's time.

```haskell
-- TR8S MIDI CC Map
tr8sChanArray = [36,38,43,47,50,37,39,42,46,49,51]
tr8sAltChanArray = [35,40,41,45,48,56,54,44,55,57,59]
tr8sToneCCArray = [20,25,46,49,52,55,58,61,80,83,86]
tr8sDecayCCArray = [23,28,47,50,53,56,59,62,81,84,87]
tr8sCtrlCCArray = [96,97,102,103,104,105,106,107,108,109,110]

-- TR8S Functions
:{
let ctrl = modw
    translateEventsToMIDICC array name valueGetter idx pat = ccv (fmap valueGetter $ filterJust $ M.lookup name <$> pat) # ccn (array!!idx)
    noteToTR8STuneCC = translateEventsToMIDICC tr8sToneCCArray "note" (fromIntegral . (`mod` 127) . toInteger . floor . (* 64) . (/ 12) . toRational . nvalue)
    modwToTR8SCtrlCC = translateEventsToMIDICC tr8sCtrlCCArray "modwheel" ((* 127) . max 0 . min 1 . fvalue)
    susToTR8SDecayCC = translateEventsToMIDICC tr8sDecayCCArray "sustain" ((* 127) . max 0 . min 1 . fvalue)
    tr idx pat = p (toID $ "tr8s" ++ show (tr8sToneCCArray!!idx))
      $ stack (pat : fmap (\translator -> translator idx pat) [noteToTR8STuneCC, susToTR8SDecayCC, modwToTR8SCtrlCC])
      # stack [
        s "tr" # midichan 9 # midinote (tr8sChanArray!!idx),
        s "loopback" # midichan (pure $ fromIntegral idx)
      ]
    trbank num = asap $ progNum num # s "tr"
    trs pats = mapM_ (\(pat,idx) -> tr idx pat) $ zip pats [0..16]
:}

-- channels by name (as written on the device)
:{
let bd = d1
    sd = d2
    lt = d3
    mt = d4
    ht = d5
    rs = d6
    hc = d7
    ch = d8
    oh = d9
    cc = d10
    rc = d11
:}

-- If you want to substitute d1-12 with tr8s channels
:{
let d1 = tr 0
    d2 = tr 1
    d3 = tr 2
    d4 = tr 3
    d5 = tr 4
    d6 = tr 5
    d7 = tr 6
    d8 = tr 7
    d9 = tr 8
    d10 = tr 9 
    d11 = tr 10
    d12 = tr 11
    d13 = tr 12
    d14 = tr 13
    d15 = tr 14
    d16 = tr 15
:}

```

Usage:

```haskell
bd $ n "0*2"

sn $ n "~ 0"

lt $ (scale "major" $ note "0*4") # sus 0.1 # ctrl 1

mt $ scale "major" $ note "0 2 4 7" #

```

This definition provides the `ctrl`, `note` and `sus` methods to control the `ctrl`, `tune` and `decay` knobs respectively

---

<div class="post-metadata">

**Author:** ![ghales](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ghales/32/2171_2.png) [@ghales](https://uzu.lurk.org/u/ghales)\
**Post date:** [23 November 2022 00:26 UTC](https://uzu.lurk.org/t/tr8s-tidalcycles/4413/2 "2022-11-23T00:26:55Z")

</div>

PS.: Should we start a repo for storing synth / midi devices / external device definitions for tidal? Is there enough demand for this kind of knowledge?

---

<div class="post-metadata">

**Author:** ![montoyamoraga](https://uzu.lurk.org/user_avatar/uzu.lurk.org/montoyamoraga/32/90_2.png) [@montoyamoraga](https://uzu.lurk.org/u/montoyamoraga)\
**Post date:** [29 November 2022 19:06 UTC](https://uzu.lurk.org/t/tr8s-tidalcycles/4413/3 "2022-11-29T19:06:27Z")

</div>

hey this is awesome!  
me and my studio are working on this,  
we are focusing work on Korg Volca machines,  
and doing other experiments, happy to include  
the TR8S for the rest of the community 🙂

> **[GitHub - maquinitas/maquinitas-tidal: maquinitas x TidalCycles](https://github.com/maquinitas/maquinitas-tidal)**
>
> maquinitas x TidalCycles. Contribute to maquinitas/maquinitas-tidal development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![ghales](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ghales/32/2171_2.png) [@ghales](https://uzu.lurk.org/u/ghales)\
**Post date:** [30 November 2022 18:34 UTC](https://uzu.lurk.org/t/tr8s-tidalcycles/4413/4 "2022-11-30T18:34:02Z")

</div>

Looks good! Will add it there. I have a question though: why follow this pattern?

```haskell
ccn :: Pattern String -> ControlPattern
ccn = Sound.Tidal.Params.ccn . (ccnList <$>)

```

Instead of using a map or something?
