Skip to content

Commit cfaaef7

Browse files
Merge branch 'master' into test-synthutils.js
2 parents cb51772 + 576f448 commit cfaaef7

File tree

213 files changed

+26559
-15852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+26559
-15852
lines changed

Debugging.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,77 +35,96 @@ you will make mistakes along the way. Music Blocks provides a number
3535
of mechanisms, reviewed below, to help you explore ideas and find
3636
mistakes.
3737

38-
## 1. Clicking on an individual stack of blocks
38+
## <a>TABLE OF CONTENTS</a>
39+
40+
1. [Clicking on an Individual Stack of Blocks](#1-clicking-on-an-individual-stack-of-blocks)
41+
2. [Print and Comment Blocks](#2-print-and-comment-blocks)
42+
3. [Status Widget](#3-status-widget)
43+
4. [Playback Modes](#4-playback-modes)
44+
5. [Show and Hide blocks](#5-show-and-hide-blocks)
45+
6. [Browser Console](#6-browser-console)
46+
47+
## <a>1. Clicking on an Individual Stack of Blocks</a>
3948

4049
The *Play* button (in top left corner) will run all of the *Start*
4150
blocks simultaneously. (Every Music Blocks project has at least one
4251
*Start* block). But you can also run an individual stack of code by
4352
clicking on a stack. This lets you test and debug small sections of
4453
code, or, as in the example below, you can play a single voice by
4554
clicking on one of the *Start* blocks or single phase by clicking on
46-
one of the *Action* blocks.
55+
one of the *Action* blocks. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732463245651983&run=True)
4756

48-
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/startblocks_debug_guide.png "Start blocks")
57+
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/startblocks_debug_guide.png "Start Blocks")
4958

50-
## 2. Print and Comment blocks
59+
## <a>2. Print and Comment Blocks</a>
60+
61+
[Back to Table of Contents](#table-of-contents)
5162

5263
The *Print* block (found on the *Extras* palette) can be used to print
5364
a message while running a program. It is useful to determine if a
5465
section of code is being executed when expected or if a box or
5566
parameter contains an expected value.
5667

57-
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/print_example2_debug_guide.png "Print blocks")
68+
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/print_example2_debug_guide.png "Print Block")
5869

5970
The *Print* block is used to display the number of whole notes played,
6071
in this case, `1/4 + 1/4 + 1/2`, which adds up to `1`, which is
61-
displayed at the top of the browser window.
72+
displayed at the top of the browser window. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732474452574359&run=True)
6273

6374
The *Comment* block (also found on the *Extras* palette) is similar to
6475
the *Print* block, except it only prints a message when the program is
6576
being run in *Playback Slow* mode (See below). Comments are also
66-
written to the browser console.
77+
written to the browser console. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732825564345176&run=True)
78+
79+
![Comment Block](./images/Comment_block_DebuggingMd.svg "Comment Block")
6780

68-
## 3. Status widget
81+
## <a>3. Status Widget</a>
6982

70-
![alt tag](https://rawgithub.com/sugarlabs/musicblocks/master/guide/status1.svg "given Music block")
83+
[Back to Table of Contents](#table-of-contents)
7184

72-
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/status_example_debug_guide.png "status in tabular form")
85+
![Status Widget Block](./images/Status_widget_debuggingMd.svg "Status Widget Block")
86+
87+
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/status_example_debug_guide.png "Status in tabular form")
7388

7489
The *Status widget* is a tool for inspecting the status of Music
7590
Blocks as it is running. By default, the key, BPM, and volume are
7691
displayed. Also, each note is displayed as it is played. There is one
77-
row per voice in the status table.
92+
row per voice in the status table. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732541757152077&run=True)
7893

