Ask Your Question

# fmap and tidal-midi example

New user, I'm struggling a little with how to transpose a tidal-midi pattern. I've read that fmap with up etc can do this, but I can't get the syntax right to make it work. Could anyone provide an example?

for example, with something like the following:

m1 $every 4 (density 2)$ note "[-12 24 5 2 4 7 12 9 12]/3"


where would fmap be inserted..?

edit retag close merge delete

## 1 answer

Sort by ยป oldest newest most voted

Hi Dazid,

Breaking your example down a bit,

this is a pattern of numbers: "[-12 24 5 2 4 7 12 9 12]/3"

this is a pattern of synth messages: note "[-12 24 5 2 4 7 12 9 12]/3". In other words, the note function takes a pattern of numbers and turns it into a pattern of synth messages.

Both are patterns, for example you could have applied the every 4 (density 2) transformation to the pattern of numbers: m1 $note$ every 4 (density 2) "[-12 24 5 2 4 7 12 9 12]/3"

Both will have the same result.

However what fmap does is apply a function to each of the things inside the pattern. So if you want to transpose note values you'll want to apply the fmap to the pattern of numbers, rather than the pattern of synth messages. Some examples:

m1 $every 4 (density 2)$ note (fmap (+2) "[-12 24 5 2 4 7 12 9 12]/3")

m1 $every 4 (density 2)$ note (every 3 (fmap (+7)) "[-12 24 5 2 4 7 12 9 12]/3")

m1 $every 4 (density 2)$ note (sometimes (fmap (subtract 5)) "[-12 24 5 2 4 7 12 9 12]/3")

(untested, but hopefully work!)

You mention the up parameter - you can ignore this when doing things with MIDI, that actually manipulates the speed parameter and is probably only ever used when triggering samples from SuperDirt.

There are other tricks you can do, for example using |+| to combine two note parameters by adding together their values:

m1 $note "[-12 24 5 2 4 7 12 9 12]/3" |+| note (slow 4 "2 7 12") m1$ every 3 (|+| note "12") \$ note "[-12 24 5 2 4 7 12 9 12]/3"

more

## Comments

thanks for the comprehensive answer!

( 2017-01-01 16:37:47 -0500 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2017-01-01 12:14:43 -0500

Seen: 358 times

Last updated: Jan 01