# sketchbook - page 4 (SHA-256)
In this sketchbook page, I've explored using [SHA-2](https://en.wikipedia.org/wiki/SHA-2), a cryptographic hash function, as the impetus for algorithmic music composition. Popularly used for Bitcoin mining or software security verification, I've used SHA-256, the SHA-2 256-bit hash, to compute hexadecimal values mapping to MIDI and binary values to sequence drum patterns. Page 4 of my sketchbook is realized and produced through Ableton Live 11.
Input String: `page4`
SHA-256 Hash: `3220ea21bbc9b92b4563d55de5e7baa9565eca45a2697390746058952eae3914`
Binary: `0011001000100000111010100010000110111011110010011011100100101011010001010110001111010101010111011110010111100111101110101010100101010110010111101100101001000101101000100110100101110011100100000111010001100000010110001001010100101110101011100011100100010100`
Listen here:
<iframe width="100%" height="166" scrolling="no" frameborder="no" allow="autoplay" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1030581997&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"></iframe><div style="font-size: 10px; color: #cccccc;line-break: anywhere;word-break: normal;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; font-family: Interstate,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Garuda,Verdana,Tahoma,sans-serif;font-weight: 100;"><a href="https://soundcloud.com/fenglyfe" title="terry feng" target="_blank" style="color: #cccccc; text-decoration: none;">terry feng</a> ยท <a href="https://soundcloud.com/fenglyfe/page-4" title="page 4" target="_blank" style="color: #cccccc; text-decoration: none;">page 4</a></div>
## Composition Notes
### Rhythmic Structure
- 256 bits, 64 bits per measure, 4 drums per measure with 16 step sequences
- 4/4 time
- m.1: `Bits[0:15] Bits[16:31] Bits[32:47] Bits[48:63]`
- 4 line stanzas -> 4 Sequences {snare, hi-hat, kick, ride}
- 1 - hit
- 0 - rest
- Generates a 4 bar loop to be diminuted and augmented, panned, gain control
### Melodic Stucture
- 64 Hex Values:
- Quarter notes = 4 per measure = 16 measures
- 8th notes = 8 per measure = 8 measures
- 16th notes = 16 per measure = 4 measures
- 32nd notes = 32 per measure = 2 measures
- Layered and Augmented and Diminuted for texture
Note Encodings: Start from C4
- Hex values `{0, 1, 2, ..., f}` -> Notes `{C4, C#4, D4, ..., D#5}`
```
0 1 2 3 4 5 6 7 8 9 a b c d e f
C4 C#4 D4 D#4 E4 F4 F#4 G4 G#4 A4 A#4 B4 C5 C#5 D5 D#5
```
## Score
### Melodic Line (Hex)
*Only with sharps for simplicity*
```
3 2 2 0 e a 2 1 b b c 9 b 9 2 b
D#4 D4 D4 C4 D5 A#4 D4 C#4 B4 B4 C5 A4 B4 A4 D4 B4
4 5 6 3 d 5 5 d e 5 e 7 b a a 9
E4 F4 F#4 D#4 C#5 F4 F4 C#5 D5 F4 D5 G4 B4 A#4 A#4 A4
5 6 5 e c a 4 5 a 2 6 9 7 3 9 0
F4 F#4 F4 D5 D#4 A#4 E4 F4 A#4 D4 F#4 A4 G4 D#4 A4 C4
7 4 6 0 5 8 9 5 2 e a e 3 9 1 4
G4 E4 F#4 C4 F4 G#4 A4 F4 D4 D5 A#4 D5 D#4 A4 C#4 E4
```
### Rhythmic Sequence (Binary)
```
m.1
0011001000100000 (hi-hat)
1110101000100001 (stick)
1011101111001001 (snare)
1011100100101011 (kick)
m.2
0100010101100011 (hi-hat)
1101010101011101 (stick)
1110010111100111 (snare)
1011101010101001 (kick)
m.3
0101011001011110 (hi-hat)
1100101001000101 (stick)
1010001001101001 (snare)
0111001110010000 (kick)
m.4
0111010001100000 (hi-hat)
0101100010010101 (stick)
0010111010101110 (snare)
0011100100010100 (kick)
```
## Ableton Project
[Full Size Image](https://drive.google.com/file/d/17Kc7uTiJ_Scug2BaX-gDFjPyDO1y0PAx/view?usp=sharing)
![](https://i.imgur.com/mUHgWZF.png)