7994
Additional *Print* blocks can be added to the *Status* widget to
8095
display additional music factors, e.g., duplicate, transposition,
8196
skip, [staccato](#MORE-TRANSFORMATIONS),
8297
[slur](#MORE-TRANSFORMATIONS), and [graphics](#GRAPHICS) factors,
8398
e.g., x, y, heading, color, shade, grey, and pensize.
8499

85-
![alt tag](https://rawgithub.com/sugarlabs/musicblocks/master/guide/status3.svg "additional programming within the Status block")
100+
![Additional Programming within the Status Widget Block](./images/Status_Widget_additional_programming_DebuggingMd.svg "Additional Programming within the Status Widget Block")
86101

87102
You can do additional programming within the status block. In the
88103
example above, `whole notes played` is multiplied by `4` (e.g. quarter notes)
89-
before being displayed.
104+
before being displayed. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732553086132345&run=True)
105+
106+
## <a>4. Playback Modes</a>
90107

91-
## 4. Playback modes
108+
[Back to Table of Contents](#table-of-contents)
92109

93110
Clicking on the Play button will play your program at full speed.
94111
(It will also hide the blocks while the program runs, which improves
95112
performance.) But there are two other playback modes.
96113

97114
On the Secondary Menu, there are two other Play buttons.
98115

99-
During Playback Slow mode the program will pause between the execution
116+
During *Playback Slow* mode the program will pause between the execution
100117
of each block and the block being executed will be highlighted. This is
101118
useful for following program flow, ensuring that the sequence of blocks
102119
being executed is what you expect. In addition, the value stored in any
103120
box or parameter is displayed on the block as the program runs, so you
104121
can "inspect" program elements as the program runs.
105122

106-
Run Step by Step advances one block per button press.
123+
*Run Step by Step* advances one block per button press.
107124

108-
## 5. Show and Hide blocks
125+
## <a>5. Show and Hide blocks</a>
126+
127+
[Back to Table of Contents](#table-of-contents)
109128

110129
The *Show* and *Hide* blocks (found on the *Extras* palette) are
111130
useful for setting
@@ -117,7 +136,7 @@ gets to the *Show* block. Then the blocks are displayed and
117136
run in *Playback Slow* mode. When the *Hide* block is encountered, the
118137
blocks are hidden and the program resumes running at full speed.
119138

120-
## 6. Browser console
139+
## <a>6. Browser Console</a>
121140

122141
As Music Blocks runs, some debugging information is written to the
123142
browser console, such as the notes being played and comments (See the
@@ -127,3 +146,5 @@ browser console, such as the notes being played and comments (See the
127146
![alt tag](https://github.com/sugarlabs/musicblocks/blob/master/images/browserconsole_debug_guide.png "Console blocks")
128147

129148
Shown above is the console output from three notes: `sol mi sol`.
149+
150+
[Back to Table of Contents](#table-of-contents)

Music_Blocks_for_Snap_Users.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ like Snap, you can change the size of the blocks.
7878

7979
### Operators and Predicates
8080

81-
Infix vs Prefix
81+
**Infix vs Prefix**
8282

8383
Snap uses Infix notation for its operators:
8484

@@ -106,7 +106,8 @@ In Snap, you make variables explicitly.
106106
![Snap Variables](./images/snap/snap-variables.png)
107107

108108
The Set To and Change By commands are specified through pull-down menus.
109-
Store in Box
109+
110+
**Store in Box**
110111

111112
In Music Blocks, we use an analogy of a shoe box. You put something
112113
into a box and then reference the thing by the name you have given to
@@ -151,7 +152,7 @@ to “12”) to store the possible outcome of rolling two dice. I store in
151152
the box named “box” the sum of two random numbers between 1 and 6, so
152153
the box named “box” has a number between 2 and 12. Then I increment
153154
the box named for the number stored in “box” by one. Later in the
154-
program I make a bar chart showing the value stored in each box.
155+
program, I make a bar chart showing the value stored in each box.
155156

156157
![Music Blocks Dice](./images/snap/dice.png)
157158

@@ -223,7 +224,7 @@ Stitch, since the embroidery machines only have one needle (“single
223224
threaded”). But in music, we often have more than one voice or
224225
instrument. You get a separate “thread” for each Start block.
225226

226-
For example, we can implement a simple mirror paint by using four Start blocks.
227+
For example, we can implement a simple mirror paint by using four Start blocks. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732171217345259&run=True)
227228

228229
![Music Blocks Start Blocks](./images/snap/multiple-mouse.png)
229230

@@ -474,13 +475,13 @@ multiple Note blocks. The actions are used in combination to create
474475
music.
475476

476477
Here is an example of a canon (Frère Jacques), using four voices, each
477-
sharing the actions.
478+
sharing the actions. [RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1732463245651983&run=True)
478479

479480
![Frere Jacques](./images/snap/frere-jacques.png)
480481

481482
## For further information
482483

483-
[Music Blocks README](./README.md) exxplains where to find Music Blocks.
484+
[Music Blocks README](./README.md) explains where to find Music Blocks.
484485

485486
[Using Music Blocks](./documentation/README.md) has basic instructions.
486487

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ Linux systems, the `python3` command is not bound to python. You may
103103
need to perform a `sudo apt install python-is-python3` on Debian-like
104104
distros, or equivalent on others.)
105105

106-
4. After cloning the musicblocks repository, run
106+
4. After cloning the musicblocks repository, you can choose one of two methods to start a local server: using Python or using npm
107107

108-
for _Linux_ and _macOS_:
108+
**Using Python**
109+
110+
for _Linux_ and _macOS_:
109111

110112
```bash
111113
python -c "import os, sys; os.system('python -m SimpleHTTPServer 3000 --bind 127.0.0.1') if sys.version_info.major==2 else os.system('python -m http.server 3000 --bind 127.0.0.1')"
@@ -117,17 +119,29 @@ distros, or equivalent on others.)
117119
python -c "import os, sys; os.system('python -m SimpleHTTPServer 3000') if sys.version_info.major==2 else os.system('python -m http.server 3000 --bind 127.0.0.1')"
118120
```
119121

120-
If you have `npm` installed, simply run `npm run serve` for Linux
121-
and macOS, and `npm run winserve` for Windows.
122+
123+
**Using npm**
124+
125+
for _Linux_ and _macOS_:
126+
127+
```bash
128+
npm run serve
129+
```
130+
131+
for _Windows_:
132+
133+
```bash
134+
npm run winserve
135+
```
122136

123137
**NOTE:** _Make sure you can run either `python` or `py` from your
124138
terminal, to launch the Python prompt._
125139

126-
5. You should see a message `Serving HTTP on 127.0.0.1 port 3000
140+
6. You should see a message `Serving HTTP on 127.0.0.1 port 3000
127141
(http://127.0.0.1:3000/) ...` since the HTTP Server is set to start
128142
listening on port 3000.
129143

130-
6. Open your favorite browser and visit `localhost:3000` or `127.0.0.1:3000`.
144+
7. Open your favorite browser and visit `localhost:3000` or `127.0.0.1:3000`.
131145

132146
**NOTE:** _Use `ctrl + c` or `cmd + c` to quit the HTTP Server to avoid
133147
`socket.error:[Errno 48]`_.

0 commit comments

Comments
 (0)