Jump to content

A click/metronome that's always on (perhaps with MidiFXScript?)


crimsonnoise

Recommended Posts

I'd like to have a second, independent click / metronome that doesn't respond to the click on/off global command but that's always playing. This is for sending to another output while printing stems.

 

If I chain up another Metronome object to another Klopfgeist it always turns on/off with the global command.

 

Would a solution be a simple Midi FX Script? I had a look at the Sequencer Scripter preset, but that seems to only play when it receives midi, and also only gives 1/4, 1/8 options, and doesn't automatically switch to 3/8 like the metronome does in 6/8 time signature for example. I'd like it to behave like the metronome, with bar and group clicks.

 

Any suggestions would be hugely appreciated!

 

(Logic 10.4.4)

Link to comment
Share on other sites

yes it can. here is a simple example that is just matching a midi note to whatever the built in metronome does, including meter changes. This script automatically detects the meter changes, you don't really need to do anything special, but its based simply on every time the beatPosition goes up to the next integer. (side note, internally LPX tracks beat as a fractional number and every time it passes x.0, then you can consider you're on a new "beat" according to what Logic thinks a beat is internally).

 

This simple script seems to mirror the built in metronome no matter the meter changes...

 

code deleted

 

If you need the click track to be more complicated, and/or handle different meters with different notion of what a beat is, then you will have to add more code as desired...

 

I notice that for example a 6/8 meter ends up sending the click on the 8th notes...not on the two 6/8 beats, for example. So what Logic internally thinks of as a "beat" is not what I would consider the musical description of a "beat".

 

here is some more code added to show how to detect when the meter has changed, but you will need to add your own code and get more complicated to take that information and adjust how the click is played back.

 

code deleted

Edited by Dewdman42
Link to comment
Share on other sites

A completely different approach would be to keep the click and thus Klopfgeist activated at all time, route Klopfgeist over a bus to two Auxes, one to Stereo Out and the other to whatever output you need. Then utilize any vacant MIDI message from your controller (unused MIDI note, Panel Switch, Drum Pad, Footswitch, etc.) and convert it in the Environment to a mute toggle acting on only that first Aux.

This would replicate the old Click on/off functionality (albeit with a hardware key instead of a key command) and keep the click running on that other output.

With slightly more effort you could tell an external key utility (Keyboard Maestro or even Automator w/Applescript) to send that MIDI command from the actual ASCII key that originally controlled Click on/off to make it completely seamless.

Link to comment
Share on other sites

Fab, that's genius, thanks! It works.

 

On my system it stumbles for one beat at start of playback and at meter changes. Does it play smoothly at your end?

 

I think I know what the script needs to fix that issue, I will try to correct that for you sometime today.

 

As much fun as it is to play around with Scripter, I tend to agree with Fuzzfilth here though, I think you can solve your issue with audio routing from the built in metronome, keep it out of the stems when you bounce and still hear it in another place.

Link to comment
Share on other sites

Cool stuff. New script doesn't quite solve the issue, on my system at least, still a strange, but different, blip when changing from 4/4 to 6/8 for example, then when changing back to 4/4 it disappears altogether. But it's fascinating what can be done with these scripts! Where did you learn that Dewdman?

 

Fuzzfilth - great idea. I'll see if there is a way to get it to unmute that channel automatically when in record, and mute again during playback.

Link to comment
Share on other sites

Alright looked at it some more. Its doable, but while I was hoping I could do something in a simple script, the truth is that its not that simple and I've spent too much time on it already...so...sorry...forget the above script... It would need to be a rather sophisticated script...especially to take into consideration cycle looping, meter changes, starting partway in the sequence, etc. There yet might be an elegant simple script solution, but I didn't figure that out yet and I don't want to spend any more time on it.. This much I can say, its probably a rather complicated script and you probably won't figure that out.

 

I have a few more ideas about it, and after the weekend I might get a little time to experiment some more.

 

I recommend you go with Fuzzfilth's suggestion to re-route the metronome output to avoid bouncing it to stems.

 

There are also some 3rd party VST metronomes out there, that would probably work for you, but then you have to mess with running a VST on Logic..another topic...but google that for another possible solution.

Link to comment
Share on other sites

Looking into scripter solution a bit more, I think I may have discovered bugs in scripter. The detected beat position number is jumping all over the place when there are meter changes. In my view that makes scripter entirely unusable for anything involving scheduling of midi events based on beat position, if there are any meter changes.

 

I have filed a bug report to Apple.

Link to comment
Share on other sites

Definitely there is some weirdness going on with Scripter and beat position when there are meter changes... Well I've filed a bug already. If they ever fix that bug, then this is the most simple script I could think of and I don't see any reason why it wouldn't work, but for now, it won't work due to the Scripter bugs. In the meantime, just route the audio output from Klopfgeist in order to bounce without metronome.

 

var NeedsTimingInfo = true;

var clickVelocity = 127;
var clickChannel = 1;
var clickPitch = 90;
var clickDuration = 0.03125;  // 1/32 duration

function ProcessMIDI() {

   var info = GetTimingInfo();
   
   if(!info.playing) {
       return;
   }
   
   var intStart = Math.trunc(info.blockStartBeat);
   var intEnd = Math.trunc(info.blockEndBeat);

   if(intStart == info.blockStartBeat) {
       playClick(intStart);
       return;
   }
   
   if(intStart != intEnd) {
       playClick(intEnd);
       return;
   }
   
}

var click = new NoteOn;
click.channel = clickChannel;
click.velocity = clickVelocity;
click.pitch = clickPitch;

function playClick(beat) {
   click.velocity = clickVelocity;
   click.sendAtBeat(beat);
   click.velocity = 0;
   click.sendAtBeat(beat + clickDuration);
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...