2022 our 25th year online!

Welcome to the Piano World Piano Forums
Over 3 million posts about pianos, digital pianos, and all types of keyboard instruments.
Over 100,000 members from around the world.
Join the World's Largest Community of Piano Lovers (it's free)
It's Fun to Play the Piano ... Please Pass It On!

SEARCH
Piano Forums & Piano World
(ad)
Who's Online Now
60 members (Carey, AlkansBookcase, brdwyguy, 20/20 Vision, Charles Cohen, 36251, benkeys, bcalvanese, booms, 6 invisible), 1,871 guests, and 262 robots.
Key: Admin, Global Mod, Mod
Previous Thread
Next Thread
Print Thread
Hop To
Page 2 of 3 1 2 3
Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
Originally Posted by Retsacnal
Even if we choose to limit the division of a measure into 32 "slices," every note played need not be a 32nd.

- correct, and my analysis and calculation doesn't make that assumption.

Quote
Think of all the rhythmic variations that could be found for one measure! For example, the first note played might be a 32nd note, followed by a quarter rest, followed by two 16th notes, followed by an 8th note, and so on. So, each time slice has a note (or a rest), and then it should be considered whether that note resulted from the previous note held over or not, and the same holds true for the subsequent time slice (hold current note or not).

The analysis I've offered copes with *every* rhythmic variant within a framework of 32nd notes based on legato phrasing. I didn't limit the counting to the trivial case of a string of 32 thirty-second notes.

Quote

The second factor is polyphony. The OP mentioned one hand, so in theory up to five notes could be played simultaneously, or up to five of these one-measure ditties played at the same time!

Knock yourself out and provide the formulation! If you really want to go for broke then treat the RH as a 5-part invention - five parts both harmonically and rhythmically independent - instead of a tutti chordal pattern.

Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
- on reflection, 5 part independent polyphony....

[1 + Sigma:N = 1 to 32 [31!/{(32-N)!*(N-1)!}] * 12^N] ^5

- but that's just for 1 bar.

Joined: Oct 2012
Posts: 9,793

Platinum Supporter until December 31, 2022
9000 Post Club Member
Offline

Platinum Supporter until December 31, 2022
9000 Post Club Member
Joined: Oct 2012
Posts: 9,793
Originally Posted by dire tonic
Knock yourself out and provide the formulation! If you really want to go for broke then treat the RH as a 5-part invention - five parts both harmonically and rhythmically independent - instead of a tutti chordal pattern.

If I want to go for broke, then I'll maintain my original observation that, based on Phillip's original question, the number is unlimited (which is a discussion that, in my opinion, can be taken seriously). On the other hand, if anyone wants to provide complex formulations based on their own constraining assumptions, then go for it! It's interesting to me, but not enough to "do the math," so to speak.

For the sake of argument--or to avoid them--how about if I just stipulate that I may not be the smartest guy in the room? wink


Search US techs by Zip Code
“If it sounds good, it IS good.” ― Duke Ellington!

Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
Originally Posted by Retsacnal
If I want to go for broke, then I'll maintain my original observation that, based on Phillip's original question, the number is unlimited.


That's reasonable, but with such an assumption the question leads nowhere.

Joined: Feb 2013
Posts: 25
E
Full Member
Offline
Full Member
E
Joined: Feb 2013
Posts: 25
If we take a 32th as the minimum note duration, there are:
244601842863053754340937981537651198832237890212083485501963127501261947397454705500426716559736743757454676068635596937635829273540930184903619841 possible 4/4 bars.

For refere this is an estimate of the number of atoms on earth:
100000000000000000000000000000000000000000000000000

I wrote a simple recursive function in Python that given the minimum note duration enumerate every possibile bar. It counts every combination of notes and pauses of every duration.

!! WARNING NERDY STUFF !!

Code

# Minum unit in quarter note subdivisions. 8 means 8th, 16 means 16th...
NOTE_MINIMUM_UNIT = 32
# Naturals + sharps
NOTE_NUMBER = 12

# This is simple but SLOW, it will run forever with the parameters above
def enumBars(previousNoteIsSilence, remainingTimeInUnit):
    # Ends the recursion
    if remainingTimeInUnit == 0:
        return 1

    tot = 0
    
    # Here we iterate over all possibile note duration.
    #
    # if NOTE_MINIMUM_UNIT is 32
    # from 1 (one 32th), 2 (one 16th), 3 (dotted 16th) ... to 32 (one quarter note)
    for noteDuration in range(1, remainingTimeInUnit + 1):
        if noteDuration <= remainingTimeInUnit:
            # We chose a note (12 possibilities)
            # then we recalculate the function recursively with the remaining time.
            tot = tot + NOTE_NUMBER * enumBars(False, remainingTimeInUnit - noteDuration)
            
            # Pause special case 
            # We can count "pause combination" only if the previus "note" is not a pause.
            if previousNoteIsSilence is False:
                tot = tot + enumBars(True, remainingTimeInUnit - noteDuration)
    
    return tot


