Old 11-16-2021, 09:25 AM   #1
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default MX Tuner

A simple utility for the media explorer to determine the key of samples.


Quickly determine what key your sample is in

... on a neat little dockable keyboard.



Tune samples to a key of your choice (lock pitch)

Left-click on the keyboard to lock all samples to a specific key. While going through samples. the pitch dial will be adjusted accordingly.



Right-click to open settings menu



Note: I wrote my own pitch detection algorithm, which was quite the daunting task. It works quite well for the material I tested it on, and is fairly fast so that it can run in lua. I also included a simple FFT-based approach which might work better on some material. But there's definitely more sophisticated algorithms out there. If somebody wants to contribute an algorithm, send me the code and I'll gladly add it to the script as an option

Credit to the user Daodan for the idea and inspiration


All of my scripts are available on GitHub or ReaPack:
Extensions > ReaPack > Import a repository
Code:
https://raw.githubusercontent.com/iliaspoulakis/Reaper-Tools/master/index.xml
If you like my scripts please consider sending me all your money here

Last edited by FeedTheCat; 04-24-2022 at 03:28 AM.
FeedTheCat is online now   Reply With Quote
Old 11-16-2021, 12:16 PM   #2
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 11,648
Default

To me FFT seems verx viable. I used FFT for JSFXes in eel2 language. Here it is rather easy to use and very fast. Is am FFT system function provided for LUA ?

-Michael
mschnell is offline   Reply With Quote
Old 11-16-2021, 01:16 PM   #3
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by mschnell View Post
To me FFT seems verx viable. I used FFT for JSFXes in eel2 language. Here it is rather easy to use and very fast. Is am FFT system function provided for LUA ?

-Michael
Yes, the same FFT functions are also available for lua.
FeedTheCat is online now   Reply With Quote
Old 11-16-2021, 02:33 PM   #4
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 1,884
Default

This is very useful, thx a lot
Vagelis is online now   Reply With Quote
Old 11-16-2021, 10:24 PM   #5
tonalstates
Human being with feelings
 
tonalstates's Avatar
 
Join Date: Jun 2020
Posts: 301
Default

I can't seem to be able to run it on my system Os Mojave R v6.40, it doesn't show a message or anything, it just doesn't run but it did go on another computer with m1 chip and latest os.. I tried reinstalling but nothing, any way I can know what could be causing this?
tonalstates is offline   Reply With Quote
Old 11-17-2021, 12:46 AM   #6
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by tonalstates View Post
I can't seem to be able to run it on my system Os Mojave R v6.40, it doesn't show a message or anything, it just doesn't run but it did go on another computer with m1 chip and latest os.. I tried reinstalling but nothing, any way I can know what could be causing this?
Hi tonalstates,

thx for reporting. Does it work when you run the script through the main section of the action list? The media explorer section currently has a few issues with scripts and custom actions.
FeedTheCat is online now   Reply With Quote
Old 11-17-2021, 10:10 AM   #7
Zeno
Human being with feelings
 
Zeno's Avatar
 
Join Date: Sep 2018
Location: HH
Posts: 595
Default

Interesting idea. Thanks
Zeno is offline   Reply With Quote
Old 11-17-2021, 11:16 AM   #8
tonalstates
Human being with feelings
 
tonalstates's Avatar
 
Join Date: Jun 2020
Posts: 301
Default

Quote:
Originally Posted by FeedTheCat View Post
Does it work when you run the script through the main section of the action list?
No, that's pretty much what I did from the start, I didn't even try the MX section o: I'll try it on MX section when I get home to see if anything goes different. Thank you.
tonalstates is offline   Reply With Quote
Old 11-17-2021, 01:33 PM   #9
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by tonalstates View Post
No, that's pretty much what I did from the start, I didn't even try the MX section o: I'll try it on MX section when I get home to see if anything goes different. Thank you.
Hmmm, that's unlikely to change anything... I can't really think of something that would cause this though. I'm assuming other scripts with GUIs work fine on that install?

