thank you very much for your reply. well, let me be a bit more precise: what i meant with “internally”, was sequencing the root note inside a script - flora in my specific case, not an external instrument via midi. so instead of mapping a midicontroller to the root note, i was thinking of changing that parameter via tmi (does that make sense?) but it could be, i probably misunderstood the whole concept of tmi, which works only with external gear …?

1 Like

i think i understand now - you’d like to be able to use the tmi sequencer to sequence a note from the supercollider engine of the current script you are using (in this case flora)?

1 Like

yup, exactly that. but my gut feeling is that it probably can’t be done, can it? at least i don’t know how to do that. anyway - at the moment i’m having a blast with my op-1 and your great script ; ) thanks for sharing!

1 Like

it can be done! pretty easily too.

basically i’ll add a little fix so that you can define your own function to be used with tmi. if the function is supplied it will use it as a “virtual instrument”

4 Likes

wow - that is genius! i wish, i could do such things myself and contribute to this awesome community, but i couldn’t wrap my head around coding yet. i tried a few times but failed grandiosly each time. thank you so much for making this possible. i’ll give it a try right away - has it been implemented yet?

1 Like

@moono i just added it now! i’ve tested it and it seems to work fine, but why don’t you give it a test run and let me know?

it turned out to be a little tricky to code since it needs to accommodate any possible engine function.

here’s how it works:

if you want to add your engine function (or any function for that matter!) you can use the following, an example using the polyperc engine.

engine.name = 'PolyPerc'
MusicUtil=require "musicutil"
if util.file_exists(_path.code.."tmi") then 
  tmi=include("tmi/lib/tmi")
  m=tmi:new({
    functions={
      {name="polyperc",note_on="engine.amp(<velocity>/127); engine.hz(MusicUtil.note_num_to_freq(<note>))"},
    },
  })
end

as you can see there is a functions map that you can pass to tmi now. inside that is where the magic happens.

the “name” gives your thing an identifier. the “note_on” defines some lua code to run when a note goes on. the lua code can be anything you want. the lua code can take two values - the midi note ("<note>") and the velocity ("<velocity>", ranging 0-127). its basically up to you to make sure these values fit into whatever function you want. for instance, for the PolyPerc engine you have to enter use engine.amp, so you have the scale the velocity by 127 for it work. similarly, the PolyPerc engine needs to emit notes with the frequency, not the midi note so you have to convert it using the MusicUtil.

you can also write a similar function for note_off which is emitted when notes go off, but PolyPerc doesn’t really have a note off since its one-shots.

this new syntax gives a lot of flexibility. you can write whatever lua code you want to run when notes go “on” and “off” and you can have as many functions as you want. you don’t have to include “<note>” or “<velocity>”, but if you do make sure to transform them for your own purpose within your lua code.

4 Likes

so cool - thanks a lot! like i said, i’m pretty noobish in the coding area, so i expect it might take a while to get it to work. challenge accepted! i’m gonna try this tonight and will report back …

@infinitedigits i’m sorry, but as i feared, the whole implementation thing turned out to be too difficult for me. in other words: i have absolutely no clue how to do it or if it even makes sense. unfortunately it’s way over my head and i guess, i need to learn lua first - it’s not a copy&paste job like i naively hoped. until then i will use tmi as it is - i already found it super useful. i hope, you didn’t put too much effort into this … thanks anyway ; )

1 Like

oh no! i can see why, flora is an amazing piece of work and its not as simple to interpret. actually the code you need to add to it is pretty similar to what i mention above. this works. you can just copy and paste the following code into flora/lib/plant_sounds.lua:

MusicUtil=require "musicutil"
if util.file_exists(_path.code.."tmi") then 
  tmi=include("tmi/lib/tmi")
  m=tmi:new({
    functions={
      {name="flora",note_on="engine.note_on(math.random(1,10),MusicUtil.note_num_to_freq(<note>))"},
    },
  })
end

then you can load tmi files into flora that will play at the same time.

3 Likes

okay - first of all thanks for not giving me up. and yes, flora is indeed really amazing.
in terms of my trial and error journey i would like to report progress, but unfortunately i can’t.

here’s what i did: i pasted the above code into the plant_sounds.lua file right on top. tmi now shows up in the parameter menu and i can load files and play them - i checked with my op-1 and the sequencing worked. so far so good, but when i’m trying to do the same with the internal engine (sequencing the root note or any other parameter) it doesn’t seem to have any hearable effect - except a short reset of the flora engine when pushing start/stop.

i try to describe what i did in the latter case:
in system > devices > midi i set channel 1 to virtual
in parameters > map > tmi it says:

virtual

11load_name_tmi
11scaling
12load …

then it gets confusing:
in parameter map i wanted to map virtual tmi output (?) to the root_note
in the mapping page i can see: dev 1: v (i guess it’s the virtual midi device)

what am i’m missing/ doing wrong? sorry to bug you again, but i really would like to get this to work …

edit: i don’t know what exactly happened, but: i just reinstalled tmi and flora and voilà - and now it suddenly works. happy camper again ; ) thaaaank you!

1 Like

thanks for responding, just getting a chance to get back to this, I tried a couple of other locations in both new and old orca and they both would error out. Tmi folder looks correctly installed, what line in the orca code are you putting this in? also I do not see the digitakt come up in the midi menu, just the midi interface.