# This is the same but it cache subproblems so it's FAST.
def enumBarsOptimized(previousNoteIsSilence, remainingTimeInUnit, state):
    # Ends the recursion
    if remainingTimeInUnit == 0:
        return 1
        
    # We use emainingTimeInUnit - 1 as the correct index in the array
    table = state[0 if previousNoteIsSilence is True else 1]
    if table[remainingTimeInUnit - 1] != False:
        return table[remainingTimeInUnit - 1]
    
    tot = 0
    
    # Here we iterate over all possibile note duration.
    #
    # if NOTE_MINIMUM_UNIT is 16
    # from 1 (one 16th), 2 (one 8th), 3 (dotted 8th) ... to 16 (one quarter note)
    for noteDuration in range(1, remainingTimeInUnit + 1):
        if noteDuration <= remainingTimeInUnit:
            # We chose a note (12 possibilities)
            # then we recalculate the function recursively with the remaining time.
            tot = tot + NOTE_NUMBER * enumBarsOptimized(False, remainingTimeInUnit - noteDuration, state)
            
            # Pause special case 
            # We can count "pause combination" only if the previus "note" is not a pause.
            if previousNoteIsSilence is False:
                tot = tot + enumBarsOptimized(True, remainingTimeInUnit - noteDuration, state)

    table[remainingTimeInUnit - 1] = tot
    return tot


# (NOTE_MINIMUM_UNIT * 4) is one 4/4 bar, (NOTE_MIN.. * 3) is one 3/4 bar ...
DURATION = NOTE_MINIMUM_UNIT * 4

print enumBarsOptimized(False, DURATION,  [[False] * DURATION for i in range (2)])


Last edited by eulerdisk; 11/19/14 05:56 PM.
Joined: Oct 2014
Posts: 348
V
Full Member
Offline
Full Member
V
Joined: Oct 2014
Posts: 348
I'm curious how many nerds of this kind are in PW?

eulerdisk, you are not alone here wink.

Joined: Oct 2013
Posts: 4,677
4000 Post Club Member
OP Offline
4000 Post Club Member
Joined: Oct 2013
Posts: 4,677
I wish I had never posed the original question.


Currently working towards "Twinkle twinkle little star"
Joined: Mar 2013
Posts: 9,328
P
9000 Post Club Member
Offline
9000 Post Club Member
P
Joined: Mar 2013
Posts: 9,328
And you guys are still forgetting to take tuplets into account.


Regards,

Polyphonist
Joined: Aug 2009
Posts: 461
J
Full Member
Offline
Full Member
J
Joined: Aug 2009
Posts: 461
Nothing material, or that can be represented materially, such as a musical measure, can be mathematically infinite. So, 'infinite' in this context should have a different meaning: if there is no limit found in making new music, the possibilities are infinite, in that sense. I know that's departing from the thread topic.


Jack
Joined: Jun 2014
Posts: 565
500 Post Club Member
Offline
500 Post Club Member
Joined: Jun 2014
Posts: 565
The answer is 42.


Linda

[Linked Image] [Linked Image] [Linked Image]
Casio Privia PX-850 (home), Yamaha Upright (lessons)
Joined: Dec 2012
Posts: 8,134
C
8000 Post Club Member
Online Content
8000 Post Club Member
C
Joined: Dec 2012
Posts: 8,134
Originally Posted by PhilipInChina
I wish I had never posed the original question.


ROFL !!!!!!

That's the funniest comment in a long time. We're usually all so serious . . . <g>

. Charles



. Charles
---------------------------
PX-350 / Roland Gaia / Pianoteq
Joined: Dec 2012
Posts: 8,134
C
8000 Post Club Member
Online Content
8000 Post Club Member
C
Joined: Dec 2012
Posts: 8,134
Originally Posted by verqueue
I'm curious how many nerds of this kind are in PW?

eulerdisk, you are not alone here wink.


After a working life programming computers, I suppose I qualify.

I suspect that a recursive function to compute the number of possibilities is equivalent to _enumerating_ the possibilities (without actually recording any of them):

. . . It will run for a long, long time!

. Charles


. Charles
---------------------------
PX-350 / Roland Gaia / Pianoteq
Joined: Feb 2013
Posts: 25
E
Full Member
Offline
Full Member
E
Joined: Feb 2013
Posts: 25
Originally Posted by Polyphonist
And you guys are still forgetting to take tuplets into account.


Good point. But that is simply equivalent to take a smaller minumum note duration such that is the minimum common divisor of all tuples.

However I'm not adding into account different phrases combination, but I could extend that to do so.

Originally Posted by Charles Cohen