Quote:
Originally Posted by tonalstates View Post
any way I can know what could be causing this?
If you're comfortable touching some code you could try to add the following to line 621 (above reaper.defer(Main)):

Code:
reaper.ShowConsoleMsg("I'm running\n")
gfx.update()
That would at least confirm that the script is actually running.
FeedTheCat is online now   Reply With Quote
Old 11-17-2021, 01:56 PM   #10
tonalstates
Human being with feelings
 
tonalstates's Avatar
 
Join Date: Jun 2020
Posts: 301
Default

@FeedTheCat

Yeah, everything else, even your other scripts, run just fine.


Ok, I'll try that, thanks for helping out.
tonalstates is offline   Reply With Quote
Old 11-17-2021, 05:24 PM   #11
tonalstates
Human being with feelings
 
tonalstates's Avatar
 
Join Date: Jun 2020
Posts: 301
Default

Ok... so I don't know what I did, because I didn't do anything really but now it works! hahaha why? I will never know. But yay! Still, thanks for your help and this nifty script.
tonalstates is offline   Reply With Quote
Old 11-18-2021, 02:56 AM   #12
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by tonalstates View Post
Ok... so I don't know what I did, because I didn't do anything really but now it works! hahaha why? I will never know. But yay! Still, thanks for your help and this nifty script.
Sure np, glad it works
FeedTheCat is online now   Reply With Quote
Old 11-18-2021, 07:01 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 8,216
Default

Interesting!


I would say that Yin algorithm is a must have for pitch detection :P (or even pYin)

This is what I use in combination with aubiopitch. It is quite good for most signal which (monophonic single note)


There are several code version of it if you don't want to use dependency, I think there is one in JS cookdsp, maybe in pitch tracking JS, and in various libraries on github in other language.

(note: this is not a FR, I rarely use single note sample these days, but maybe it can interest you or users of this script :P)
X-Raym is offline   Reply With Quote
Old 11-18-2021, 10:15 AM   #14
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

running the script gives me this :
MX Tuner.lua:354: bad argument #2 to '__index' (index out of range)
permeke is offline   Reply With Quote
Old 11-18-2021, 02:26 PM   #15
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

@X-Raym
Yeah, something like Yin would indeed be nice. I started writing a cross-correlation based algorithm in lua, but it was so painfully slow that I gave up on it. The best solution is probably something like MPL did for his PitchEditor, running the algorithm in eel and then sending the result to lua. I might look into that in the future. I'm rather curious to find out how well my algorithm is doing in comparison.

@permeke
Oops, should be fixed now
FeedTheCat is online now   Reply With Quote
Old 11-18-2021, 03:27 PM   #16
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

Quote:
Originally Posted by FeedTheCat View Post
@X-Raym
Yeah, something like Yin would indeed be nice. I started writing a cross-correlation based algorithm in lua, but it was so painfully slow that I gave up on it. The best solution is probably something like MPL did for his PitchEditor, running the algorithm in eel and then sending the result to lua. I might look into that in the future. I'm rather curious to find out how well my algorithm is doing in comparison.

@permeke
Oops, should be fixed now
Ok, I can load it now but still behaving weird. I can't dock it although docking is selected and I don't see the menus, only the keyboard.
I'm on OSX Catalina
permeke is offline   Reply With Quote
Old 11-18-2021, 04:01 PM   #17
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
Ok, I can load it now but still behaving weird. I can't dock it although docking is selected and I don't see the menus, only the keyboard.
I'm on OSX Catalina
Not sure I understand, the menu doesn't open when you right click? How are you docking it without the menu?
FeedTheCat is online now   Reply With Quote
Old 11-18-2021, 04:40 PM   #18
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

Quote:
Originally Posted by FeedTheCat View Post
Not sure I understand, the menu doesn't open when you right click? How are you docking it without the menu?
I meant the icons below the keyboard. They don't show up.



