Bogosort Takes the "A" Train Until it Sorts the List
Вставка
- Опубліковано 19 січ 2024
- Choo choo. Bogosort sheds over the changes to "Take The A Train" until it successfully sorts the list.
The Bogosort algorithm is as follows:
1. Randomly shuffle the list.
2. Check if the list is sorted.
3. If not, go back to 1.
For a list of n elements, there is a 1/n! chance that Bogosort successfully sorts the list on any given pass, since there are n! (n factorial) possible permutations of the list. So with six elements, the probability of the list being sorted on any given pass is 1/6! = 1/720 ≈ 0.00139.
In this instance, the algorithm took 2262 passes to sort the list (a particularly "unlucky" run of the algorithm). The probability of the algorithm taking at least 2262 attempts (i.e. not finishing on the first 2261 attempts) is only ((6! - 1) / 6!) ^ 2261 ≈ 0.0432 (4.3%).
The six elements of the list are mapped to notes of a specific scale, depending on which chord is being played in the progression. The scales used are the major pentatonic, Lydian dominant, natural minor, altered scale, and Mixolydian.
The shuffling algorithm used is the Fisher-Yates Shuffle, from lowest index to highest. The note played is the value of the element at the current index in the outer for-loop of the shuffle algorithm.
________
Interested in learning more about algorithms and how to program? Here are some useful and/or classic textbooks that I recommend (these are affiliate links, if you buy one, I get a small commission):
▶”Algorithms” (4th Edition) by Robert Sedgewick & Kevin Wayne: amzn.to/3uo25xR
▶”Effective Java” (3rd Edition) by Joshua Bloch: amzn.to/3HOnYJL
▶”Python Crash Course, 3rd Edition: A Hands-On, Project-Based Introduction to Programming” by Eric Matthes: amzn.to/481jQ43
▶“Design Patterns: Elements of Reusable Object-Oriented Software” by Erich Gamma, Richard Helm, Ralph Johnson, & John Vlissides: amzn.to/49fpr7R
#jazz #algorithm #altered #music #musictheory #solo #billystrayhorn #dukeellington #atrain #improvisation #bogosort #sortingalgorithm #sorting #visualization #computerscience #programming #code #satisfying #asmr #scrollingscore #transcription #hypnotic #studymusic #focusmusic
**Moments of Interest**
List sorted in reverse order:
12:15
17:04
17:32
One adjacent-element swap away from being sorted (Kendall tau distance of 1):
4:35
5:47
6:55
8:52
10:53
11:25
11:54
12:29
12:53
13:35
15:47
16:38
18:31
22:20
24:04
24:44
27:01
27:30
28:06
yeah sure buddy "G7"
@@carryingautoclicks7501ok "Natural Minor"
Also 19:34 is like climbing two hills
At 0:26 on Fmaj7 it did the same pattern twice in a row
i love how stupid this is while still being incredibly nice interesting and clean
There exists a universe where BOGO sort works perfectly everytime and no one can figure out why
There's also a world where BOGO always plays existing jazz pieces, and no one cares because everyone is busy vibing to the music.
Good ole quantum bogo sort :)
@@toaster_toast4973would be nice to try it
There also exists infinitely more universes where bogosort worked perfectly every time, it became it's own universal law, and societies, sciences, math, and electronics were built around bogosort working every time with hyperefficient supercomputers becoming standard since all information could be stored and sorted with no problem only for it to suddenly start working like it does in our universe, causing sudden societal collapse.
There’s also a universe where it works every single time except for when one specific guy does it
What classical musicians think improvisation is
LMFAO
🤣🤣🤣
Es que la improvisación tiene un cello característico, incluso cuando improvisas en barroco o romanticismo suele ser una colección de aprendizajes y posibilidades. El video sería la exageración de éso.
Meanwhile kapustin fans: hard coding each step in the sort so people don't realize you don't actually know how to make a sorting algorithm
(Btw this is a joke I know he was a jazz pianist before)
i was listening to this in the background and i forgot it was a bogosort, and when it finished sorting i was like "what just happened why did it stop?"
lol
as both a jazz and sorting algorithms enthusiast, I'm glad to know there's one other person on earth like me
to the other few of us in the comments: fate has brought us here this week
My poor brain. Two very, very distinct parts of my brain that had never connected before just got seriously muddled
“is there a jazz musician called Bogosort? Is there an algorithm called A train”
As a strictly history guy, I’m fascinated by how your brain must work; I can’t even put myself into that head space, but it’s so cool to me
What is a sorting thingy? It looks like flashing lights to me.
Me too! I have a degree in Music, and very nearly went to Uni for CompSci instead of Opera aha.
Ahh, yes, for when I need my bogos binted
Bogos binted?
what?
👽
THE BEST COMMENT 🎉
but what if you need your photos printed?
This is the stupidst thing I have ever seen but also the most hilariously specific to my interests any recommended video has been.
This is exactly how I feel. They've captured my jazz interest and DSA somehow and merged them into greatness.
This the type of music that plays in a Phoenix Wright game when you're tasked with looking at the evidence in close detail and the judge is asking you to point out the big circle on it that says "MURDERER" on it in big red letters
LOL
This is the funniest thing I've read this week
why does this sound so much better than when I sort notes randomly
the algo has perfect rhythm and tonal attack, you probably don't
Probably because they chose appropriate scales for the chords according to Jazz musical theory :)
all the notes are in the scale
The order of the notes is random, but the notes are always picked from scales that match the chord being played
And on top of what everyone else said, you're not actually very random
Imagine something like this implemented in a game where it keeps generating a list (you could make it determine like the next 10 list sequences so it doesn't chug), and using it as BGM for a very unusual or unsettling place. Then when it finally sorts, it starts repeating itself sorted, and something happens or changes on the environment lol
I like how you think
May introduce you to aleatoric music
Could always just _not_ stop, it doesnt actually have to be bogosort, it can just be choosing a chord, choosing six notes from that cord, and playing them in a random order
Bogosort is my favorite Jazz composer ngl.
This could be a solo that jazz majors study and youtubers write hour long video essays on
I'd love to see that 🙏
It actually has interest. I hear two independent melodies. One consisting of the lowest notes and other with the highest notes. And giving the algorítmic nature of this sorting of notes they start making leasing rhytms. I personal y like the low melody a lot.
It actually has interest. I hear two independent melodies. One consisting of the lowest notes and other with the highest notes. And giving the algorítmic nature of this sorting of notes they start making leasing rhytms. I personal y like the low melody a lot.
It actually has interest. I hear two independent melodies. One consisting of the lowest notes and other with the highest notes. And giving the algorítmic nature of this sorting of notes they start making leasing rhytms. I personal y like the low melody a lot.
It actually has interest. I hear two independent melodies. One consisting of the lowest notes and other with the highest notes. And giving the algorítmic nature of this sorting of notes they start making leasing rhytms. I personal y like the low melody a lot.
Great idea playing a tonic note in the bass every time the key changes. It makes it play as not noise, but music.
Lowkey a jam. Would easily work as BGM in essay videos
They should try to get it in a stock audio library or something.
Anyone can use it, maybe not this video exactly, but there are (4^n)! possible melodies (where n is the length of the long in stanzas)
I keep expecting Louis Cole drums to kick in
Best comment here
Clowndaddy needs to bless us
I have an overwhelming urge to jam with this on drums!
Having degrees in Music and CS, to say that this made my day would be a staggering understatement LOL - this is stunning
Hearing a bunch of random notes and then suddenly D7#11, and then just silence felt like a jolt to real life, like I had done something nonsensical and the music reacted to that action :P
Strong contender for jazz performance of the year
As a music major with a minor in math, this is definitely the content of all time
I finally found my place in the internet
this actually works so well as bgm
until just randomly ends 30 minutes in LOL
this'd be a really funny way to have a robot jazz musician in a video game
No one's gonna talk about how bogosort sorted the exact same permutation twice in a row at 0:26?
Mathrock fans be like: This is fire
i am honestly surprised on how consistent this was throughout the entire way through
I think that's probably because of the limited choice of notes. Would be interesting to see a probability distribution of all possible combinations
@@chain3519 Every combination has the exact same chance of occurring.
This is the kind of thing I really want to share... but for the life of me I can't think with who
When you realize that melodies are basically just random notes in the chord
The secrets of the universe have been revealed
mubsic theory. ,
@@deadratjr Lol
Not really, there are passing notes and other types of "decoration" you can add to melodies. But yeah, usually you have chord notes on the strong beat at least :)
Unless it's an accented passing tone *shrugs*
This is so calming. Knowing the notes are ordered randomly makes me stop anticipating specific notes, and only notice nice sequences as they come. Over and over again.
This is unironically fun to listen to
I could sit here and listen to this for hours.
This is so cool I noticed that my ears were almost duel listening to the song in every other note throughout the video a little after the beginning until the end. I believe I was mainly caught on the 1,3,5 (the 1st, 3rd, and 5th note) rhythm but at the same time I was also managing to hear the 2,4,6 rhythm as well. So interesting!
I do heard some fake accents throughout the song as well. Very funky that the brain do this.
I do heard some fake accents throughout the song as well. Very funky that the brain do this.
I do heard some fake accents throughout the song as well. Very funky that the brain do this.
Not everyone can claim to invent a new genre of Jazz, but it seems you have.
Top 10 best jazz improvisations
my favorite bogo sort sheds video
probably because it doesn't have many confusing jazzy scales/chords
What an amazing melody, it’s strange because it’s just random.
Awesome. I would be interested to hear one with phrasing. Gets a bit intense to have a constant stream of notes blasting at you for hours on end
why do we find this musically pleasing?
All the notes are within scales that compliment their respective chords and the tempo is consistent
The timespan of the chords are different lengths which adds some rhythm to it
Yeah, the order of the notes isn't very important when they're basically just playing chords that are expanded out over a measure
So bogosort is just being used to add a bit of spice to otherwise normally-arpeggiated chords
(I think that's the right term)
This sounds like something from the portal 2 soundtrack to me somehow.
Somehow really relaxing. Perhaps something to do with biophilic randomness. I literally just put this on to relax and have dinner tonight
Thats so absolutely niche and i love it
I've been listening to this for 2 hours now. After a while you start going mad and one specific note starts to come out more noticeably than the others, until its all you can hear in a background of random beeps.
This is my alarm clock sound now
Sorting algorithm
My best type of jazz music
sounds stupidly great
2:59 this ii V was killer 🔥🔥
Hoping this takes the Algorithm train (the yt type not the sorting type)
I really like this as randomly generated background music.
Is there any way this is a more efficient way of having seemingly infinite random background music in a game?
Like the least efficient way would be to have an insanely long music track in the game files that would start at a random point in the track whenever it was used.
The file would take so much space.
Idk anything about this but it seems like that would take a lot more processing power than playing an audio file does
this is how they made the music for the portal games
would you care to explain more in detail? it's interesting, but I can't get why "take on the A train" if the job is to sort notes in order from low to hig, and why it changes through chords, and which notes are used
the chords are from the song "take the a train" by duke ellington
Sure, as someone else said the underlying chord changes are from the tune "Take the A Train". The bogosort algorithm is just trying to sort a list of 6 elements by shuffling it randomly over and over until it's sorted. The notes being played are from commonly used scales to improvise over these changes, and the scale changes as the underlying chord changes. As the sort proceeds, the items in the 6-element list are mapped to 6 specific notes in the current chord's (manually curated) scale, and that's what you see/hear. Make sense?
@@AlgoMotion thanks, now it all makes sense! brilliant!
@@AlgoMotion I needed this explanation but what you’re saying is this thing isn’t even tryna solo but it’s shitting on me … got it 😭😭EDIT: you all ruined funny number likes 🤦🏾♂️🤦🏾♂️
The UA-cam algorithm got it right this time
need breakcore version of this
With both versions you would have the entire Portal 2 soundtrack
Her: what music do you listen to?
Me: it's complicated...
I'm only a minute and a half in and I already know my ass is gonna listen to this whole entire thing
Somehow, this is exactly the content I'm looking for
finally, i know what O(n*n!) sounds like
portal 2 community test chamber music
Wait how is this perfect for my interests and why do I deeply need more
The soundtrack when your SimCity 3000 population is between 2500 and 5000 people…
this is the coolest thing Ive seen in 2024 so far
Giant Steps bogosort?!
He already did it, twice
i really like this for some reason, im keeping it in my tabs
Idk why this eases my brain so much
This is the most creative thing I've ever seen
I accidentally opened the video a second time with a 1 minute desync and it is the best thing I've ever done
That is such a smart idea. I love it.
This goes hard
-A bogo sort enthousiast
This slaps.
Wonder why it took so long. At 720 (6!) should be 63% chance of success already. The probability that it gets past 2,000 is only 6%. Lucky day for video length I guess...
That's more likely than rolling a 20 on a d20, so not that unlikely.
on average should take 499 attempts. but then it would only be a 6 minute video :/
This is beautiful
Bro this made me so relaxed
Thank you algorithm more please
I don't understand the impetus to do this or logic behind why this works, and I feel that if I was able to eventually comprehend either, all my vital functions would immediately shut down
I like how the shifting accents of the arpeggios can go from sounding like 3/4 to 6/8, i.e. 2*3 vs 3*2. Tempted to call this a hemiola but not sure if that's technically accurate; I think so.
this is art
beautiful
4 minute song, 28 minute solve. BOGOsort.
thats enough lydian scales for me for the day
pondering what the sorting algorithm could be only to find THAT answer in the commments is..
why is this so good
Can I get a 7/8 version? Thanks
You cruel, cruel man ending this on a Lydian dominant chord.
hey man, bogo finishes when it wants to.
@@AlgoMotion Well, since we're talking about bogo, taking another couple thousand iterations to get a nice resolution isn't that much of a stretch, no?
this sounds nice
if you put it in 0.75x it sounds like portal music
This is so good
this is so cool
When you’re using the Riff Machine and just can’t decide what sounds good
This would blow up if it wasnt 30 minutes long lol. Love it though
Why does G altered universally go so hard
this is actually so good though
i love how you can tell what it is because of the key but it just sounds incredibly fucked up
Brb gonna drum to this
this seems like a rare slow bogo sort... (6!-1/6!)^2262 = 4.3% chance
I like this human music.
Nailed it.
i kinda want to hear this with more instruments added
Erik Satie would have loved this :) I love it too :)
this is the longest song made in 2024
Why do I keep thinking of portal music
This is like me trying to solve a problem: try every random option till one works!
3:53 is my favorite part