Kara-Moon Forum
April 19, 2024, 06:17:11 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: You can go back to the main site here: Kara-Moon site
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Multi-bar sequences  (Read 3344 times)
sciurius
Sr. Member
****
Posts: 443



« on: April 19, 2020, 03:15:21 PM »

I get a little lost...

I have a sequence in Time 4 and SeqSize 4. So it has 16 beats.

This plays the full sequence (4 bars, 16 beats):

  1   A * 4

I want to play it with chord A for the first 2 bars and chord B for the second 2 bars.
This plays only 4 beats instead of 16:

  1   A  /  B  /

MMA does not allow more than 4 chords:

  1   A / / / / / / / B / / / / / / /

Nor an offset greater than Time:

   1   A B@8

Nor does Truncate:

  Truncate 8

How to achieve this?
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #1 on: April 19, 2020, 04:33:11 PM »

I get a little lost...

I have a sequence in Time 4 and SeqSize 4. So it has 16 beats.

This plays the full sequence (4 bars, 16 beats):

  1   A * 4

This creates/plays 4 bars all the same. It is exactly the same as writing

  1 A
  2 A
  3 A
  4 A

It's just a shorthand for repeating bars.
Quote

I want to play it with chord A for the first 2 bars and chord B for the second 2 bars.
This plays only 4 beats instead of 16:


So, you'd do:

1 A
2 /   --- a '/' just repeats the last used bar (A)
3 B
4 /   

Quote
MMA does not allow more than 4 chords:

Sure it does. Pack as many chords in a bar as you want! Again, using a notation like

1  A B C D

is just a shorthand telling MMA you want A at beat 1, B at 2, etc. So, you can have many different chords as you want:

1 A B@1.5 C@1.75 ...

BUT, whether or not the chords actually make a sound is dependant on the underlying pattern. So if you have a pattern like

    Chord 1 4 90;

then ONLY the chord at beat 1 will sound.

Quote

Nor an offset greater than Time:

   1   A B@8

Nor does Truncate:

  Truncate 8

Using 8 you are trying to do something in the next bar. Can't do that. Use 2 bars of music should work.

Are you getting confused between BARs of music, PATTERNS and SEQUENCES?

Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #2 on: April 19, 2020, 05:29:36 PM »

Quote
Are you getting confused between BARs of music, PATTERNS and SEQUENCES?

Yes  Roll Eyes . I was under the (wrong!) assumption that each line of input would play the complete Sequence of the Groove...

This is the first time I wanted to make Grooves with SeqSize > 1.

Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #3 on: April 19, 2020, 06:44:25 PM »

Sequences are a very powerful part of MMA! Glad to hear you are getting it figure out ... sometimes I think this program is way to complicated Smiley I even use the manual on a regular basis!
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #4 on: April 19, 2020, 08:38:46 PM »

I now wrote a little proof-of-concept tool that transforms an ASCII percussion tab like this:

Code:
# 08Beat01[0]
 1|2-------3-------|2-------2-------|2-------3-------|2-------2-------|
 2|----3-------3---|----3-------3---|----3-------3---|----3-------3---|
 3|3-1-3-1-3-1-3-1-|3-1-3-1-3-1-3-1-|3-1-3-1-3-1-3-1-|3-1-3-1-3-1-3-11|

into this:

Code:
Begin Drum-Kick
    Tone        KickDrum1
    // Add Volume, RTime, RVolume etc. here...
End

Begin Drum-Snare
    Tone        SnareDrum1
    // Add Volume, RTime, RVolume etc. here...
End

Begin Drum-ClosedHat
    Tone        ClosedHiHat
    // Add Volume, RTime, RVolume etc. here...
End

Drum-Kick       Sequence { 1.0 0 60; 3.0 0 90 } \
                         { 1.0 0 60; 3.0 0 60 } \
                         { 1.0 0 60; 3.0 0 90 } \
                         { 1.0 0 60; 3.0 0 60 }

