< Back to IRCAM Forum

Select measures - tip

Ok, wow. thank you, this is good to know!

Here is an ‘empirical’ test I’ve just done, since I didn’t know about the ‘sort’ function. Yet, I already knew sort-list, so I tried both, and you can see in the attached image that while ‘sort’ is destructive, as already said, sort-list is not (what you have in the two bottom chord-seqs are the direct results of the sorting functions, showing that even if sorting is performed in that direction, only ‘sort’ is destructive retrospectively).

Maybe it’s an example of something that has already been said, that is: that most OM functions have been made to prevent from ‘destructiveness’? It’s a nice attention in any case :slight_smile:

I learned something today about it, thank you!

Jimmie

Yes: sort-list is basically a non-destructive version of sort, which copies the list (but not its individual elements) before to operate (+ has an option to sort the list recursively).

Hi Karim,

Now let’s use something funny, the pop macro. Just like popcorn it will remove (pop) the first elmt of any list (the car of a list). So :  

(pop toto)  

will return the “popped” elemt  

OM > 1  

Now let us “inspect” toto by just evaluating toto. this will give us :  

OM > (2 3 4)

I’ve applied your ‘appetizer’ example and I’ve noticed that the evaluation of toto after ‘popcorning’ it do not echo OM > (2 3 4)

In fact, toto is becoming (pop toto)… cf. img caps

N.

Screen-Shot-2018-09-11-at-21.40.58.png

Dear Nadir,

yes that’s the point. If you pop it all the way you will end up with nil .
So just replay it once in this sequence :

  1. (setf toto ‘(1 2 3 4))
  2. eval just toto
  3. (pop toto) [JUST ONCE !!!]
  4. eval toto (just the toto variable !)

ADDENDUM ,


Don’t use the mini listener.
Do the following here :

select new from file (menu file of the listener)

you will have a text file.

type as a first line :

(in-package :om)

save your file as xxx.lisp , or whatever .lisp

Then type your code, and do your evals in .lisp file. It could be that the mini “evaluator” in the listener re-initiazlizes itself. Dont know, i don’t use it …

Dear all,
A quick question! How to extract the indicated measures from one voice object to another? For instance, there are 100 measured voice object, and I would like to take measures 30-45 to another one, and how am I suppoesed to do? Would be really appreciated if anyone could help me out!
Thanks!

Hi eksan0318

You will find in the same here (here) one self explanatory patch (that i am again attaching here).
You just have to give a list from (30 45) -1 since, the first measure is considered as pos 0 and NOT 1.
You can use for instance (arithm-ser 29 44 1) => (29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44)
then feed it to posn-match (cf. attached patch)

Best
K

voice-and-voices.omp (31.9 KB)

Hi. I beleive i fixed #'select to take care of the offsets of the included measure (april 2017, commit e2010c144). If it still screws up offsets upon playback please send me a note.

If it is ok now, you can just use the #'select function on your 100-measure voice, and pass it 29 and 44 (zero-indexed positions), and it will output a new voice containing measures 30-45. Check attached screen-shot.

-anders

Skjermdump-fra-2019-01-20-20-57-30.png

Thank you both Karim and Anders!

And Anders, thanks for your tip of select function, it works perfectly!

A quick question to Karim, when I tried to download your attachments there is only a page of codes, no downloading process, how this problem can be solved? I have tried it several times still the same issue has came up.

Screen-Shot-2019-01-21-at-3.08.27-PM.png