Frederic Posted September 22, 2019 Share Posted September 22, 2019 Hello all, I'm coming from the javascript development world. Here are few musical ideas. Is there a way to implement them thanks to Opusmodus ? - play a sequence of notes in 30 seconds: in javascript, it could be pseudo-coded like this: setTimeout(function(){ play('c4 d4 e4 f4 g4'); }, 3000); - play a sequence of notes at a specific event. in Javascript/jQuery, it is very easy to code anonymous functions that would wait for a specific event to be triggered. Some examples I have in mind: play 'do ré mi' at bar 4 $('4th bar').on(function() { play('c5 d5 e6');}); play 'do ré mi' each time note f5 is played $('f5').on(function() { play('c5 d5 e6');}); repeat the note + octave when f5 is played $('f5').on(function(this) { play(this + this.octave(1));}); In other words: is it possible to trigger an anonymous function with opusmodus, so that a musical phrase will be played at specific event ? Thanks for clarification, best ! Quote Link to comment Share on other sites More sharing options...
opmo Posted September 23, 2019 Share Posted September 23, 2019 SLEEP is the function you are looking for. (sleep time) ; in seconds The 1st expression will play for 10 second. The 2nd for 4 seconds. (progn (ps 'gm :cl (list (gen-repeat 100 '((s c4 d4 e4 f4 g4))))) (sleep 10) (ps 'gm :fl (list '(q c5 d5 e5 f5 g5 a5 b5))) (sleep 4) (ps 'gm :fl (list '(w cs6))) ) AM 1 Quote Link to comment Share on other sites More sharing options...
AM Posted September 23, 2019 Share Posted September 23, 2019 but SLEEP is not very precise - would be nic to have in OPMO a real precise trigger, like with OSC (for external players...) Quote Link to comment Share on other sites More sharing options...
opmo Posted September 23, 2019 Share Posted September 23, 2019 very precise: (sleep 0.645) Quote Link to comment Share on other sites More sharing options...
AM Posted September 23, 2019 Share Posted September 23, 2019 the NUMBER is precise, but ... ...but the great thing is, you are very flexible (and open) in OPMO/lisp... and you can trigger also other software/externals from OPMO/lisp via OSC, i LOVE IT Quote Link to comment Share on other sites More sharing options...
opmo Posted September 23, 2019 Share Posted September 23, 2019 Every function which use a time wait (Threads, OSC and other libraries) using SLEEP - very precise indeed. Quote Link to comment Share on other sites More sharing options...
AM Posted September 23, 2019 Share Posted September 23, 2019 my colleagues from the computermusic laboratory advised me not to steer external things via internal SLEEP, but also to control the TIME / delay via OSC. perhaps also has to do with the fact that for me different things must be controlled in parallel and synchronized. i don't know... Quote Link to comment Share on other sites More sharing options...
Frederic Posted September 23, 2019 Author Share Posted September 23, 2019 Hello, Ok thanks ! I understand how to mitigate my first use case with SLEEP. But what the second one ? how to play a musical phrase at specific event, like for example when "f5" is played Thanks again ! Quote Link to comment Share on other sites More sharing options...
Stephane Boussuge Posted September 24, 2019 Share Posted September 24, 2019 you have many way to do that in OM, have a look to pattern-map for example or substitute-map... SB. Quote Link to comment Share on other sites More sharing options...
torstenanders Posted September 26, 2019 Share Posted September 26, 2019 > but SLEEP is not very precise The Common Lisp standard actually says that the number of seconds specified as arguments for sleep is approximate: > Causes execution to cease and become dormant for approximately the seconds of real time indicated by seconds, whereupon execution is resumed. CLHS: Function SLEEP WWW.LISPWORKS.COM Anyway, it seems that at least on a Mac the imprecision is rather regular, see the following discussion with empirical tests. Time to sleep under different platforms LISP-HUG.LISPWORKS.NARKIVE.COM Anyway, for realtime scheduling in a musical context one needs likely a proper scheduler for that. Best, Torsten AM 1 Quote Link to comment Share on other sites More sharing options...
AM Posted September 26, 2019 Share Posted September 26, 2019 thanks! a. p.s. Quote Anyway, for realtime scheduling in a musical context one needs likely a proper scheduler for that. ... that's why i have some other solutions for my needs... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.