I suspect that a recursive function to compute the number of possibilities is equivalent to _enumerating_ the possibilities (without actually recording any of them):

. . . It will run for a long, long time!

. Charles


That is why is the code I posted there are two version. The first one is pure recursive so it will run forever if you try to calculate for 32th in 4/4 bar.
The second one save the subproblems already calculated, so I think it has O(n^2) complexity (maybe O(nlogn) ??) from O(n!) of the original, so it's very fast. However the python interpreter have a limit on the depth of recursion, so you must to rewrite it in an iterative form if you want to calculate long sequences.

P.S: last super nerdy response, I promise smile


Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
Other than the 6502 assembler I learnt 30+ years ago I know nothing about programming so your code is completely opaque to me.

Did you take into account the empty bar (a bar's rest)?

I'm assuming that's the "....1" at the end of your result?


Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
Originally Posted by PhilipInChina
I wish I had never posed the original question.

- don't be so hard on yourself, you've given the nerderati something to live for.

Joined: Oct 2013
Posts: 4,677
4000 Post Club Member
OP Offline
4000 Post Club Member
Joined: Oct 2013
Posts: 4,677
Just opened another bottle of scotch to try and cope with this.

It's my thread so:

88 note keyboard.
1 bar in common time.
No rests.
Minimum note duration 1/8.
Forget pedals, any crescendo or other directions etc. etc.

What is the answer? Do I really want to know?

Moderator, if I stop answering messages I shall probably be found raving somewhere in a straitjacket. In that case please delete my membership.



Currently working towards "Twinkle twinkle little star"
Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
Originally Posted by PhilipInChina

88 note keyboard.
1 bar in common time.
No rests.
Minimum note duration 1/8.
Forget pedals, any crescendo or other directions etc. etc.

What is the answer? Do I really want to know?

Moderator, if I stop answering messages I shall probably be found raving somewhere in a straitjacket. In that case please delete my membership.


google's default calculator only seems to provide an answer to 8 significant figures, namely 3.8824182e+15 - quite a bit less than the total US consumer debt.

I'd be interested to see if eulerdisk's figure is any different.

Joined: Feb 2013
Posts: 25
E
Full Member
Offline
Full Member
E
Joined: Feb 2013
Posts: 25
Removing rests management from the code, with 88 notes and one 8th as minimum note, give me: 3892357470806552.
By the way, I made a terrible mistake in the previous page. I calculated the number not for one bar, but for 4 bars !!
The correct number for one bar is (32h as the minimum, every combination of 12 notes and rests etc...) 3754314046659595722768960270925020481, not 2446018428630537543409......1. Sorry.

Last edited by eulerdisk; 11/20/14 10:04 AM.
Joined: Jul 2011
Posts: 3,238
D
3000 Post Club Member
Offline
3000 Post Club Member
D
Joined: Jul 2011
Posts: 3,238
3892357470806552 vs 3.8824182e+15

There shouldn't be an error on the third significant digit.


Joined: Feb 2013
Posts: 25
E
Full Member
Offline
Full Member
E
Joined: Feb 2013
Posts: 25
Originally Posted by dire tonic

Did you take into account the empty bar (a bar's rest)?

I'm assuming that's the "....1" at the end of your result?



The code take into account every duration multiple of the minimum, for notes and rests, whole time include.
Sequence of rests are not counted, two consecutive 8th rests is considered the same as a 4th rest.

Page 2 of 3 1 2 3

Moderated by  Bart K, platuser 

Link Copied to Clipboard
What's Hot!!
Piano World Has Been Sold!
--------------------
Forums RULES, Terms of Service & HELP
(updated 06/06/2022)
---------------------
Posting Pictures on the Forums
(ad)
(ad)
New Topics - Multiple Forums
Recommended Songs for Beginners
by FreddyM - 04/16/24 03:20 PM
New DP for a 10 year old
by peelaaa - 04/16/24 02:47 PM
Estonia 1990
by Iberia - 04/16/24 11:01 AM
Very Cheap Piano?
by Tweedpipe - 04/16/24 10:13 AM
Practical Meaning of SMP
by rneedle - 04/16/24 09:57 AM
Forum Statistics
Forums43
Topics223,392
Posts3,349,293
Members111,634
Most Online15,252
Mar 21st, 2010

Our Piano Related Classified Ads
| Dealers | Tuners | Lessons | Movers | Restorations |

Advertise on Piano World
| Piano World | PianoSupplies.com | Advertise on Piano World |
| |Contact | Privacy | Legal | About Us | Site Map


Copyright © VerticalScope Inc. All Rights Reserved.
No part of this site may be reproduced without prior written permission
Powered by UBB.threads™ PHP Forum Software 7.7.5
When you purchase through links on our site, we may earn an affiliate commission, which supports our community.