I can right click, it shows the menu. Docking is activated but nothing happens
permeke is offline   Reply With Quote
Old 11-19-2021, 03:23 AM   #19
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
I meant the icons below the keyboard. They don't show up.



I can right click, it shows the menu. Docking is activated but nothing happens
The items below the keyboard are my toolbars. Might be a bit confusing because of how it looks on Linux. I open the script by pressing on a toolbar button in the first script

I just pushed a small change to the docking behavior. Let me know if it changes anything.

Here's how docking should look on Catalina:

FeedTheCat is online now   Reply With Quote
Old 11-19-2021, 03:39 AM   #20
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

Quote:
Originally Posted by FeedTheCat View Post
The items below the keyboard are my toolbars. Might be a bit confusing because of how it looks on Linux. I open the script by pressing on a toolbar button in the first script

ah oh OK, understood. Neat solution.

I just pushed a small change to the docking behavior. Let me know if it changes anything.

Here's how docking should look on Catalina:

Docking doesn't work for me here. I'll will try to reinstall the script.
permeke is offline   Reply With Quote
Old 11-19-2021, 03:39 AM   #21
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

Quote:
Originally Posted by FeedTheCat View Post
The items below the keyboard are my toolbars. Might be a bit confusing because of how it looks on Linux. I open the script by pressing on a toolbar button in the first script

I just pushed a small change to the docking behavior. Let me know if it changes anything.

Here's how docking should look on Catalina:

neat !
permeke is offline   Reply With Quote
Old 11-19-2021, 05:33 AM   #22
Daodan
Human being with feelings
 
Join Date: Jan 2011
Posts: 458
Default

Awesome!
Daodan is online now   Reply With Quote
Old 11-19-2021, 08:37 AM   #23
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

V1.02 installed.
No docking possible.
permeke is offline   Reply With Quote
Old 11-19-2021, 09:53 AM   #24
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

@permeke

I just pushed v1.1 with more changes to docking, hopefully this does the trick.

If not, are there any other scripts you are using where docking works?

@all
In v1.1 the keyboard colors are now taken from the active reaper theme.
FeedTheCat is online now   Reply With Quote
Old 11-19-2021, 10:15 AM   #25
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

did the V1.1 install.
Same issue. activating / deactivating doesn't make it dockable here.
if this helps > when I resize the window and change docking state it goes back to it's previous size.
No theme colouring also.
yes I have various docked scripts working

But it works so that is cool.
permeke is offline   Reply With Quote
Old 11-19-2021, 11:33 AM   #26
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
No theme colouring also.
Most themes have a very similar black/white color scheme for keys, so it isn't always obvious.

Quote:
Originally Posted by permeke View Post
if this helps > when I resize the window and change docking state it goes back to it's previous size.
That's a byproduct of the latest fix attempt... I reverted the changes in v1.1.1.

Just thought of something though... Maybe the crash you had before corrupted some internal values. Check out v1.1.2.

Edit: Nvm, v1.1.2. is unlikely to solve the issue if what I'm thinking is correct.

Last edited by FeedTheCat; 11-19-2021 at 12:00 PM.
FeedTheCat is online now   Reply With Quote
Old 11-19-2021, 12:25 PM   #27
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

I'm sorry still nothing. Let me know if you need any assistance.

btw, the resize thingy is solved
permeke is offline   Reply With Quote
Old 11-19-2021, 01:00 PM   #28
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
I'm sorry still nothing. Let me know if you need any assistance.

btw, the resize thingy is solved
Hopefully v1.1.3 does the trick!
FeedTheCat is online now   Reply With Quote
Old 11-19-2021, 01:10 PM   #29
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

Quote:
Originally Posted by FeedTheCat View Post
Hopefully v1.1.3 does the trick!
YES !!!!!

thank you
permeke is offline   Reply With Quote
Old 11-20-2021, 02:05 AM   #30
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
YES !!!!!

