Kara-Moon Forum

Developers & Technology => Musical MIDI Accompaniment (MMA) => Topic started by: sciurius on February 08, 2019, 08:55:32 PM



Title: Capo
Post by: sciurius on February 08, 2019, 08:55:32 PM
According to TFM:

Quote
Depending on the tuning of the “instrument” a “C” chord with a CAPO 2 will be created as a “B” chord shape played above the second fret.

As I interpret this is that with CAPO 2, a D chord will be played with a C-shape.

A C chord (without CAPO) is fretted 0 3 2 0 1 0 so I expect the D chord (with CAPO) to become 2 5 4 2 3 2. But what I get is 2 0 0 2 3 2, in other words, a D-shape instead of a C-shape. In fact, no matter if I put a "Plectrum Capo 2" in the file, no matter where I put it, I get identical midi files.

I also tried to emulate a capo with "Plectrum Tuning f#- b- e a c# f#+" but still identical midi files.

It is so obvious that this should work that I'm probably doing something extremely stupid... But what.

The attached mma generates midi notes F#1 A1 D2 A2 D3 F#3 instead of (expected) F#1 D2 F#2 A2 D3 F#3.


Title: Re: Capo
Post by: bvdp on February 08, 2019, 10:40:06 PM
Ya asking a sax player about capo :) Darned if I know ...

  1. I didn't write the code ... nice excuse!
  2. I'm tied up right now with concerts

But ... I'll have a look tomorrow and see if I can figure it out. Might be a manual problem ... can't imagine a bug in MMA  ???


Title: Re: Capo
Post by: sciurius on February 09, 2019, 09:05:41 PM
What I found out is that
- the capo is saved and restored with grooves (as documented)
- capo is reset by SeqClear and Time (!)

So a Capo only works if it is specified inside of a groove definition, and after a possible Time setting.

Setting a Capo in the song only affects the current groove (as documented).

As a guitar player I was not prepared for capo's that appear and disappear during a song  ;).

What I also found out is that Plectrum generates impossible chord fingerings. For example, a Bb chord (notes Bb, D, F) gets a fingering 1 1 0 3 3 1. This is not playable, you cannot have an open string under a barre. Bb is commonly fingered 1 1 3 3 3 1. Likewise an F chord (notes F A C) gets fingering 1 0 3 2 1 1. This should be 1 3 3 2 1 1.

I wish it were possible to define chord shapes for Plectrum...


Title: Re: Capo
Post by: bvdp on February 09, 2019, 10:32:08 PM
MMA is NOT a guitar.

The capo function may be a case of inappropriate naming.

Here's what's happening....

 - when the plectrum code figures what notes to play in a chord, it is NOT doing guitar shapes. After all, why should it? Guitar shapes are really only relevant on a guitar (or uke or banjo, etc) which has strings. MMA (and MIDI) doesn't have a strings which need to be shortened. Instead, we try to figure out an appropriate set of notes based on the number of strings in the instrument and try to get all the notes of the chord to sound. If the chord has 3 notes and the instrument has 6 strings, notes will be duplicated (I don't recall if octaves are considered?).

 - when the "capo" is applied all the strings are shortened (or lengthened). What this does is raise (or lower) overall pitch or sound of the fake guitar.

It's not designed to duplicate fingering on a real guitar.

There is a debug "Plectrum" option which will display the notes determined for each chord.

The really big difference between setting a CHORD track to use a guitar versus a PLECTRUM track is that plectrum notes do not have a duration. They continue to sound until they are muted or re-picked. Again, this is sort-of how a real plucked string instrument works.

Does this help and make sense (esp. coming from a sax player)?


Title: Re: Capo
Post by: sciurius on February 11, 2019, 02:02:42 PM
Thanks for the additional information.

I made the following additions to Plectrum for the benefit of guitar players:

   Plectrum StringCapo N

Sets a capo at the specificied location. This behaves like a guitar-like capo: it is groove independent and does not change chord shapes. So an A-chord with a StringCapo on 2 will have its familiar A-chord shape (0 0 2 2 2 0) and sound like a B-chord.

   Plectrum StringTuning notes...

Just like Plectrum Tuning, but groove independent.

   Plectrum Chord name frets...

Defines the shape (fret positions) for this chord. It ignores any tuning settings.

StringTuning can not be combined with Tuning, and StringCapo can not be combined with Capo.

I've also considered to extend the current Capo and Tuning commands by adding an additional Sticky parameter (Plectrum Capo 2 Sticky) instead of making new commands. I'm not sure which approach is most elegant.

An example:

   Plectrum StringCapo 2
    Plectrum Chord D  - - 0 2 3 2
    1      C
    2      D


