Kara-Moon Forum
February 28, 2021, 03:46:32 PM *
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] 2 3
  Print  
Author Topic: Cresc / Decresc / Swell  (Read 3893 times)
sciurius
Sr. Member
****
Posts: 404



« on: November 26, 2019, 11:30:08 AM »

I want a few bars to swell a bit.

According to the docs, Swell takes one or two volumes, and a number of bars. So

Swell 60 100 6

sets the volume to 60, increases to 100 over 3 bars, and decreases to 60 over the next 3 bars. Good.

Cresc 20 100 4

sets the volume to 20, increases to 100 over 4 bars, and stays at 100. Good.

But for

Decresc -10 -40 4

the docs suddenly starts talking about percentages. The above statement is documented to lower the volume with 10% and then lower with another 40% over the next 4 bars. (Numerically: if the volume were 100 it is set to 90, and then lowered to 81,72,63,54).

Apparently, +10 also indicates 10 percent volume increase. Good. Confusing but good.

In the table, volume symbols like p, f, m are related to percentual changes. This should be volume values. fff goes to 180, not 180% of the current value.

I think a future version could improve this by supporting %-values. E.g.

Decresc 80 -40 4

sets volume to 100 and decreases to 40 (80 - 40) over 4 bars, while

Decresc 80 40% 4

would decrease to 48 ( 80 - 40% ).
Logged
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #1 on: November 26, 2019, 04:44:59 PM »

The reason for the confusion ... is that I'm easily confused Smiley I think the real reason lays with order in which the function was conceived/written with the first incarnation being "change from 'ff' to 'pp', etc".

In the 2nd phase, we've added numeric values to replace the "pp" etc. They are a "bit" more accurate, but on reflection, I think they are a tad useless. And, note, that the docs say that this is not recommended!

Thirdly, you can do the % changes. And, to me, this does make sense.

The SWELL section should be read as part of of the Cres/Decres section. Perhaps a pointer needed?

I agree that the plain numerics are confusing. Perhaps they should be flagged with warnings? Or even just deleted?

As to the volume table, if memory serves me, the values there are just percentages. 'M' is set to 1.00 (100%), etc. And, you are right that 'fff' is 180%. You'll have to trace though the nest of code to see what all the convolutions do with the value, but as far as I know/remember it works Smiley

I think, not committed to, the idea that the options should be symbolic (ff, pp, etc), OR percentage with a - or +. And, just numeric would be illegal.

Thoughts?

Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #2 on: November 26, 2019, 05:43:38 PM »

I should add that all this volume stuff is applied to the original volume (actually velocity) defined in the pattern definition for the given track item. Technically, the volumes should be in the range 0 to 127 (the MIDI range), but we permit large values just to force things for guitar bands Smiley  So, volume adjustments are %s applied to that initial range.
Logged

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



« Reply #3 on: November 28, 2019, 09:14:22 AM »

In general, a numeric volume is taken to be absolute. Volume 60 sets the volume to 60.
A number preceded with a sign is taken to be a percentage. Volume +20 increases the volume with 20%. Likewise Cres, Decresc and Swell.

It would be nice if a trailing precentage sign were allowed. This would be a mere cosmetic change in the cases of +/- values but adds the possibillity to write Volume 80% instead of the much less intuitive Volume -20. Read on.

The volume mnemonics are just another way to write numbers, so they are interpreted as absolute values. Volume mp sets the volume to 70. So the comments in the table are misleading, since they suggest that the mnemonics are percentage values.

Routine calcVolume in MMA/volume.py contains a few errors (due to incremental implementations) so I took the liberty to rewrite it Wink .
The attached version correctly handles +/- prefixes (also with symbolic volumes) and %-postfix.

Note that Volume mp will still set the volume to 70, not adjust to 70%. Changing this would break quite some mma programs I'm afraid. Volume mp% will adjust to 70%. Volume +mp (and Volume +mp%) will increase by 70%.

I didn't check the behaviour of Accent and VolumeRatio.

BTW, Volume range is 0 to 255, corresponding to MIDI velocity values 0 to 127. Volume values greater than 256 are allowed but silently truncated to MIDI value 127. I think it would be nice to have a one-time warning that excessive volume values will be truncated.

BTW: While you can write Tempo *2 you cannot write Volume *2 (which would not make much sense anyway).

* volume.py.txt (0.64 KB - downloaded 63 times.)
Logged
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #4 on: November 28, 2019, 04:24:41 PM »

Give me a few days to respond to this. I'm really tied up with playing in a local presentation of White Christmas for the next while.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #5 on: December 07, 2019, 11:45:57 PM »

I had a look at the patch, and I agree that it fixes some issues. However, are we missing some things?

- The initial volume setting for the master and all tracks is 100, which is the same as the 'M' neumonic. I am hesitant to call this 100% since that may indicate that the setting should play things as loud as possible ... and that isn't so. All it means is that when we go though a pattern (say Bass 1 8 90) that the 90 (a MIDI velocity between 0 and 127) is adjusted to 100% of that velocity (and here I go using %s).

