To all of my readers, thank you for being patient with me. I’ve enjoyed many interesting conversations about graphs, network science, and artificial intelligence over the past several months, but I haven’t written anything since May. As I have mentioned several times, learning is a creative outlet for me, and I enjoy helping others learn as well. So, I’ve been wanting to get back to writing, but have found it difficult.
Even though I haven’t been writing, my blog continues to grow! This blog will pass 500 subscribers soon, which is exciting. My book also continues to do well! It’s been out for almost two years and is highly rated (4.9) on Amazon.
Begin Where You Are
In my own life, meditation has been useful to me in several ways. Lately, during meditation, a certain phrase has really stood out: begin where you are. I have been giving people that advice for years, but I have been struggling with it in my own life lately. I have been wanting to write, but I have a million things I want to write about, and I was trying to do too much.
I want to get back to writing. I enjoy writing. It gives me peace, and is something for me to look forward to doing. My writing is different than what I work on, so it gives me an outlet to explore other things, such as what I am writing about today.
So, today, I am taking this advice: begin where you are. Just start. The hardest part is getting started, and if you sit down for too long, it is difficult to get back up. Writing is like that as well.
Guitar Learning Tool
I have been playing guitar for 31 years now. Even after all of these years, I still struggle to memorize scales. It is so bad that I just don’t even bother trying to memorize them by name. Rather, I practice them over and over and over and try to capture their sound. But I WANT to memorize them. I want to be able to mentally flip between them. However, the way that scales are taught to guitarists is just not helpful to some of us.
For reference, here is an example of ONE scale from my favorite book. There are MANY scales, not just one. This is from my FAVORITE scale book…
I struggle with memorizing anything. I have struggled with memorization my entire life. So, I find ways to work around things that give me difficulty.
And even this image is only going to the 12th fret, because everything repeats after the 12th fret, so it should be twice as long.
But each scale starts at around A and ends at around G, so this scale above goes: A-flat, B-flat, C, D-flat, E-flat, E, G-flat
What do you think is easier to look at? The above image?
Or: Ab, Bb, C, Db, Eb, E, Gb
Which one makes it easier to notice that F has been skipped?
Yesterday’s Idea
I think tools can be made to make learning a little easier for guitarists like me, who are more auditory than visual, by simplifying the visual and providing the audio.
I was practicing this scale last night, and I noticed that if I just focused on A-G at only a single part, the whole thing becomes a lot less intimidating. However, I was still struggling with memorization.
So, I thought, what if I converted any scale into a complete graph, and used that as a learning tool? I played with that idea a bit today.
Work in Progress
This is a work in progress, something to play with on weekends, something to help me build up my arsenal of memorized scales, helping me become a more versatile musician, using data science and network science.
I didn’t know how to do some of this yesterday, so it is rough. I was hoping there was a simple library for playing notes. Nope. Haven’t found one yet. So, I had to get that working, and I’m not completely happy with it. But in building, get it to work, then get it to work well.
Show and Tell
You can get today’s code here.
From here, I’ll show how this works, and the results. This is day one. I will do more with this. These are the results after about an hour of working on it.
First, I didn’t want to choose a specific scale. I wanted to start simple, with A, B, C, D, E, F, G. No minors, no sharps. I wanted to:
Construct a complete graph using these notes
Use the complete graph to automatically generate playable music sequences
Play the music sequences
The third part will be good practice for scales. This will automatically generate sequences of notes that can be used for practice, and you’ll have to remember where notes exist on the next. The visual element has been replaced with audio, in other words.
First, I choose the notes: A, B, C, D, E, F, G
Then I create the complete graph.
Remember, in graph theory and network science, a complete graph is a graph where each node is connected to every other node in the network.
As each note in a scale is always accessible, the opportunity for using the notes of a scale fit into a complete graph. The scale presents the rules. The scale decides what is and is not included. Beyond what is included, there are no rules to the sequence notes are played in. However, interesting feels can be brought out by doing interesting things with notes, like playing in unexpected order, or by using repetition, etc, all the musical tricks.
Today is about graphs and music, fusing the two. I’m not going to go deep into either, today.
From this complete graph, I can generate a list of possible sequences, but I wanted the sequences to be of uniform length, to make practice a little more comfortable and less chaotic. The first five sequences look like this:
[['A', 'C', 'D', 'E', 'F', 'G', 'B', 'A'],
['A', 'C', 'D', 'E', 'G', 'F', 'B', 'A'],
['A', 'C', 'D', 'F', 'E', 'G', 'B', 'A'],
['A', 'C', 'D', 'F', 'G', 'E', 'B', 'A'],
['A', 'C', 'D', 'G', 'E', 'F', 'B', 'A'],
['A', 'C', 'D', 'G', 'F', 'E', 'B', 'A']]
I start and end each sequence at A. That’s just what I have done, today. Later, I can expand the sequences by starting with each individual note included in a scale.
Each sequence can be looked at visually as a “path graph”. Programmatically, I can pull out a random sequence, visualize it, and listen to it.
Extract sequence:
path = choice(note_paths)
G = nx.path_graph(path, create_using=nx.DiGraph)
print('Path: {}'.format(path))
draw_graph(G, node_size=10, show_names=True, edge_width=1, font_size=14)
Visualize graph:
Listen to it:
[play_note(note, 0.6, repeat_times=2) for note in path]
This is one sequence I actually did find interesting. It has a cool sound for grunge, but would also sound good clean. This is what it sounds like on guitar.
Chords:
A bit more complexity:
This guitar riff came directly from the graph. I listened to a few sequences, found one that I liked, picked up my guitar, and played the chords instead of notes.
Longer sequences can also be made, like so:
s1 = choice(note_paths)
s2 = choice(note_paths)
s3 = choice(note_paths)
song = s1 + s1 + s2 + s1 + s2 + s2 + s3
Look closer and you’ll see that I’ve constructed a bit of a song.
Three sequences are pulled from the graph
The first sequence is played twice
The second sequence is played once
The first sequence is played once
The second sequence is played twice
The third sequence is played once
You can then listen to the audio of the sequence using the same code as shown previously.
This is an end-to-end experiment, showing that graph can be useful in creating learning tools that are more suitable for our individual learning styles.
Also, it’s a lot of fun to listen to the random sequences.
This Is Why I Love Graphs
I have been saying that graphs provide ways of learning about the world we live in. Graphs aren’t the only way. They are a tool that can be used, and I find them very useful for learning, for building systems thinking, and for understanding the abstract.
One thing I like about graphs: I don’t look for things to use them on. It is the other way around. Usually, I’ll get frustrated with how something is done (like how we learn scales), and that’ll get me thinking (about the relationship of notes, scales, and chords, etc), and that’ll inevitably lead to me realizing that there is another unexplored approach with graph that could make things easier.
What’s Next
I’m going to continue with this kind of music + graph stuff for a while. I would really like to come up with something useful for learning scales. This blog isn’t just for teaching, it is for experimentation and learning.
That’s All for Today
Thanks for reading. I’m glad I was able to find something that would be fun to develop and write about. I’m excited to explore graphs musically. This is a cool topic.
Thanks to everyone who has been following along with this series. Happy learning! If you would like to learn more about networks and network analysis, please buy a copy of my book!
I'll share this with my daughter, who's composing music, and let you know what she says.
Music is structure and order; how awesome you found a way to unify these two passions!