will yield:

PLECTRUM C chord [0, 4, 7]
PLECTRUM    66 | - $ - - - - - - - - - - - - - - - - - 1   66
PLECTRUM    61 | - $ * - - - - - - - - - - - - - - - - 0   62
PLECTRUM    57 | - $ - - - - - - - - - - - - - - - - - 2   57
PLECTRUM    52 | - $ - * - - - - - - - - - - - - - - - 1   54
PLECTRUM    47 | - $ - - * - - - - - - - - - - - - - - 0   50
PLECTRUM    42 | - $ - - - - - - - - - - - - - - - - - 1   42

PLECTRUM D chord [2, 6, 9]
PLECTRUM    66 | - $ - * - - - - - - - - - - - - - - - 5   68
PLECTRUM    61 | - $ - - * - - - - - - - - - - - - - - 4   64
PLECTRUM    57 | - $ - * - - - - - - - - - - - - - - - 3   59
PLECTRUM    52 | - $ - - - - - - - - - - - - - - - - - 2   52
PLECTRUM    47 | - X - - - - - - - - - - - - - - - - - 1
PLECTRUM    42 | - X - - - - - - - - - - - - - - - - - 0


I'm convinced this will draw millions of guitar players to MMA, don't you think so  ;D ?


Title: Re: Capo
Post by: bvdp on February 11, 2019, 04:26:15 PM
Not sure if we want more guitar players :)

Seriously, why are the shapes being used important?


Title: Re: Capo
Post by: sciurius on February 11, 2019, 07:57:31 PM
When you fingerpick a chord, the shape of the chord determines the notes that will sound. That is especially important with slow strums.

For example, the B♭ chord played on a guitar strums b♭- f b♭ d+ f+. The plectrum algorithm generates b♭- d b♭ d+ f+. It sounds differently and has a different 'feel'.

With a 5-string picking pattern starting at the root note, a D-chord in x x d a d+ f#+ shape (the default) is one note too short. So the shape d f# a d+ f#+ is needed.

For string pickers it matters.


Title: Re: Capo
Post by: bvdp on February 11, 2019, 10:46:07 PM
Thanks. Makes sense. Not sure that I would hear the difference ... tuned to sax problems :)

I guess the downside of all this (and probably why the guy that wrote the code, didn't) is that it means you'll need explicit figures for each chord? Or are you doing it algorithmically?


Title: Re: Capo
Post by: sciurius on February 12, 2019, 07:28:08 AM
No, everything still works as always. Only if a particular chord has been defined a shape this shape will be used instead of the algorithmically calculated shape. For example, in a song I'm currently working on I need shape definitions for two chords. All other chords are okay as calculated.

The persistency of the capo and tuning depends on using new commands (or an additional command option). What is your opinion on this? For the tuning, a sticky option makes sense because it is just that, very similar to the sticky option for tracks.

    Plectrum Tuning d- a- d g a d+ Sticky

For the guitar capo it is not just the sticky behaviour, but is works differently so for this a distinct command would make sense.

    Plectrum StringCapo 3

If you agree on this I'll tidy up my implementation and send you a patch.


Title: Re: Capo
Post by: bvdp on February 12, 2019, 04:27:35 PM
No, everything still works as always. Only if a particular chord has been defined a shape this shape will be used instead of the algorithmically calculated shape. For example, in a song I'm currently working on I need shape definitions for two chords. All other chords are okay as calculated.

That sounds good. Forcing a user to maintain endless tables of guitar figures is painful.

Quote
The persistency of the capo and tuning depends on using new commands (or an additional command option). What is your opinion on this? For the tuning, a sticky option makes sense because it is just that, very similar to the sticky option for tracks.

    Plectrum Tuning d- a- d g a d+ Sticky

I'm not completely following this. Does it mean that if we use the STICKY option the tuning will stay the same no matter what CAPO setting we use? Not sure how that would work.

Quote
For the guitar capo it is not just the sticky behaviour, but is works differently so for this a distinct command would make sense.

    Plectrum StringCapo 3

If you agree on this I'll tidy up my implementation and send you a patch.

I'm not following how this is working between chords with and without defined shapes. If you set a shape for "C" and not for "Cm" and then set a Capo value is the effective "pitch" going to sound goofy? (I'm talking about how CAPO raises the apparent pitch range of the chord. I'm sure there is a name for it, but I can't think of it just now.)

Thanks for taking on this coding!


Title: Re: Capo
Post by: sciurius on February 12, 2019, 08:11:49 PM
Revised Feb 13, 13:30 CET