- Musically, a setting like +p (add the value of pianissimo to the current value) makes no sense. Either does a neumonic with a trailing %. Yes, you are right that 'P' is just a substitute for 70%, but the manual is quite clear that initial settings should use the neumonic if possible.

- Now, your side, I'd agree that increasing/decreasing a volume should be done in the following manner:

              -  +40  to increase the volume by 40. In this case MP could become MF. Same for -40.
              -  +40% would add 40% of the current volume (or subtract)
              -   40 would set the volume to P.

   So, correct me if I'm wrong, the big difference is the inclusion of the % sign and the effect of +/-? I think you are right here ... the way it's handled right now -40 is assumed to be a % and that is probably dumb. And, in hindsight, I wonder if ONLY mnemonics should have been allowed ... too late now.

Look forward to your thoughts on this!
 
             
Logged

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



« Reply #6 on: December 08, 2019, 09:11:03 PM »

I agree that +p and mp% etc. are meaningless. It's jusy a sideeffect from my proposed patch that makes it work Wink.

Quote
The initial volume setting for the master and all tracks is 100, which is the same as the 'M' neumonic.

So the mnemonic 'M' is the value 100, not 100%.

IOW,
Code:
Volume 70
Volume M
results in volume 100 (=M), not 70 (=100% of 70).

Quote
Yes, you are right that 'P' is just a substitute for 70%,

I though we just concluded that 'P' is a substitute for 70, not 70%...

Quote
-  +40  to increase the volume by 40. In this case MP could become MF. Same for -40.
-  +40% would add 40% of the current volume (or subtract)
-   40 would set the volume to P.
 
Right. Also:
-  40% would set the volume to 40% of the current value.
Logged
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #7 on: December 08, 2019, 11:19:37 PM »

Sorry about the format of this reply. I can't seem to use nested quotes properly from here.

- I think that it'll be easy enough to determine that a leading +/- or trailing % is not valid with a mnemonic and flag that as an error.

- 'M' is definitely 100%. Well, it means that the note velocities are to be left at 100% of the values defined in the track pattern.

- Yes, setting volume to 'M' (or whatever) sets the volume to that level. They don't stack.

- Actually 'P' is 40 Smiley But, it doesn't matter. The setting ends up being an absolute value which other parts of MMA apply to the note velocities.

- 40% _should_ either set the volume to 40% of the current value. Or should it add (or in the case of -40%) subtract) that? In the first,

     Volume F
     Volume 40% /// same as +40%

