New Tool (2.8): Scalefinder (Osc) 0.1Alpha

So i’ve been hacking Suva’s Scalefinder tool … (again)

UPDATE
Converted the tool to use OSC, that means no more midi loopback needed!

Setup:  
1. Enable OSC server under Preferences->OSC->Enable Server with default settings (UDP: 8000)  
2. Load the tool and select "OSC" as playback method (will be saved)  
  

Please notice that the tool will not throw an error if it can’t connect to the OSC server, it will simply do nothing.

Chord Mode:

Scale filter mode:

  
  
2. Usage:   
  
- Tools adds a menu entry: Tools->ScaleFinder (OSC)  
- Tool has three MODES:  
(MODE can be switched with the button that shows "Chord" on startup (top-left) or with a key or midi mapping)   
 * Chord Mode:   
 MIDI Input: plays the corresponding scale chord for each triggered note, that fits the scale   
 (eg: Scale C major: C triggers C maj, C# is empty, D triggeres D minor, etc.)  
 KEYS: keys 1 .. 7 trigger scale chords I .. vii (first press = note on, second press = note off)  
 * Scale Mode:  
 MIDI & KEYS: only notes that fit the scale will play  
 * Bypass: gui closes, keys and midi input realeased (besides mappings)  
  
- Tool adds a bunch of midi mappings (Global->Scalefinder) and key mappings (Preferences->Keys->Global->Scalefinder) which will work even when the tool is in "Bypass" mode  
- When the tool is closed (not "bypassed") the last mode will work until instrument is switched  

NOTE about the “use fake track/instrument” option:

  • if the midi device selected as ‘midi input’ is activated in the renoise preferences please leave the option switched on (default), otherwise there will be empty note columns on record
  • if the selected midi device is not activated in the preferences you can savely switch the option off

The coding is (still) rather “hackish” and i suppose there will be bugs and inconveniences, please report!
Happy chording … :)

bugs:
-crash on incoming midi when bypassed

2917 com.renoise.ScaleFinderOSC.xrnx

what a tool :w00t:

first feature request:) define your own chords, miss some ninths:)

Scalefinder makes new track left of master ,is that correct?
also, but I’m not 100% sure about it , sometimes it uses full velocity on MIDI input
got that, was user error:)

got error
std::logic_error: ‘the master track can not be deleted.’
stack traceback:
[C]: in function ‘delete_track_at’
.\midi_in.lua:137: in function ‘fakeTrack’
main.lua:528: in function ‘setBypass’
.\key_bindings.lua:133: in function ‘switchMode’
main.lua:348: in function main.lua:347

next one
std::runtime_error: ‘notifier feedback loop detected. do not change values you are listening to within your notifiers.’
stack traceback:
[C]: in function ‘delete_track_at’
.\midi_in.lua:137: in function ‘fakeTrack’
main.lua:528: in function ‘setBypass’
main.lua:542: in function ‘updateInstrument’
main.lua:613: in function main.lua:613

I’m not using loopback btw

maybe there is some way to attach this tool to a single track only even if I set MIDI input?

ScaleFinder uses a fake track and instrument to capture the original midi input (otherwise the triggering note would be recorded in addition to the chord and the scale filter wouldn’t work).
Can you maybe specify when the error occured? how many tracks did you have at the time, or did you maybe delete the Scalefinder track?

EDIT: that means you have a midi input selected but no loopback setup? … cause you’re not supposed to do that, i should disable the midi in option when no loopback is active.

gmm04e, i will make the fakeTrack and Instrument optional and see if i can get the midi input work without a loopback … but actually, the whole tool design is based on the midi loopback. i suggest you try it with loopMIDI, cause imho it’s well worth the additional setup time!

Hard to say ,1-2 tracks and generally messing with it, didn’t delete SF track.

Yes, but I’ll try this loopback device later.

also,can you read velocity from midi keyboard? For now it’s working on full velocity I suppose.

