Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1838,73 +1838,6 @@ inside the *Repeat*, working our way down to `Sol` in `Octave
4`. Another detail to note is the use of the *Mode length* block.
[RUN LIVE](https://musicblocks.sugarlabs.org/index.html?id=1735824170382853&run=True)

#### <a name="LEGO-BRICKS">4.2.7 LEGO Bricks Widget</a>

![LEGO Bricks](../documentation/legobricks_block.svg "LEGO Bricks block")

The *LEGO Bricks* widget represents a groundbreaking approach to music composition that bridges the physical and digital worlds. This innovative tool transforms tangible LEGO brick constructions into dynamic musical compositions through advanced computer vision and color detection algorithms.

![LEGO Bricks Widget](../documentation/legobricks_widget.svg "LEGO Bricks Widget Interface")

The widget operates by analyzing colored LEGO brick arrangements from uploaded images or live webcam feeds. Users can upload photos of their LEGO creations or use their device's camera to capture constructions in real-time. The widget features an intelligent color detection system that can adapt to different backgrounds and lighting conditions.

![LEGO Bricks Demo](../documentation/legobricks_demo.svg "LEGO Bricks Widget Demo Example")

**Key Features:**

- **Multiple Input Sources**: Upload images of LEGO brick patterns or use webcam for live construction analysis
- **Smart Background Detection**: Eye dropper tool allows selection of background color (green baseplates, white surfaces, etc.) for accurate color detection
- **Real-time Color Analysis**: As the widget scans across the image with vertical lines, it identifies different colored bricks and maps them to musical pitches
- **Customizable Scanning**: Adjustable scanning speed and column spacing for precise timing control
- **Interactive Color Selection**: Live preview tooltip shows detected colors while hovering over the image

**How It Works:**

The widget scans the uploaded image or webcam feed using vertical scanning lines that move from left to right. Each vertical line represents a moment in time, while the vertical position corresponds to different musical pitches. When the scanner encounters a LEGO brick that differs from the selected background color, it triggers a musical note corresponding to that color and vertical position.

**Musical Output:**

- **Real-time Audio Playback**: Hear your LEGO creation as music while the scanning progresses
- **Action Block Export**: Generate Music Blocks code that can be further edited and incorporated into larger compositions
- **Visual Feedback**: Color detection visualization shows which areas of the image are being interpreted as musical notes
- **Downloadable Results**: Save both the generated music blocks and visual analysis for future use

**Educational Value:**

The LEGO Bricks widget combines STEM learning with creative expression, teaching concepts of pattern recognition, color theory, rhythm and timing, and creative coding. It bridges physical construction with digital programming concepts, making it particularly effective for introducing younger learners to music composition while leveraging their natural affinity for construction play.

**Advanced Features:**

**Input Methods and Flexibility:**
- Image upload support for various formats (JPEG, PNG, WebP)
- Live webcam integration for real-time analysis
- Batch processing for creating longer musical compositions

**Color Detection System:**
- Adaptive color calibration for various lighting conditions
- Color family recognition to prevent minor shade variations
- User-configurable tolerance settings for different environments

**Scanning Technology:**
- Precise vertical line scanning with systematic left-to-right movement
- Height-to-pitch conversion for intuitive spatial-to-musical relationships
- Horizontal spacing check for natural rhythmic pattern generation

**Educational Applications:**

**Musical Pedagogy:**
- Pattern recognition skills through visual-spatial construction
- Rhythm and timing concepts via spatial arrangement
- Pitch relationships through vertical construction patterns
- Composition techniques using systematic building approaches

**Creative Development:**
- Synesthetic learning connecting visual, spatial, and auditory perception
- Problem-solving skills for achieving specific musical outcomes
- Collaborative creativity in group construction projects

This widget exemplifies Music Blocks' philosophy of making music programming accessible and engaging by connecting familiar physical activities with abstract musical concepts. It serves as an ideal introduction to musical notations for a blind or a visually challenged individual. We can make it a lot more better in future and make many more activities with it LegoBlocks.

### <a name="rhythms">4.3 Generating Rhythms</a>

The *Rhythm Maker* block is used to launch a widget similar to the
Expand Down
66 changes: 66 additions & 0 deletions lego-block-widget-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#### <a name="LEGO-BRICKS"> LEGO Bricks Widget</a>

![LEGO Bricks](../documentation/legobricks_block.svg "LEGO Bricks block")

The *LEGO Bricks* widget represents a groundbreaking approach to music composition that bridges the physical and digital worlds. This innovative tool transforms tangible LEGO brick constructions into dynamic musical compositions through advanced computer vision and color detection algorithms.

![LEGO Bricks Widget](../documentation/legobricks_widget.svg "LEGO Bricks Widget Interface")

The widget operates by analyzing colored LEGO brick arrangements from uploaded images or live webcam feeds. Users can upload photos of their LEGO creations or use their device's camera to capture constructions in real-time. The widget features an intelligent color detection system that can adapt to different backgrounds and lighting conditions.

![LEGO Bricks Demo](../documentation/legobricks_demo.svg "LEGO Bricks Widget Demo Example")

**Key Features:**

- **Multiple Input Sources**: Upload images of LEGO brick patterns or use webcam for live construction analysis
- **Smart Background Detection**: Eye dropper tool allows selection of background color (green baseplates, white surfaces, etc.) for accurate color detection
- **Real-time Color Analysis**: As the widget scans across the image with vertical lines, it identifies different colored bricks and maps them to musical pitches
- **Customizable Scanning**: Adjustable scanning speed and column spacing for precise timing control
- **Interactive Color Selection**: Live preview tooltip shows detected colors while hovering over the image

**How It Works:**

The widget scans the uploaded image or webcam feed using vertical scanning lines that move from left to right. Each vertical line represents a moment in time, while the vertical position corresponds to different musical pitches. When the scanner encounters a LEGO brick that differs from the selected background color, it triggers a musical note corresponding to that color and vertical position.

**Musical Output:**

- **Real-time Audio Playback**: Hear your LEGO creation as music while the scanning progresses
- **Action Block Export**: Generate Music Blocks code that can be further edited and incorporated into larger compositions
- **Visual Feedback**: Color detection visualization shows which areas of the image are being interpreted as musical notes
- **Downloadable Results**: Save both the generated music blocks and visual analysis for future use

**Educational Value:**

The LEGO Bricks widget combines STEM learning with creative expression, teaching concepts of pattern recognition, color theory, rhythm and timing, and creative coding. It bridges physical construction with digital programming concepts, making it particularly effective for introducing younger learners to music composition while leveraging their natural affinity for construction play.

**Advanced Features:**

**Input Methods and Flexibility:**
- Image upload support for various formats (JPEG, PNG, WebP)
- Live webcam integration for real-time analysis
- Batch processing for creating longer musical compositions

**Color Detection System:**
- Adaptive color calibration for various lighting conditions
- Color family recognition to prevent minor shade variations
- User-configurable tolerance settings for different environments

**Scanning Technology:**
- Precise vertical line scanning with systematic left-to-right movement
- Height-to-pitch conversion for intuitive spatial-to-musical relationships
- Horizontal spacing check for natural rhythmic pattern generation

**Educational Applications:**

**Musical Pedagogy:**
- Pattern recognition skills through visual-spatial construction
- Rhythm and timing concepts via spatial arrangement
- Pitch relationships through vertical construction patterns
- Composition techniques using systematic building approaches

**Creative Development:**
- Synesthetic learning connecting visual, spatial, and auditory perception
- Problem-solving skills for achieving specific musical outcomes
- Collaborative creativity in group construction projects

This widget exemplifies Music Blocks' philosophy of making music programming accessible and engaging by connecting familiar physical activities with abstract musical concepts. It serves as an ideal introduction to musical notations for a blind or a visually challenged individual. We can make it a lot more better in future and make many more activities with it LegoBlocks.