W.r.t. the tuning: Currently, tuning is saved/restored with grooves. While this may lead to interesting effects, it is counter-intuitive for guitar (and similar string) players. So I added the possibility for a tuning to persist, regardless of groove changes. Technically, the tuning is stored in the Plectrum structure but not saved/restored so it always stays the same. Think of the physical tuning of a guitar or banjo. The strings are tuned and stay that way.

For this we could introduce a new command, e.g.:

   Plectrum StringTuning d- a- d g a d+

or use the existing Tuning command and have it understand a Sticky option:

   Plectrum Tuning d- a- d g a d+ Sticky

(or both... Why not?)

Wrt. the Capo: A capo on a guitar shortens the strings and makes the tuning higher (okay, MMA can deal with negative capo values but that's not the point). Effectively, it is transposing the song. To get guitar like behaviour one can use Transpose instead of Plectrum Capo. (Note that I dropped the Plectrum StringCapo proposal, it has no added benefits over Transpose.)

As for your last question, when you define a shape for the C chord and not for the Cm chord, then for the C chord the defined shape will always be used, while for the Cm chord a calculated shape will be used. The chords will sound as C and Cm respectively.

If you set Plectrum Capo 2, the D chord will still use the D-shape (and sound like an E chord), while the second chord still sounds like a Dm chord but uses an alternate shape to fit the capo. So you have to think twice before mixing chord shape definitions with capo settings.

I hope this clarifies the issues.


Title: Re: Capo
Post by: bvdp on February 13, 2019, 05:09:00 PM
Just to clarify this whole issue of grooves and what gets restored and why.

A groove is a collection of various settings at a point in running a MMA program. These settings are saved into a buffer when a DEFGROOVE command is issued. When a GROOVE command is issued those settings are restored into the current MMA state.

The decisions as to what is and is not saved/restored is based on the logic that a groove represents a certain type of musical accompaniment. So, things like the instruments being used, the time signature (well, MMA time), the pitch (octave) and the sequences  are all part of the groove. And, when using a plectrum track, the tuning and capo values also set the "mood" so they are saved/restored as well.

If we did not save/restore things like capo we'd get the situation when a user (quite properly) uses a capo setting to make the string instrument sound higher or lower in pitch and then do a Defgroove and assume that the capo (or tuning) setting is saved as part of the groove. I think this is a reasonable expectation.

Now, user number two comes along and says: yes, but I don't what this behavior. Opps ... what now?

Actually, the solution is pretty simple: define a new groove with the settings you want. It's quite simple,

In  a song file:

    Groove A
       set some things which the lib has "wrong"
    DefGroove A

Now, for the rest of the song you can call Groove A and have your settings.

Want to toggle between grooves A and B? Just do the same thing for B.

And, an easier solution may be to use the allgrooves option. Simply load all the grooves into memory:

   Groove A
   Groove B
   Groove C
   AllGrooves Plectrum Capo 2

Having a Sticky option for capo and tuning may or may not be a good thing :)

But, remember: MMA is not a guitar. No matter what we do to make life simple, guitar players are going to be confused if they think along the line that MMA is a guitar emulation. It's not. It's not intended to be one.

A MMA capo does NOT transpose. A guitar capo does. I think I said in an earlier post that using the term "capo" is, perhaps, unfortunate. But, when you capo in MMA a C chord remains a C chord. All the notes are notes from a C chord and the sound is definitely "C"-ish. When you capo a guitar and use the same fingering a C chord becomes a C# or D or Eb or ... As long as the lib writing thinks in guitar terms with capo there will be a problem :)

The code for the plectrum track has its own save/restore routines for grooves so it is an easy matter to tie into them. If having a sticky option is a good thing, I don't see a problem. Hopefully this will not effect MMA code which already has a capo or tuning command in an existing lib? You might consider just having a special value for CAPO which is checked when doing a restore? I've not really thought this through or looked much at the bit of code.

Hope I'm making sense. I just got in from clearing off the driveway. We've had about 60cm of snow in the last 24 hours ... this is Canada and we love it!




 


Title: Re: Capo
Post by: bvdp on February 13, 2019, 08:16:45 PM
Just in case it's misssed ... having the ability to define figures for chords is a really good idea.


Title: Re: Capo
Post by: sciurius on February 13, 2019, 09:25:18 PM
Note that I already dropped the "sticky capo" aka "stringcapo" idea in reply #10.
Guitar players will need to learn to use Transpose instead of Capo. No problem. They'll find out very quickly that MMA's Capo does not transpose.

Your suggestion to use AllGrooves is quite useful. As far as I can see my proposal for a sticky tuning corresponds to AllGrooves Plectrum Tuning .... So I can drop this, too, even though it feels a bit unnatural for me to define the tuning after the grooves instead of before...