would set the volume to 60 (somewhere between P and MP if I'm reading the table correctly). Right now -/+40 adds/subtracts 40% of the current value.

Perhaps for clarity it would be best to have:

    40 - set to 40.
    +40 - add 40% of the current volume
    -40 - subtract 40% of the current volume

Are the last 2 the same then, as +/-40%?? I think so...

And, for the final "40%" ... now it get confusing Smiley Is this 40% of the current volume or the same as either + or - 40?

Finally, the docs say that "F+20" will generate a volume of 20% greater than "F". I think that we achieve this by taking the value of F and adding 20% to it. Do the docs need work for this to be more clear ... all so often, I find, the code is right and the docs are lacking ... much like other things in my life Smiley
 
Logged

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



« Reply #8 on: December 09, 2019, 10:05:45 AM »

- I think that it'll be easy enough to determine that a leading +/- or trailing % is not valid with a mnemonic and flag that as an error.

Yes. Updated patch attached.

Quote
'M' is definitely 100%. Well, it means that the note velocities are to be left at 100% of the values defined in the track pattern.

I think you've just hit the nail on the head. While volume values are absolute numeric values, internally they are scale values. That's why I, as a programmer/songwriter refer to values and you, as the implementer, refer to percentages. The preamble of the 'Volume' section of the documentation describes this clearly.

From the aspect of the user, the Volume command (and its associates, cresc/decresc/swell) deals with values. As you wrote:
Quote
Actually 'P' is 40 Smiley But, it doesn't matter. The setting ends up being an absolute value ...

Quote
     Volume 40% /// same as +40%

While mathematically +40 is the same as 40, this does not apply here. 40 means set the current value to 40 (v = 40). +10 means: add 10 to the current value (v = v + 40). 40% means: set the current value to 40% of the current value ( v = 40/100 * v), and +10% means: increase the current value by 10% (v = (100+10)/100 * v).

Quote
Right now -/+40 adds/subtracts 40% of the current value.

Which is unfortunate, but this cannot be changed without breaking existing songs.

Quote
Perhaps for clarity it would be best to have:

    40 - set to 40.
    +40 - add 40% of the current volume
    -40 - subtract 40% of the current volume

Are the last 2 the same then, as +/-40%?? I think so...

Yes. And IMHO it would be much better to always use the +/-40% notation since it is unambiguous.

Quote
And, for the final "40%" ... now it get confusing Smiley Is this 40% of the current volume or the same as either + or - 40?

Just 40% of the volume. There is no increment/decement (+/-) specified.

Quote
Finally, the docs say that "F+20" will generate a volume of 20% greater than "F".

No problem, since this is no longer valid after applying my patch Smiley.

Seriously, I think that mixing mnemonics and numbers is confusing.

And if it were made to work it would be legacy '+20 means +20%'. Do you think it should work?
It is never used in any of the standard libraries.

* volume.patch.txt (1.45 KB - downloaded 57 times.)
Logged
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #9 on: December 09, 2019, 05:40:50 PM »

I think this is very close. Just had a quick look and nothing is standing out as a problem ...

Just by way of further clarification, here is how I look at all this:

 1. The velocities in the pattern are like the absolute volumes generated by a real instrument. So, a "real" instrument will have a limited upper/lower volume ... an acoustic guitar can only play so loud, etc. In a groove these velocities are used to set relative volumes between various tracks.

2. In addition to (1), we use TRACK Volume (NOT velocity!) settings in tracks to fine tune the relationship of the volumes between instruments. And, this is handy so we can use the same pattern in different contexts without having to redefine them.   

3. Finally, we use the Volume setting (along with Cres/decres, etc) to adjust how far we have adjusted the big knob on the front of the amp Smiley

4. Somewhere between 1, 2 and 3 we also apply things like Accent and Rvolume Smiley (humanize).

Damn, but there are a lot of concepts here Smiley And then there is the whole MIDI track/master volume thing! Plus, the output of the MIDI controller and the setting of the big knob on the front of the amp!
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #10 on: December 22, 2019, 11:59:38 PM »

Okay, this IS NOT well tested ... but I think it will work Smiley Attached is a drop in replacement for the calcVolume() in volume.py

It should permit the following:

   value          == set volume
   +/-value     ==  inc/dec existing volume
   +/-value%  == inc/dec existing volume my percentage
   
The value can be a number or a valid mnemonic (100 or m, etc).

To further complicate, any value and be set as value +/- value[%] (M+100, M-10%, etc)

Some existing libraries and songs may be broken by this patch, but I'm hoping that is minor. And the result should be worthwhile!

Please, give this a test run on your files and let me know.

Best of the season to all of you!

* calcVolume.txt (1.44 KB - downloaded 54 times.)
Logged

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



« Reply #11 on: December 23, 2019, 08:04:59 AM »

Quote
Okay, this IS NOT well tested

Indeed Smiley

    Volume 70
    Volume +20%


sets the volume to 77 (rounded from 77.2) instead of 94.

    Volume 60+20%

sets the volume to 0 (rounded from 0.008)

I also think that, as you pointed out earlier, volumes like +p and +p% do not make sense and should not be allowed.

I did like my version better Wink.

WARNING: Stupid feature ahead...

To a musician, volume +p and volume +f would make sense. For example volume +p would mean to step one down the scale, e.g. p would become pp, ff would become f, and so on. This would be easy to implement if the steps were spreaded equally over the 0..200 range. Then +p would just mean: one step down (not up!).
« Last Edit: December 23, 2019, 09:17:59 PM by sciurius » Logged
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #12 on: December 23, 2019, 04:27:22 PM »

I think I was tired yesterday Smiley Good thing that today is here to rework (and TEST!) this bit of code. Will post more later.
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #13 on: December 23, 2019, 11:28:33 PM »


Okay ... not well tested at all.

And, yes, we always tend to like our out code better Smiley Speaking of our own code ... I'm slowly (very slowly) adjusting to the concept that writing more clear code is way more important than writing fast and/or small code! I remember when I started this terrible hobby I was writing applications in 6809 assembler. Spent hours optimizing a small routine to save 1 or 2 bytes of code. And, probably because I was young(ish) and dumb I thought it was fun. Hard to put those lessons aside.

Here is the next version. I think the +/- and % stuff is now right Smiley I actually tested it and
 
    Volume 70
    Volume +20%

now sets 84. this is 70 + 20% of 70. Not the 94 you have in your message ... I'm assuming you didn't test Smiley

Instead of not permitting things like +pp etc I am printing warnings. Does that make sense? Could easily change them to errors.

One thing I've not done is to error/warn the syntax of 20+33 ... which is probably just so dumb I can't be bothered Smiley

Please feel free to hack on this. I'm gone for about a week and won't be doing any coding!!!

* calcVolume.txt (2.08 KB - downloaded 51 times.)
Logged

My online life: http://www.mellowood.ca
bvdp
Kara-Moon Master
****
Posts: 1333


WWW
« Reply #14 on: December 24, 2019, 02:06:03 AM »

And this is still WRONG. Sorry ... but it will need to wait Smiley
Logged

My online life: http://www.mellowood.ca
Pages: [1] 2 3
  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.061 seconds with 20 queries.