Architect: Does anyone have a * macro/script

Official support for: loomer.co.uk
Post Reply New Topic
RELATED
PRODUCTS

Post

tom plese wrote: Thu Nov 04, 2021 11:54 amit's very loosely based on the work of Xenakis, a revolutionary composer that has used algorithms to generate sets of numbers (arrays) that could be "translated" to either pitch or rhythm.
Sieves? https://www.kvraudio.com/forum/viewtop ... 0#p7309910
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

Thanks for the link! it is great but I have a variation of the sieve method in mind and not sure if building on the linked patch and fragments would be possible.
if i ever manage to make it work, i'll post it here

Post

tom plese wrote: Thu Nov 04, 2021 6:39 pmI have a variation of the sieve method in mind and not sure if building on the linked patch and fragments would be possible.
I see for some reason I never posted my Lua script that encapsulated the Architect objects. I should remember not to reply to posts before breakfast is over. The script below should be a bit more illustrative of the approach insofar as it's readable.

Reviewing your earlier posts, I think your difficulty is trying to model your algorithm as something that manipulates MIDI format data. The sieve demo I wrote uses TRUE/FALSE entries for an array size equivalent to the number "ticks" (beats) in a chosen loop of 48 ticks. This could also be the number of intervals in an octave or some such if you were dealing with pitch. With all the arrays the same size, containing T/F data, you then get all the logic elements for free--and I guess in your case--no need to sort data.

The example patch enables different sized "loops" or "octaves" on the fly, so you're not chained to some fixed notion of measure or interval.

Anyway, my suggestion is to model your algorithm simply as a data structure, and then figure out what you need to do to convert that data to usable MIDI. Separate things into a domain hierarchy.

HTH

Code: Select all

function sieve(extent, modulo, shift)
  sarray = arc.array.new()
  for i = 0, extent-1 do
    if (i % modulo) == shift then
      sarray:insert(true)
    else
      sarray:insert(false)
    end   
  end
  return sarray
end

function V(a, b)
  tmp = arc.array.new()
  for i in pairs(a) do
    tmp:insert(a[i] and b[i])
  end
  return tmp
end

function U(a, b)
  tmp = arc.array.new()
  for i in pairs(a) do
    tmp:insert(a[i] or b[i])
  end
  return tmp
end

function NOT(a)
  tmp = arc.array.new()
  for i in pairs(a) do
    tmp:insert(not a[i])
  end
  return tmp
end


function arc.module.setup()
  -- sieves in parentheses, mostly unions
  p80u81u87 = U(U(sieve(40, 8, 0), sieve(40, 8, 1)), sieve(40, 8, 7))
  p51u53 = U(sieve(40, 5, 1), sieve(40, 5, 3))
  p80u81u82 = U(U(sieve(40, 8, 0), sieve(40, 8, 1)), sieve(40, 8, 2))
  p83 = sieve(40, 8, 3)
  p84 = sieve(40, 8, 4)
  p85u86 = U(sieve(40, 8, 5), sieve(40, 8, 6))
  p52u53u54 = U(U(sieve(40, 5, 2), sieve(40, 5, 3)), sieve(40, 5, 4))
  p81v52 = V(sieve(40, 8, 1), sieve(40, 5, 2))
  p86v51 = V(sieve(40, 8, 6), sieve(40, 5, 1))

  -- intersections
  p80u81u87vp51u53 = V(p80u81u87, p51u53)
  p80u81u82n50 = V(p80u81u82, sieve(40, 5, 0))
  p85u86v52u53u54 = V(p85u86, p52u53u54)

  psappha = U(U(U(U(U(U(p80u81u87vp51u53, p80u81u82n50), p83), p84), p85u86v52u53u54), p81v52), p86v51)

  arc.module.outlets[1]:send(psappha)
end
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

Thank you, your effort is greatly appreciated! I have 0 prior experience with programming languages and i've only been reading the Programming in Lua book for a few days now.
While i aim towards understanding the code you shared i am regretfully not there yet.
Unlike the code, i understand the logical and musical aspect of things and your post will help me push towards my goal-thanks again!

Post

So how does your current idea/project differ from Xenakis’ use of Sieves?
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

cturner wrote: Fri Nov 05, 2021 12:38 am So how does your current idea/project differ from Xenakis’ use of Sieves?
the goal is very similar-achieve music through algorithms and stochastics.

i'd like to build a modular(fragment collection with panel view) environment in Architect that allows you to generate "synchronized" (broadly speaking) music in real time with control over things like arrangement/orchestration (via cc & midi channels) as well as tempo, rhythm, phrasing and pitch.
Sieves(approximation) would be one of many methods of generating arrays that will be the main source of data that is further manipulated (probabilities, distribution etc) and used to control pretty much every available aspect of music through your daw.
Also, i'd like do be able to have a variable degree of control via live midi note input-i've had some success with things like autoarrangers so far.

Thanks again for the Lua script-i understand it now but i'm still nowhere near a point where I could do something like that from scratch.

Post

tom plese wrote: Fri Nov 05, 2021 6:00 pm...would be one of many methods of generating arrays that will be the main source of data that is further manipulated (probabilities, distribution etc) and used to control pretty much every available aspect of music through your daw....
You might want to look at Christopher Ariza's Athena CL composition environment. It's one of the few that incorporates Sieves, and with Athena written in Python, the makeup of the program is eminently readable. You can see how he's broken things into various domains, which I think will be quite important to your effort.