What remains is the proposal for chord shape definition. This is independent of everything else. It is a new Plectrum command, and only when a chord is used in Plectrum context that has a defined shape, this shape prevails over the shape that would otherwise have been calculated. Nothing else is affected.

Appended is the patch, and a demo program. I hope you like it.


Title: Re: Capo
Post by: bvdp on February 13, 2019, 10:03:37 PM
No patch attached ... just the mma file :)

I'm still confused (remember, lots of back pressure in my brain from playing sax) ... are you still proposing that when a capo is set that a C chord will no longer sound C?


Title: Re: Capo
Post by: sciurius on February 14, 2019, 08:31:38 AM
Hmm, I'm quite sure I attached the patch as well... Retry.

The impact of the Plectrum Shape patch is that if (and only if) you define a chord shape for a particular chord, that shape will be used for the chord. It overrules the shape that would otherwise be calculated by MMA. So the shape should fit the current tuning and capo -- which is exactly the purpose of defining a shape.

Sigh.... Posting fails since the patch file has extension .patch, which is refused. Changing the file name to plectrumshape.patch.txt and retrying... fails since it claims the article was already posted.


Title: Re: Capo
Post by: bvdp on February 14, 2019, 05:03:44 PM
This time the attachment worked fine. I will test it out later and let you know.

I want to add a bit about "Allgrooves" as well. I think my earlier posting might have been a bit misleading.

AllGrooves applies to ALL the grooves which have been loaded. Assuming you have grooves "A", "A1", "A2" in a file called a.mma and that file is registered in the lib manager, calling up any 1 of the grooves will load all of them since the file has to be read. So,

    Groove A
    AllGrooves something

will apply "something" to A, A1 and A2.

If this looks a bit odd, there's another way.

    INCLUDE a
    AllGrooves ....

Should do the same thing.

And, then there is "USE" as well :)

Any method should make it a bit less "bad feeling" about applying AllGrooves after envoking Groove.


Title: Re: Capo
Post by: bvdp on February 15, 2019, 04:48:09 PM
Patch applied. No problems.

And, yes there is a difference :) Subtle, but I certain can hear the difference!

So, now that this is in ... I guess I need to write a doc for it?

I am still troubled that setting a CAPO changes the actual chord being played. Yes, this will be covered in the docs ... WARNING: If you have defined a chord shape CAPO will change the actual chord generated for chords with shapes. Chords without a shape defined will NOT change. Etc, etc. I'm not sure how this can be nicely worked around ... on a "real" guitar ALL the chords will be transposed. One solution is to disable CAPO when ANY chord shape is defined and force the use of transpose ... but, that might be too big a hammer??



Title: Re: Capo
Post by: sciurius on February 15, 2019, 06:30:04 PM
I guess I need to write a doc for it?

Shall I make a start that you can integrate in the docs?

Quote
I am still troubled that setting a CAPO changes the actual chord being played.

Wouldn't it be better then to ignore CAPO settings for defined shapes? A CAPO setting serves no other purpose than to change the sound without changing the chord pitch. Defining a shape is another way to control the sound of the chord. Since the CAPO doesn't transpose it can be ignored with defined shapes.


Title: Re: Capo
Post by: bvdp on February 15, 2019, 06:45:31 PM
I guess I need to write a doc for it?

Shall I make a start that you can integrate in the docs?

Yes, that would be wonderful! Just send it to me via email. Plain text is best.

Quote
I am still troubled that setting a CAPO changes the actual chord being played.

Wouldn't it be better then to ignore CAPO settings for defined shapes? A CAPO setting serves no other purpose than to change the sound without changing the chord pitch. Defining a shape is another way to control the sound of the chord. Since the CAPO doesn't transpose it can be ignored with defined shapes.
[/quote]

Yes, I think so. Would you ignore, error or warn? At least with a default warn we could set a "ignore warn" flag. I am just trying to avoid the situation where someone defines a few shapes (maybe in a lib file), applies a capo and finds that some chords "sound funny".

Great work. Thanks.


Title: Re: Capo
Post by: sciurius on February 15, 2019, 07:54:38 PM
I think the risks are low. It is straightforward to explain. Plectrum calculates 'shapes' (think: fingers on frets) for chords using the chord notes, tuning, capo and barre settings. If, however, a shape is defined, the calculation is bypassed and only the tuning and the shape determines the notes that will sound.
I see no need for a warning since it may be useful to use capo/barre for some chords while using shapes for others.


Title: Re: Capo
Post by: bvdp on February 15, 2019, 08:21:01 PM
Okay. Let's make sure it's in the docs ... that way if there is an error we just say "but it's in the fine manual".

Sadly, I know guitar players who get confused by real capos on real guitars :)