thank you
Awesome! Thanks for the help
FeedTheCat is online now   Reply With Quote
Old 11-20-2021, 08:10 AM   #31
permeke
Human being with feelings
 
Join Date: Dec 2019
Posts: 395
Default

your theme looks nice . what is it ?
permeke is offline   Reply With Quote
Old 11-20-2021, 03:25 PM   #32
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by permeke View Post
your theme looks nice . what is it ?
Echolot with a few tweaks.
FeedTheCat is online now   Reply With Quote
Old 11-21-2021, 03:46 AM   #33
todd_r
Human being with feelings
 
todd_r's Avatar
 
Join Date: Nov 2006
Posts: 762
Default

Hi,

Love this thanks!

Would it be possible for the sample to keep playing after clicking the Tuner keyboard?

I know this may well be a limitation out of your hands, but it would be rather wonderful,

Thanks
Michael
todd_r is offline   Reply With Quote
Old 11-21-2021, 08:06 AM   #34
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

@todd_r

Check out v1.2, think it should work now.
FeedTheCat is online now   Reply With Quote
Old 11-21-2021, 06:59 PM   #35
todd_r
Human being with feelings
 
todd_r's Avatar
 
Join Date: Nov 2006
Posts: 762
Default

Wow thanks for the quick response! Perfect
todd_r is offline   Reply With Quote
Old 11-21-2021, 07:13 PM   #36
todd_r
Human being with feelings
 
todd_r's Avatar
 
Join Date: Nov 2006
Posts: 762
Default

Made an action to open it with Media Explorer, it's now a default part or Media Explorer for me
todd_r is offline   Reply With Quote
Old 11-21-2021, 09:58 PM   #37
cool
Human being with feelings
 
Join Date: Dec 2017
Location: Sunny Siberian Islands
Posts: 531
Default

Very cool! Thanks!

Can the script read file names? I noticed that sometimes the script is wrong with the key, although the name of the note is written in the file name. This may be an idea for further upgrades: the script can first of all check the file name and, if there is no note name, only then start the FFT analysis. In theory, this will improve accuracy and reduce processing time.

But I immediately see one difficulty: how to determine the name of the note from the title. I think the mask in the form of " E " (with spaces), "_E_", "-E-", as well as the addition of sharps and flats, will help to highlight the notes from the full name.

/
cool is offline   Reply With Quote
Old 11-22-2021, 04:53 AM   #38
FeedTheCat
Human being with feelings
 
FeedTheCat's Avatar
 
Join Date: May 2019
Location: Berlin
Posts: 1,018
Default

Quote:
Originally Posted by todd_r View Post
Made an action to open it with Media Explorer, it's now a default part or Media Explorer for me
Nice, glad you like it!

Quote:
Originally Posted by cool View Post
Very cool! Thanks!

Can the script read file names? I noticed that sometimes the script is wrong with the key, although the name of the note is written in the file name. This may be an idea for further upgrades: the script can first of all check the file name and, if there is no note name, only then start the FFT analysis. In theory, this will improve accuracy and reduce processing time.

But I immediately see one difficulty: how to determine the name of the note from the title. I think the mask in the form of " E " (with spaces), "_E_", "-E-", as well as the addition of sharps and flats, will help to highlight the notes from the full name.

/
It doesn't parse file names atm, but it's a good idea. I was already planning to check file metadata for the "KEY" tag, then I'll just include file names as well.
FeedTheCat is online now   Reply With Quote
Old 11-24-2021, 07:11 AM   #39
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 678
Default

Wow!!!
This is a great addition to Reaper for the 2021!

Now all Reaper needs is a Chord Track.
Ozman is offline   Reply With Quote
Old 12-09-2021, 07:28 PM   #40
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 678
Default

Ok, I've notice that the reaper.new_array() has a limited size.
What's is the max sample length that this can analyze. I know it's somewhere under a minute.
Ozman is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.