# Using FluCoMa tools with reaper

**URL:** <https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311>\
**Category:** Code Sharing\
**Created:** [September 10, 2019, 8:44pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311 "2019-09-10T20:44:03Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 11, 2019, 12:26pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/21 "2019-09-11T12:26:46Z")

</div>

Woooooo it works - you need to save the project first though, but I just got a-ma-zing-ly fast novelty segmentation, undo-able, on MFCCs, in Reaper.

I’m soooooooo happy!

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 1:02pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/22 "2019-09-11T13:02:30Z")

</div>

> [@tremblap](#):
>
> Woooooo it works - you need to save the project first though

coming fix now by using a temporary folder among some other QoL changes so i can expand this to the other algos

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 3:02pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/23 "2019-09-11T15:02:28Z")

</div>

Okay made some pushes.

1. The scripts can now all be placed into a folder inside your scripts location. They work regardless of where they are as long as they are **ALL IN THE SAME FOLDER**.

2. The first time you try to run anything the scripts will ask you to set your path to the flucoma executables. Once this is set, it remains persistent across reaper sessions. If you do need to change it because you made a mistake or want to move the CLI stuff somewhere else, you will need to run FluidEditPath.lua script.

3. Everything uses OS standard temporary locations, so no funky errors because you are working in an unsaved project.

4. You don’t have to have the media in a project, it can exist somewhere on the disk that is not a reaper project. Woo!

Things to add/fix:

If you are segment a media item, then try to segment one of the segments it will return an error. Not really sure why right now, but I’ll figure that out later.

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 3:12pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/24 "2019-09-11T15:12:37Z")

</div>

> [@rodrigo.constanzo](#):
>
> So based on your second post, it would only involve installing _your_ script somewhere Reaper will know (is there a standard location for that sort of thing)

Not entirely the case. You can put the scripts anywhere as long as you can find them again when you call the “Run Script” action in Reaper. You could put them in documents, or in your root directory, or on a thumb drive. There is a standard location, but its in Application Support and I find it gross to go and find all the time.

> [@rodrigo.constanzo](#):
>
> and then putting the CLI version somewhere else ( `/usr/bin` or `/usr/dev/bin` as standard?)?

Yep, again as long as you know where it is thats fine. The first time you run any of the scripts it will ask you to set the path to this place. I would recommend not touching `/usr/bin` and use `/usr/local/bin`/. I just use `dev` folder in `~/` for local stuff that isnt synced to the cloud and goes up to github via git.

> [@rodrigo.constanzo](#):
>
> And once in Reaper-land, do the scripts behave like other functions? (undo/redo, shift+click multiple selections etc…)

Yes, multiple items works as does undo. The only thing I can’t find how to work is if you segment something, you cannot segment the segment yet. Although I think the solution is trivial and a matter of configuring offsets.

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 11, 2019, 3:14pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/25 "2019-09-11T15:14:50Z")

</div>

> [@jamesbradbury](#):
>
> Things to add/fix:
> 
> If you are segment a media item, then try to segment one of the segments it will return an error. Not really sure why right now, but I’ll figure that out later.

I see why in your code: you assume that one wants to process the whole file, as I mention above.

You should take an item’s D\_STARTOFFS (the offset in the file) and D\_LENGTH(how long) and convert them to samples and throw them in the CLI call as -startframe and -numframes.

This is already soooooo coooool!

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 11, 2019, 3:17pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/26 "2019-09-11T15:17:05Z")

</div>

if you want to go crazy: in Reaper, an Item can be a subset of channels too. You could get those 😉

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 3:21pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/27 "2019-09-11T15:21:48Z")

</div>

You’ll have to explain that one to me. I am still a massive reaper noob

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 11, 2019, 3:26pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/28 "2019-09-11T15:26:29Z")

</div>

you are talking about the subchannel idea? I can show you in 5 seconds if you’re in tomorrow morning. You know where to find me

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 3:26pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/29 "2019-09-11T15:26:51Z")

</div>

I will be after my vegetables arrive…

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [September 11, 2019, 4:31pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/30 "2019-09-11T16:31:44Z")

</div>

