Skip to content

Commit 8dcac85

Browse files
committed
added Heaps and Boxes
1 parent 7c75cdf commit 8dcac85

File tree

7 files changed

+1711
-2
lines changed

7 files changed

+1711
-2
lines changed

guide/Actions.svg

Lines changed: 501 additions & 0 deletions
Loading

guide/Heaps.svg

Lines changed: 847 additions & 0 deletions
Loading

guide/README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,35 @@ notation well enough to guess the outcome? Are you familiar with the
342342
song we created?)
343343
[RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1725791527821787&run=True)
344344

345+
### <a name="Heaps">3.1.1 Heaps</a>
346+
![actions](./Actions.svg "running the heap using an simple coin example")
345347

346-
### <a name="PITCH-TRANSFORMATION">3.2 Pitch Transformations</a>
348+
A heap in Music Blocks is just like a stack of pancakes. Imagine you are making pancakes for breakfast. You make one
349+
pancake and place it on a plate. Then you make another one and stack it right on top of the first. Then you make a third
350+
pancake and put that one on top of the second. Now you have a tall stack of three pancakes — one on top of the other.
347351

348-
There are many ways to transform pitch, rhythm, and other sonic qualities.
352+
When it’s time to eat, you don’t start from the bottom pancake. That would be really messy! Instead, you take the top
353+
pancake first, because it’s the easiest to grab. After you eat that, you take the next one underneath, and finally the
354+
last one at the bottom.
355+
356+
That’s exactly how a heap works in Music Blocks. It remembers the things you put in it, like notes or numbers, but it
357+
always gives you back the last thing you added — just like how you eat the top pancake first. For example, if you push
358+
note 60 into a heap, then 62, then 64 — and then start popping them out — you’ll get 64 first, then 62, then 60.
359+
360+
So, a heap is like your musical pancake stack: the last note you added is always the first one to play when you take it
361+
out. It's a fun and easy way to build backwards patterns or save notes for later. Just remember: heaps serve your notes
362+
like pancakes — from the top down!
363+
364+
[RUN LIVE][https://musicblocks.sugarlabs.org/index.html?id=1725791527821787&run=True]
365+
366+
### <a name="box">3.1.2 Box</a>
367+
![actions](./box.svg "demostration of how box work in mb")
368+
369+
Boxes are parts inside a block that store the block’s data or connect it to other blocks. Every block in Music Blocks does something — like playing a note, repeating an action, or setting a value. But to do its job, a block often needs extra information (like how many times to repeat, which note to play, etc.).
370+
371+
In summary, the example illustrates the use of boxes as fundamental units for storing and manipulating data, with operations like push and print acting on them. This concept mirrors real-world programming, where variables and data structures are used to organize and process information efficiently. The simplicity of the example makes it a clear introduction to how boxes function in a computational context.
372+
373+
[RUN LIVE][https://musicblocks.sugarlabs.org/index.html?id=1725791527821787&run=True]
349374

350375
#### <a name="STEP-PITCH">3.2.1 Step Pitch Block</a>
351376

guide/box.svg

Lines changed: 288 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)