Drum-Snare      Sequence { 2.0 0 90; 4.0 0 90 } / / /

Drum-ClosedHat  Sequence { 1.0 0 90; 1.5 0 30; 2.0 0 90; 2.5 0 30; 3.0 0 90; 3.5 0 30; 4.0 0 90; 4.5 0 30 } / / \
                         { 1.0 0 90; 1.5 0 30; 2.0 0 90; 2.5 0 30; 3.0 0 90; 3.5 0 30; 4.0 0 90; 4.5 0 30; 4.8 0 30 }

DefGroove Drum-08Beat01

The percussion tab above is, on its turn, generated from the percussion data of the Zoom R24. 500+ of built-in drum patterns can now be turned into MMA grooves at the push of a button...

And it is easy to manually compose drum patterns using a percussion tab and then turn it into MMA.

The conversion tool is written in Perl (of course) but I may, eventually, turn it into an MMA plugin. It is a quite straightforward process.
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #5 on: April 19, 2020, 09:03:48 PM »

Neat!

Just a couple of quick comments (and I'm assuming you really do know this already ...) on the actual code you've generated:
Code:
Begin
    Tone        KickDrum1
    // Add Volume, RTime, RVolume etc. here...
End

And why not have the actual sequence here as well?


Code:
Drum-Snare      Sequence { 2.0 0 90; 4.0 0 90 } / / /

You can leave the trailing / / / out and it comes out the same. The, rather primitive, MMA code just keeps duplicating the sequence until it's the right size or longer, and then truncates it.
Logged

My online life: http://www.mellowood.ca
sciurius
Sr. Member
****
Posts: 443



« Reply #6 on: April 20, 2020, 06:35:09 AM »

And why not have the actual sequence here as well?

The example has a single groove. In practice there are multiple grooves, so I separated setting up the instruments (common to all grooves) from the actual groove definitions.

Quote
You can leave the trailing / / / out and it comes out the same.

There's is always micro-perfection Wink .
Logged
sciurius
Sr. Member
****
Posts: 443



« Reply #7 on: April 20, 2020, 05:50:56 PM »

Assuming I want to make a plugin to define percussion patterns from ASCII tab data, what would be the best way to get the tab data into the plugin?

I tried two alternatives:

Code:
@Perc NewGroove, Tab=\
1 |1-------|\
2 |-2------|\
3 |--3-----|

Disadvantages: ugly, and the three lines are joined together (the newlines get lost).

Code:
MSet TabData
1 |1-------|
2 |-2------|
3 |--3-----|
EndMSet

@Perc NewGroove, Tab=TabData

So I pass the name of a (multiline) macro and retrieve it inside the plugin from macros.vars.

Disadvantage: a bit tricky, and the data seems to have been split on whitespace:

[['1', '|1-------|'], ['2', '|-2------|'], ['3', '|--3-----|']]

What I ideally would want is

['1 |1-------|', '2 |-2------|', '3 |--3-----|']

Any hints?
Logged
bvdp
Kara-Moon Master
****
Posts: 1437


WWW
« Reply #8 on: April 20, 2020, 09:04:49 PM »

I was thinking of this the other day and hoping you'd not ask Smiley

The problem with a plugin is that it only works on a single line of data. I really don't see a way around that ... but, you could always do something like using Begin/End. But, then the plugin itself would get very complex. The other way would be for the plugin to use an END sentinel, but I don't think you can read additional lines from inside the code ... so, again, ugly. Using an Mset is just hiding the long line. Not much being gained.

So, I'd suggest the "one long line" option using '\'s if needed.

My only other idea is to have the data for the pattern/sequence in a separate file, pass the filename, and read that. This way the plugin would have total freedom. Hell, you could even call up a secondary program written in perl to do the heavy lifting if you want. I don't think there is any restriction built into the plugin mechanism to prevent that.
Logged

My online life: http://www.mellowood.ca
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.04 seconds with 19 queries.