It will use the velocity if the loopback is enabled.

You can do so through OSC, but the OSC server should then be enabled.

Installed loopback ,it is working better now

but got this
std::runtime_error: ‘notifier feedback loop detected. do not change values you are listening to within your notifiers.’
stack traceback:
[C]: in function ‘delete_track_at’
.\midi_in.lua:137: in function ‘fakeTrack’
main.lua:528: in function ‘setBypass’
main.lua:542: in function ‘updateInstrument’
main.lua:613: in function main.lua:613

IIRC, it was changing track with diffirent instr when this occured

also there is this unclear situation when you
-close tool,
-change instrument (sf track deleted)
,then you open tool again, but to make it work again you must cycle through ‘scale\chord’ button (to make sf track again).

yup, you’re right there, fixed it in my current version.

i can’t replicate the “notifier feedback loop” here, and it’s a bit wierd cause it comes from a function that should just setup a notifier on instrument change. can you maybe provide more information on this, os, 32/64 bit, exact order of things you did before the error got thrown, if possible :o

Notifier feedback loop can often also be caused by changing a GUI control value that is changed from a function, but is called by the GUI function notifier as well as soon as the control is tweaked.
Simply check the controls if they aren’t calling a function that is also changing the value of that very same control.(What is setByPass doing?)

really nice … <3

gmm04e, i updated the tool, there’s a certain chance that the error is fixed now, if not can you maybe try to switch off the “Use fake instrument & track” option, see if that changes anything and report back?

vV, the updateInstrument() notifier calls setBypass() if the gui is not visible, which calls a function to delete the fake instrument, which would cause a feedback loop, i guess. but the function which deletes the fake instrument only works once, and will do nothing the next time it gets called … i could imagine that the feedback error could get thrown when the deleting of the instrument fails, but in this case there should be an error before the notifier loopback i think.

The error doesn’t fire without reason, if the routine works only once, better remove the notifier when the routine has been called, in that case you know for sure it cannot be called a second time. If it is needed once more, then set the notifier again when appropriate.

Working really great, now:)
No script errors, only sometimes hanging notes when playing and at the same time changing chords or inversions (fake track disabled)
The blinking chord name then remains highlighted.

updated to use OSC instead of a midi loopback
thx vV and danoise for the idea :)

There is something wrong with ‘use fake instrument & track’ option

Play same note to hear chord and change periodically this option. The chord with checked and unchecked option doesn’t sound the same.

also

In the pattern editor press ESC and record note. First note of the chord landed in first column, then second column is empty, and second note of the chord landed in third column and third note in fourth column.

This happens when the fake instrument/track option is turned off, right?
It looks like renoise (or OSC) has some kind of input filter for OSC/MIDI messages, that will detect identical, “doubled” notes and delete them, but doesn’t delete the note column for the deleted note.
The doubled note is the one that comes in from the midi controller/keyboard. It would be possible to just “add” the chord to the played note from the controller, but that would make inversions (root note is transposed) impossible. As far as i can see there is nothing i can do against it.
The problem won’t arise if you leave the “use fake track/instrument” option on tho (is default)!
For the different sound of chords:
“no fake track” enters: C4, [], D#4, G4 for example
“with fake track” overites: C4, D#4, G4
so that makes C4, D#4, D#4, G4 after switch, which might explain the slightly different sound.

Thanks for testing!

So maybe, in the light of those issues remove this option completely? Unless you can fix this.

-load vsti
-load scalefinder
-press [x] on scalefinder
-change instrument (fake track disapear)
-play some notes

to got this

.\midi_in.lua:88: variable ‘midi_device’ is not declared
stack traceback:
[C]: in function ‘_error’
[string “local mt = getmetatable(_G)…”]:29: in function <[string “local mt = getmetatable(_G)…”]:24>
.\midi_in.lua:88: in function <.\midi_in.lua:29>

thx, should be fixed by now.