http://www.flexatone.org/article/athenaCLMain

As you said previously, you wanted to use Sieves for both pitch and rhythm, which are both very different domains. The argument is that you'd want to have your Sieves code be abstract enough to work in both domains, otherwise any change forces rewrites in two or more areas of your code, with attendant confusion.

HTH
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

thank you for your effort, but since i have 0 experience with programming and computer lingo, the athenaCL is utterly incomprehensible.
i have a vague idea of what "libath" is & what it's supposed to be used for but have no clue where it is, what does "assume we are in package dir" mean and how i'm supposed to check. things like "sys.stdout.write" could as well be written in ancient greek xD

I'd rather not loose focus and learn Architect & slowly work towards understanding lua. Judging by what i've already patched, I think Architect is capable of doing everything I described before-for instance, I've made arrays(and sieves) work with pitch and time already, ie you can use the same array(or as many different ones you want) to generate rhythm and/or notes. Have not yet built a macro that "freezes" a random sequence of array values but i think i know how and hope to do it once i fix the issues i've encountered.

My main problem at this moment is not understanding the rules governing triggering and why do i need to trigger certain macros multiple times to work properly even though it is connected in a way that a single trigger should do the job. Obviously not, but it seems that way to me lol

I'll rebuild everything and check every step, hopefully i find the culprit and what to change.

Post

tom plese wrote: Sat Nov 06, 2021 10:02 am My main problem at this moment is not understanding the rules governing triggering and why do i need to trigger certain macros multiple times to work properly even though it is connected in a way that a single trigger should do the job. Obviously not, but it seems that way to me lol
Could you send me this part of your patch, and I'll see if I can work out where it is going wrong? Thanks. Either PM it, attach it to a reply (if you don't mind it being public), or email it directly to colin (at) loomer.co.uk.
Architect, the modular MIDI toolkit, beta now available for macOS, Windows, and Linux.

Post

colin@loomer wrote: Wed Nov 10, 2021 9:54 am Could you send me this part of your patch, and I'll see if I can work out where it is going wrong? Thanks. Either PM it, attach it to a reply (if you don't mind it being public), or email it directly to colin (at) loomer.co.uk.
thanks, that would be great! ofc i don't mind making it public, but the public might xD

i know i made many egregious errors(just don't know where they are) so if you deem the patch unfixable or have a working solution for the "sort two ordered arrays" problem be quick with your judgement and abandon the patch.

Thanks for your time and effort!
You do not have the required permissions to view the files attached to this post.

Post

I’d love to have a look too once it’s finished !
Last edited by nilhartman on Thu Nov 11, 2021 10:08 pm, edited 1 time in total.
Computer musician / Ableton Certified Trainer / Mastering engineer
.com
3OP

Post

tom plese wrote: Thu Nov 11, 2021 8:08 ama working solution for the "sort two ordered arrays"
In your example patch, you don't say what happens to elements present in both arrays. 10 appears in both arrays. Are they both kept, or is one of the elements dropped?

The process is really "merging two sorted arrays", correct? IOW: "joining two arrays and then sorting".

EDIT: Looks like table.sort() works in Lua, so why don't you try that?
Tablesort-211111.zip
For more information on table.sort(), see page 196 of _Programming in Lua_ 3rd edition.

HTH
You do not have the required permissions to view the files attached to this post.
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

Both elements are dropped, but I know there must be a dozen better ways to do it.
This is how I put it together: since the arrays that are being merged (thanks for the correct term) are in order, the shared values always "wait for each other"-if there's a 10 in both but arrA has 2, 4, 6, 8 before and arrB has 0 and 5 it will take lowest values in correct order (0,2,4,5,6,8) so arrB will hold 10 until it shows up in arrA.

If both arrays have the same value during the "shift macro", then both are truncated since the declared "minimum" value of their shifted elements equals both values.

Thank you very much for your help, will test the table.sort() today-I'm going through the Lua book but am nowhere near page 196 yet xD

Thank you all for being patient and helpful, I'll do my best to learn the correct language as quickly as possible so I can properly communicate. In hindsight, I probably should've done that before trying to patch stuff.

Thanks again!

Post

tom plese wrote: Fri Nov 12, 2021 7:15 amBoth elements are dropped...
This sounds like you're talking procedurally, not in terms of what you want as a result of your algorithm. You're not suggesting that
[0, 1, 4, 5, 7, 13, 15, 16, 19, 22, 25, 28]
should be the output, are you?

I'd think that
[0, 1, 4, 5, 7, 10, 13, 15, 16, 19, 22, 25, 28]
is what you'd want, correct?
I'm going through the Lua book but am nowhere near page 196 yet
The book isn't sequential in its presentation, there's no penalty for "dropping in" where the exposition touches on a topic of interest.
I'll do my best to learn the correct language as quickly as possible so I can properly communicate. In hindsight, I probably should've done that before trying to patch stuff.
I'm sure I don't use terms with sufficient precision either, but "correct language" will help with internet searches and more importantly, thinking clearly about algorithm design.
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post

nilhartman wrote: Thu Nov 11, 2021 10:08 amI’d love to have a look too once it’s finished !
Given that the Sieves objects I posted gets the OP about 95% of the way toward his preset working, I don't see this as a great use of Colin's time.
Tranzistow Tutorials: http://vze26m98.net/tranzistow/
Xenakis in America: http://oneblockavenue.net

Post Reply

Return to “Loomer”