> [@tremblap](#):
>
> I just got a-ma-zing-ly fast novelty segmentation, undo-able, on MFCCs, in Reaper.

I agree. This totally feels tutorial/KE-worthy as an addition, particularly since doing it in this way removes the need for having to deal with all the `buffer~` creation and management in Max-land.

As I don’t know complex the Reaper scripting can be, but is it possible (technically speaking, not in terms of ease of implementation) to do things like NMF/HPSS/etc… splitting in Reaper where it automatically places the generated clips on new tracks that are time-aligned?

> [@jamesbradbury](#):
>
> I will be after my vegetables arrive…

This oddly makes sense here…

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 4:33pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/31 "2019-09-11T16:33:20Z")

</div>

> [@rodrigo.constanzo](#):
>
> As I don’t know complex the Reaper scripting can be, but is it possible (technically speaking, not in terms of ease of implementation) to do things like NMF/HPSS/etc… splitting in Reaper where it automatically places the generated clips on new tracks that are time-aligned?

I planned to compose more this week, but totally rabit holed with this and have totally given over to it. So once I figure out this horrible recursion ive created in the user interface, I want to make exactly what you said for NMF/HPSS etc. It’ll be fairly easy to port to every algo once I get one perfect.

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 11, 2019, 4:34pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/32 "2019-09-11T16:34:34Z")

</div>

> [@jamesbradbury](#):
>
> It’ll be fairly easy to port

With one caveat: some algo want to create and keep new audio files, but that is trivial for a code-rocking star like you 😉

thanks so much for doing this!

p

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 5:39pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/33 "2019-09-11T17:39:00Z")

</div>

> [@tremblap](#):
>
> With one caveat: some algo want to create and keep new audio files, but that is trivial for a code-rocking star like you 😉

Easy enough to follow the convention of reaper. Store takes next to the source with incremented names :^)

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 11, 2019, 10:12pm UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/34 "2019-09-11T22:12:32Z")

</div>

Sorry to spam this thread:

I couldn’t fix the bug where you cannot segment a segment so I moved on to make the script work on multiple selected files. In doing so, I was reminded that LUA uses immutable strings and to work on many files I would have to store every set of parameters in a table prior to executing the slicing. Now everything works!

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 12, 2019, 8:03am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/35 "2019-09-12T08:03:30Z")

</div>

@rodrigo.constanzo @tremblap

What would be the ideal mechanic for NMF? Right now I have something which creates the NMF and adds it as a new take to the source item. You can then explode take to new items, then explode multichannel items to new tracks but I don’t want to assume thats what anyone else would want. I somewhat think going straight to new tracks is a bit heavy but I think that another option is a child track containing the multichannel audio.

---

<div class="post-metadata">

**Author:** ![tremblap](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/tremblap/32/5_2.png) [@tremblap](https://discourse.flucoma.org/u/tremblap)\
**Post date:** [September 12, 2019, 8:15am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/36 "2019-09-12T08:15:58Z")

</div>

the behaviour to new take is the best one for the reasons you mention. people can make a script of a chain of script if they want to explode it to tracks automagically.

thanks

---

<div class="post-metadata">

**Author:** ![rodrigo.constanzo](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/rodrigo.constanzo/32/12_2.png) [@rodrigo.constanzo](https://discourse.flucoma.org/u/rodrigo.constanzo)\
**Post date:** [September 12, 2019, 8:19am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/37 "2019-09-12T08:19:34Z")

</div>

I would personally want it to go to a bunch of tracks, since I don’t think I’d ever want to NMF, and then not have each component isolated.

Perhaps a chain of scripts then so it’s more flexible?

---

<div class="post-metadata">

**Author:** ![weefuzzy](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/weefuzzy/32/362_2.png) [@weefuzzy](https://discourse.flucoma.org/u/weefuzzy)\
**Post date:** [September 12, 2019, 8:24am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/38 "2019-09-12T08:24:08Z")

</div>

I’d vote for takes by default too. It’s a very convenient interface for A-B-ing, and it’s easy to explode.

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 12, 2019, 8:47am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/39 "2019-09-12T08:47:25Z")

</div>

Okay, seems the consensus seems to be takes. It is very easy to use default actions after that to get the desired configuration. Sorry for not tagging you @weefuzzy! I forgot you were lurking in here 😉

---

<div class="post-metadata">

**Author:** ![jamesbradbury](https://discourse.flucoma.org/user_avatar/discourse.flucoma.org/jamesbradbury/32/1252_2.png) [@jamesbradbury](https://discourse.flucoma.org/u/jamesbradbury)\
**Post date:** [September 12, 2019, 9:05am UTC](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311/40 "2019-09-12T09:05:46Z")

</div>

There is a working NMF tool now. Due to its long processing times the whole of REAPER locks out while it processes. I’ll see if there is a way to make it defer the GUI or something so you can keep going because its all being done in the shell anyway…

[Previous page](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311.md?page=1)

[Next page](https://discourse.flucoma.org/t/using-flucoma-tools-with-reaper/311.md?page=3)
