### STRUDEL Quick Start Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/README.md A basic STRUDEL code snippet demonstrating a simple drum pattern. This example shows how to trigger different drum sounds (kick, snare, hi-hat) in sequence and with repetition. ```javascript s("bd sd bd sd, hh*8") ``` -------------------------------- ### Complex STRUDEL Mix Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This example demonstrates a more complex mix in STRUDEL, combining multiple synthesizer types like sine, sawtooth, supersaw, and square waves with drum kits. It illustrates advanced filtering, cutoff modulation using sine waves, and reverb to create a rich and layered sound. ```javascript stack( "*4".note().s('sine').lpf(80).gain(0.9), "*4".note().s('sawtooth').hpf(40).lpf(250).cutoff(sine.slow(2).range(200, 800)), "bd*4".s('drumkit').hpf(40).lpf(1000).lpq(0.3).gain(0.8), "hh*16 cp*8 sd*4".s('drumkit').hpf(200).lpf(8000).gain(0.7), "*4".note().s('supersaw').hpf(200).lpf(5000).room(0.3).gain(0.6), "*4".note().s('square').hpf(800).lpf(8000).gain(0.7) ).slow(2) ``` -------------------------------- ### Mix Reference with Orbit Separation in Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This example demonstrates mix reference techniques using orbit separation to isolate dry, wet, and ambient elements. It assigns different orbits to drum kit and piano sounds, controlling reverb with '.room()'. ```javascript // Mix reference using orbit separation stack( // Dry elements - orbit 1 "bd*4".s('drumkit').orbit(1), // Wet elements - orbit 2 "hh*16".s('drumkit').room(0.3).orbit(2), // Ambient elements - orbit 3 "*4".note().s('piano').room(0.5).orbit(3) ) ``` -------------------------------- ### Dynamic Contrast via Pattern Variation in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This example demonstrates creating dynamic contrast by varying musical patterns over time using STRUDEL's `stack` and `every` functions. It sequences different combinations of drum sounds with varying gains and effects to build intensity and create a dynamic contrast. The `every` function allows for applying transformations at specific intervals. ```javascript // Dynamic contrast through pattern variation stack( // Quiet section "bd*4 hh*8".s('drumkit').gain(0.4), // Build-up - increasing energy "bd*4 hh*16 cp*8".s('drumkit').every(4, x => x.gain(1.1)), // Drop - full energy "bd*4 hh*16 cp*8 sd*4".s('drumkit').gain(1.0) ) ``` -------------------------------- ### Subtractive Mixing with Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md Demonstrates subtractive mixing by starting with a full arrangement of drums, piano, and bass, then progressively removing or modifying elements using '.every()' for variation. It uses 'drumkit', 'piano', and 'sawtooth' synths. ```javascript // Subtractive mixing approach stack( // Full arrangement "bd*4 hh*16 cp*8 sd*4".s('drumkit'), "*4".note().s('piano'), "*4".note().s('sawtooth') ) .every(8, x => x.cut(1)) // Remove every 8th event for variation .every(16, x => x.rev()) // Reverse every 16th event ``` -------------------------------- ### Structure a Complete Track with Multiple Layers in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/QUICK_REFERENCE.md This comprehensive example shows how to layer multiple musical elements (drums, bassline, chords) to form a complete track structure. It uses the `stack` function to combine different patterns and applies various effects to each layer. ```javascript stack( // Drums s("bd*2 [~ bd] bd ~"), s("~ sd ~ sd"), s("hh*8").gain(0.5), // Bass note("c2 c2 eb2 g2") .s('sawtooth') .lpf(400), // Chords "" .voicings() .note() .s('triangle') .gain(0.2) .room(0.5) ) ``` -------------------------------- ### Generate a Bassline with Effects in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/QUICK_REFERENCE.md This example demonstrates how to create a bassline using specific notes and apply effects. It sets the sound to 'sawtooth' and applies a low-pass filter (lpf) at 800Hz to shape the tone. ```javascript note("c2 c2 eb2 g2") .s('sawtooth') .lpf(800) ``` -------------------------------- ### STRUDEL Example Migration: Complex Pattern Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/TIDAL_DIFFERENCES.md Provides a practical example of migrating a complex Tidal Cycles pattern, including multiple transformations, parameters, and tempo, to STRUDEL's syntax. ```javascript // Tidal: // d1 $ fast 2 $ every 3 (rev) $ s "bd sd" // # gain 0.8 // # room 0.3 // |+ n "0 7" // // setcps 0.5625 // STRUDEL: $: s("bd sd") .add("0 7") .every(3, rev) .fast(2) .gain(0.8) .room(0.3) setcpm(33.75) ``` -------------------------------- ### 8-Bar Verse Length Example (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Demonstrates a standard 8-bar verse progression using STRUDEL's musical syntax. This snippet focuses on defining the length and chord sequence for a typical verse section. No external dependencies beyond STRUDEL. ```javascript // 8-bar verses - standard length "*8" ``` -------------------------------- ### Building Energy Arc Example (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Demonstrates building energy in STRUDEL by gradually increasing tempo and layering elements. This snippet uses chord progression with increasing rhythmic density and a sine wave lead with a rising cutoff frequency to create a sense of build-up. It employs STRUDEL's layering and fast tempo functions. ```javascript // Gradual energy increase "*8 *8 *8 *8".layer( x => x.voicing().s('piano').gain(0.5), x => x.rootNotes(2).note().s('sine').cutoff(400) ).fast("<1 1/2 1/4 1/8>") ``` -------------------------------- ### Syncopation Techniques and Examples (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/rhythm.md Demonstrates basic and complex syncopation in STRUDEL, including techniques like anticipation (playing before the beat) and delay (playing after the beat). Provides examples for funk and Latin styles. ```javascript // Basic Syncopation - accent on off-beats "bd*4 ~ sn*4 ~ hh*8" // Complex Syncopation - multiple layers "bd*2 ~ sn*4 ~ hh*16" // Anticipation - note before downbeat "~ bd*4 ~ sn*4" // Delay - note after downbeat "bd*4 ~ ~ sn*4" // Funk-style syncopation "bd*4 ~ sn*4 ~ hh*8" // Latin-style syncopation "bd*2 ~ sn*4 ~ hh*16" ``` -------------------------------- ### STRUDEL Code Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/index.md This example demonstrates the direct usage of STRUDEL syntax for defining musical notes and their properties. It highlights the removal of template literals and framework-specific wrappers, focusing on the core STRUDEL code. ```strudel // Direct STRUDEL code without template literals "*4".note().s('sine') ``` -------------------------------- ### Frequency-Specific Processing with Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This example showcases frequency-specific audio processing using low-pass (lpf) and high-pass (hpf) filters to shape bass, mids, and highs. It applies different filter settings to 'sawtooth', 'piano', and 'sine' synths. ```javascript // Frequency-specific processing stack( // Bass with low-end enhancement "*4".note().s('sawtooth').lpf(400).lpq(0.5), // Mids with presence boost "*4".note().s('piano').hpf(200).lpf(3000).lpq(1.0), // Highs with air "*4".note().s('sine').hpf(3000).lpq(0.3) ) ``` -------------------------------- ### STRUDEL Polychords Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/harmony.md Shows how to create complex sounds in STRUDEL by combining different tonalities using polychords. The example demonstrates a C major chord over a G7 chord. ```javascript // C major over G7 creates a C/G polychord "*4" ``` -------------------------------- ### Manipulate Samples in Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/musical-knowledge/complete-examples/music4machines.md Demonstrates sample manipulation in Strudel using the `s()` function. It shows how to apply effects like `room` and `rsize` to samples and how to precisely control the start and end points (`begin`, `end`) of a sample to create specific vocal chops. ```javascript // use custom samples based on the name you assigned them earlier let intro_vocals = s("vox").room(.3).rsize(2); // modify when the sample begins and ends // this sample has 4 lines and we want the first one // so start at 0 and cut it just after 1/4 let vocals01 = s("vox").begin(0).end(.25 + (.25 * .25 * .5)) .attack(.25).delay(".25:.45:.4").room(.2).rsize(2); // start the second one at 1/4 and cut it just after 2/4 let vocals02 = s("vox").begin(.25).end(.5 + (.25 * .25 * .5)) .attack(.25).delay(".25:.45:.4").room(.2).rsize(2); ``` -------------------------------- ### Lead Melody Example (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Defines a simple lead melody using STRUDEL's note and cutoff syntax. This snippet creates a sequence of notes for a lead instrument, specifying pitch and a cutoff frequency for tonal shaping. It relies on STRUDEL's musical language features. ```javascript // Lead melody "[c4 e4 g4 b4 c5]*4".note().s('lead').cutoff(2000) ``` -------------------------------- ### Clear Mid-Range Sounds (STRUDEL) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This STRUDEL code example focuses on producing clear mid-range sounds by implementing high-pass and low-pass filters. It removes unwanted low-frequency mud and controls high frequencies, while a short release time ensures clarity. ```javascript // Clear mid-range sounds "*4" .note() .s('piano') .hpf(200) // Remove low-frequency mud .lpf(5000) // Control high frequencies .release(0.3) // Short decay for clarity ``` -------------------------------- ### Block-Based Evaluation Example in Tidal Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/TIDAL_DIFFERENCES.md Provides an example of Tidal's block-based evaluation using `d1`, `d2`, `d3` for different channels. This allows for evaluating individual lines or selected blocks of code. ```haskell d1 $ s "bd sd" d2 $ s "hh*8" d3 $ note "c a f e" # s "piano" ``` -------------------------------- ### Basic Jazz Progressions in STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/theory/harmony-reference.md Demonstrates classic jazz chord progressions in C major and other keys using basic STRUDEL notation. These examples show how to represent repeated chord sequences. ```javascript // Classic jazz progression in C major "*4" ``` ```javascript // In the key of C "*2" ``` ```javascript // Four-chord song progression "*4" ``` -------------------------------- ### Arrangement Structure Example in STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/genres/jungle-reference.md Demonstrates a typical arrangement structure for a jungle track, using `stack` to layer different sections like intro, verse, chorus, bridge, and outro, each with distinct sonic characteristics. ```strudel // Arrangement structure example stack( // Intro - Simple break "amen*2".slow(2), // Verse - Full elements "amen*4".fast(8), // Chorus - More intense "amen*4".fast(8).every(2, rev), // Bridge - Atmospheric breakdown "amen*2".slow(1).room(0.8), // Outro - Fade out "amen*1".slow(4).gain(env([1,0],8)) ) ``` -------------------------------- ### Rhythm Generation with Strudel (Javascript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Demonstrates creating drum patterns in Javascript. The 'Bad Example' shows overly complex, hard-to-follow rhythms. The 'Good Example' illustrates building understandable yet interesting rhythms using the `stack` function for layering. ```javascript // Rhythms that are too complex to follow "bd(1,16)*4 sd(3,16)*8 hh(1,32)*16 cp(5,32)*8" .s('drumkit') .every(1, x => x.speed(sine.slow(4).range(0.5, 1.5))) ``` ```javascript // Complex but understandable rhythms stack( // Simple, foundational kick "bd*4".s('drumkit'), // Interesting but clear snare pattern "sd*4 sd*2".s('drumkit'), // Varied but comprehensible hi-hats "hh*8 hh(3,8)*8".s('drumkit'), // Occasiental rhythmic interest "cp*4".s('drumkit').every(8, x => x.speed(1.5)) ) ``` -------------------------------- ### Dynamic Range with Strudel (Javascript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Demonstrates managing volume levels for different instruments in Javascript using Strudel. The 'Bad Example' has all elements at the same loud volume. The 'Good Example' balances dynamics, using `gain` and `compressor` to create hierarchy and contrast between drums, piano, and bass. ```javascript // Everything at the same volume - no dynamic range stack( "bd*4".s('drumkit').gain(0.8), // Loud kick "sd*4".s('drumkit').gain(0.8), // Loud snare "hh*16".s('drumkit').gain(0.8), // Loud hi-hats "*8".note().s('piano').gain(0.8), // Loud piano "*8".note().s('bass').gain(0.8) // Loud bass ) ``` ```javascript // Strategic dynamic balance - each element has its place stack( // Strong kick foundation "bd*4".s('drumkit').gain(0.9).compressor(-8), // Supporting snare "sd*4".s('drumkit').gain(0.7).compressor(-6), // Textural hi-hats "hh*16".s('drumkit').gain(0.5), // Piano - moderate presence "*8".note().s('piano').gain(0.6), // Bass - solid foundation "*8".note().s('bass').gain(0.8) ) ``` -------------------------------- ### Implement Call and Response Melodies (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/melody.md This JavaScript example illustrates the 'Call and Response' melodic technique in STRUDEL. It defines separate 'Call' and 'Response' phrases and then combines them. ```javascript // Call "[c4 e4 g4 b4]" // Response "[g4 e4 c4 g3]" // Combined "[c4 e4 g4 b4] [g4 e4 c4 g3] [c4 e4 g4 b4] [g4 e4 c4 g3]" ``` -------------------------------- ### Subtractive Synthesis Example in STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/sound-design/timbre.md Provides an example of subtractive synthesis in STRUDEL. It starts with a harmonically rich sawtooth wave and uses a dynamic low-pass filter with resonance and a filter envelope to shape the timbre. ```strudel // Subtractive synthesis example "*8" .note() .s('sawtooth') // Rich harmonic source .lpf(sine.slow(4).range(200, 2000)) // Dynamic filter .lpq(1.0) // Resonance for character .lpenv(env([1, 3, 1], [2, 4, 2]).slow(8)) // Filter envelope ``` -------------------------------- ### Create Basic Sound Patterns in JavaScript Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Demonstrates how to play basic sound patterns using the `s()` or `sound()` functions in Strudel. Supports direct sample names, specific sample selection with colon notation, and bank selection for drum machines. Uses mini-notation format for pattern definition. ```javascript // Play a basic drum pattern s("bd sd [~ bd] sd") // Select specific samples with colon notation sound("jazz:0 jazz:1 [jazz:4 jazz:2] jazz:3*2") // Use n() to separate sample selection from sound name n("0 1 [4 2] 3*2").sound("jazz") // Select drum machine with bank() sound("bd sd [- bd] sd").bank("RolandTR909") // Classic house beat sound("bd*4, [- cp]*2, [- hh]*4").bank("RolandTR909") ``` -------------------------------- ### Rhythmic Displacement (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/rhythm.md Illustrates rhythmic displacement by shifting patterns to start on off-beats, creating tension. This example shows a simple displacement by prepending rests ('~'). ```javascript // Displaced pattern - starts on off-beat "~ bd*4 ~ sn*4" ``` -------------------------------- ### Simple Rhythm Pattern in Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/learn/getting-started.md This example demonstrates creating a basic rhythm pattern using drum sounds in Strudel. It utilizes the 's' function to specify the sounds to be played. ```strudel s("bd sd") ``` -------------------------------- ### Develop Melodic Motives (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/melody.md This JavaScript example shows how to apply 'Motivic Development' in STRUDEL. It starts with an 'Initial motive' and then shows its 'Development' by introducing variations. ```javascript // Initial motive "[c4 e4 g4]" // Development "[c4 e4 g4] [d4 f4 a4] [e4 g4 b4] [c4 e4 g4 c5]" ``` -------------------------------- ### Euclidean and Polyrhythm Generation (JavaScript) Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Shows how to generate complex rhythmic structures using Euclidean algorithms and polyrhythms. Examples include mini-notation for Euclidean rhythms, layering them, using note-based Euclidean patterns, and creating polyrhythms with Euclidean rotations. ```javascript // Euclidean in mini-notation (beats, segments, offset) s("bd(3,8)") // 3 beats over 8 segments s("bd(3,8,2)") // offset by 2 // Layered euclidean rhythms stack( s("bd(5,8)"), s("cp(3,8,2)"), s("hh(7,8)") ) // Note-based euclidean note("c3(5,8) e3(3,8) g3(4,8)") .s("triangle") // Polyrhythm with euclidean note("c3 e3 g3".euclidRot(3, 8)) .stack( note("c4 d4 e4".euclidRot(5, 8)) ) ``` -------------------------------- ### Harmonic Tension with Strudel.js Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Creates harmonic tension using dominant chords in Strudel.js. This example uses a sequence of dominant seventh chords. Dependencies include the Strudel.js library. ```javascript // Use dominant chords to create tension "*4" ``` -------------------------------- ### STRUDEL: JavaScript Incremental Music Building Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Presents a practical approach to building music incrementally in STRUDEL using JavaScript, combining elements like drums, bass, chords, and lead while ensuring frequency separation and balance. ```javascript // Start with foundation const foundation = "bd*4".s('drumkit').compressor(-8); // Add bass - make sure it works with foundation const bass = "*4".note().s('sawtooth').hpf(80).cutoff(600); // Add chords - check frequency separation const chords = "*4".note().s('piano').hpf(200).lpf(2000); // Add lead - ensure it doesn't compete const lead = "*8".note().s('lead').hpf(1000).gain(0.7); // Combine - everything has its space stack(foundation, bass, chords, lead); ``` -------------------------------- ### Sequential Melody Development - STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/theory/melody-reference.md Shows sequential development of a melodic idea, where each subsequent phrase starts on a different note, often moving up by step, creating a sense of progression. ```STRUDEL " [c4 e4 g4] [d4 f4 a4] [e4 g4 b4] [f4 a4 c5] " ``` -------------------------------- ### Motive Development Sequence - STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/theory/melody-reference.md Shows the development of an initial musical motive through a sequence of related phrases. Each phrase builds upon the previous one, often by shifting the starting note upwards. ```STRUDEL " [c4 e4 g4] " " [c4 e4 g4] [d4 f4 a4] [e4 g4 b4] [c4 e4 g4 c5] " ``` -------------------------------- ### Reference Track Comparison: STRUDEL 'Reference Track' Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Demonstrates the 'Reference Track' method by creating a sample track in STRUDEL and listing critical points for comparison with professional tracks, focusing on element clarity, spatial separation, and dynamic range control. ```javascript // Your track const myTrack = stack( "bd*4".s('drumkit').gain(0.9), // Check: Is kick too loud? "*4".note().s('sawtooth').gain(0.8), // Check: Is bass too muddy? "*8".note().s('piano').gain(0.7), // Check: Is piano clear? "hh*16".s('drumkit').gain(0.5) // Check: Are hi-hats too loud? ); // Compare to professional references // - Professional tracks usually have clear separation // - Each element has its own space // - Dynamic range is carefully controlled ``` -------------------------------- ### Structure Classic Jungle Arrangement Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/genres/jungle.md Outlines a typical arrangement structure for jungle music, including intro, verse, chorus, bridge, and outro sections, with examples of how to build energy and dynamics. ```STRUDEL stack( // Intro - Simple break "amen*2".slow(2), // Verse - Full elements "amen*4".fast(8), // Chorus - More intense "amen*4".fast(8).every(2, rev), // Bridge - Atmospheric breakdown "amen*2".slow(1).room(0.8), // Outro - Fade out "amen*1".slow(4).gain(env([1,0],8)) ) ``` -------------------------------- ### Load Audio Samples with Strudel Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Load audio samples from URLs, GitHub repositories, local disk, or custom JSON files. Supports named samples, pitched samples with base pitch, and GitHub shortcuts. Requires the '@strudel/sampler' if loading from a local server. ```javascript // Load samples from URLs with custom names samples({ bassdrum: 'bd/BT0AADA.wav', hihat: 'hh27/000_hh27closedhh.wav', snaredrum: ['sd/rytm-01-classic.wav', 'sd/rytm-00-hard.wav'], }, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/'); s("bassdrum snaredrum:0 bassdrum snaredrum:1, hihat*16") // Load from strudel.json file samples('https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/strudel.json') s("bd sd bd sd,hh*16") // GitHub shortcut samples('github:tidalcycles/dirt-samples') s("bd sd bd sd,hh*16") // Load from local server using @strudel/sampler // Terminal: cd samples && npx @strudel/sampler samples('http://localhost:5432/'); n("<0 1 2> a "swoop smash"") // Load pitched samples with base pitch samples({ 'moog': { 'g2': 'moog/004_Mighty%20Moog%20G2.wav', 'g3': 'moog/005_Mighty%20Moog%20G3.wav', 'g4': 'moog/006_Mighty%20Moog%20G4.wav', } }, 'github:tidalcycles/dirt-samples') note("g2!2 !2, g4 f4]>") .s('moog') .clip(1) .gain(.5) ``` -------------------------------- ### Basic Sequences in STRUDEL Mini Notation Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/QUICK_REFERENCE.md Demonstrates the fundamental way to create sequences of sounds using STRUDEL's mini notation. It shows how to play multiple samples in a defined order within a single cycle. ```javascript s("bd sd") // Two events in sequence s("bd sd hh cp") // Four events, evenly spaced in one cycle ``` -------------------------------- ### Gradual Complexity: STRUDEL 'Less is More' Example Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Demonstrates the 'Less is More' philosophy by starting with a simple element and progressively adding complexity (bass, rhythm, texture) in STRUDEL. This approach ensures that each added element serves a purpose. ```javascript const simple = "*8".note().s('piano').gain(0.7); const withBass = stack(simple, "*8".note().s('bass').gain(0.8)); const withRhythm = stack(withBass, "bd*4".s('drumkit').gain(0.9)); const final = stack(withRhythm, "hh*16".s('drumkit').gain(0.5)); ``` -------------------------------- ### Strudel Mini-Notation: Sequencing and Subdivision in JavaScript Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Explains the mini-notation syntax for sequencing and subdivision in Strudel. Covers space separation for events, square brackets for subdivisions, nested brackets for deeper structures, rests using tilde or dash, parallel patterns with commas, and alternation with angle brackets. ```javascript // Space separates events (4 sounds in one cycle) s("bd sd hh cp") // Square brackets create subdivisions s("bd [hh hh] sd [hh bd]") // Nested brackets for deeper subdivision s("bd [metal [jazz [sd cp]]]") // Tilde or dash for rests s("bd ~ sd ~ hh hh ~ cp") // Comma for parallel/simultaneous patterns s("bd*4, [- cp]*2, hh*8") // Angle brackets for one-per-cycle alternation s("*8") ``` -------------------------------- ### Velocity-Based Dynamics in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This code example illustrates how to implement velocity-based dynamic expression in STRUDEL. It uses varying velocity values to control the loudness or intensity of notes, applied to a piano sound. The velocity is defined as an array, which is then iterated over. ```javascript // Velocity-based dynamic expression "[-8 0 4 7]*8" .note() .s('piano') .velocity("<0.3 0.5 0.7 1>*2") // Velocity variation .gain(0.7) // Base gain ``` -------------------------------- ### Apply Sectional Variation in STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Shows how to create variations of repeated sections using STRUDEL. This example defines a 'verse1' and then creates 'verse2' by transposing the chords of 'verse1'. This technique adds subtle changes to recurring musical ideas. ```javascript // Verse with variation verse1: "*8" verse2: "*8".transpose("<2 2 -1 -1>") // Combined verse1 + " " + verse2 ``` -------------------------------- ### Generate Chords and Chord Progressions in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/QUICK_REFERENCE.md This snippet demonstrates how to manually define chords (like C major) or use shorthand notation for more complex chords (like C major 7th) and chord progressions. It also shows how to apply voicing algorithms and generate chord progressions from a string of chords. ```javascript note("c,e,g") // C major chord (manual) chord("C^7") // C major 7th chord chord("") // Chord progression "" .voicings('lefthand') // Apply voicing algorithm .note() ``` -------------------------------- ### 8-Bar Chorus Length Example (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Shows an 8-bar chorus progression, maintaining balance with an 8-bar verse. This STRUDEL code defines the chords and duration for a chorus, ensuring consistent structure. It uses standard STRUDEL musical notation. ```javascript // 8-bar chorus - same length as verse for balance "*4 *4" ``` -------------------------------- ### Complementary Bass and Lead (STRUDEL) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This STRUDEL example showcases a complementary bass and lead combination using timbre complementarity principles. A warm, rounded bass is paired with a bright, focused lead by applying different filtering and resonance settings to each. ```javascript // Complementary bass and lead stack( // Warm, rounded bass "*4".note().s('sawtooth').cutoff(300).lpq(0.4), // Bright, focused lead "*4".note().s('square').hpf(800).lpq(0.2) ) ``` -------------------------------- ### Sequence and Control Timing in JavaScript Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Illustrates pattern sequencing and timing control in Strudel using `stack`, `cat`, and `arrange` functions. `stack` plays patterns simultaneously, `cat` concatenates them sequentially, and `arrange` manages sections with specified cycle counts. Includes tempo setting with `setcpm`. ```javascript // Stack patterns to play simultaneously stack( sound("bd*4"), sound("[- cp]*2"), sound("hh*8") ) // Concatenate patterns sequentially cat( "g3,b3,e4", "a3,c3,e4", "b3,d3,f#4", "b3,e4,g4" ).note() // Arrange sections with cycle counts arrange( [8, section00], // play section00 for 8 cycles [8, section01], // then section01 for 8 cycles [8, section02], [8, end] ).cpm(135/4) // Set tempo in cycles per minute setcpm(120/4) // 120 BPM in 4/4 time ``` -------------------------------- ### JavaScript: Creating Rhythmic Cohesion in Audio Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/common-mistakes.md Compares chaotic, non-coherent rhythms with those that have a unified feel and groove. The 'good' example demonstrates how to build a cohesive rhythmic foundation by aligning elements like kick, snare, hi-hats, and piano. ```javascript // Rhythms that don't work together stack( "bd*4".s('drumkit'), // Straight quarter notes "hh(3,8)*4 hh(5,8)*4".s('drumkit'), // Complex syncopation "*16".note().s('piano'), // 16th notes "cp*8".s('drumkit') // Off-beat claps ) ``` ```javascript // Cohesive rhythmic foundation - everything works together stack( // Strong, consistent kick pattern "bd*4".s('drumkit').compressor(-10), // Complementary snare pattern "sd*4".s('drumkit').every(2, x => x.pan(0.5)), // Hi-hats provide rhythmic texture "hh*16".s('drumkit').every(4, x => x.speed(0.9)), // Piano reinforces the groove "*4".note().s('piano').every(1, x => x.stut(2, 0.5)) ) ``` -------------------------------- ### Looping Control and Playback (JavaScript) Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Illustrates controlling sample loop behavior, including enabling/disabling loops, setting loop start and end points, and using wavetables for looping. It also covers cutting to prevent overlapping sounds and clipping to limit sample length. ```javascript s("birds") .loop(1) // enable loop .loopBegin(0.2) // loop start point .loopEnd(0.8) // loop end point samples('bubo:waveforms'); note("c3 e3 g3") .s('wt_flute') .loopBegin("<0 0.25 0.5>") // scan wavetable .loopEnd("<0.25 0.5 1>") s("hh*16") .cut(1) // cut group 1 s("moog") .note("c2 eb2 g2 bb2") .clip(0.5) // clip to 0.5 cycles ``` -------------------------------- ### Classic Amen Break Jungle Pattern (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/genres/jungle.md A complete jungle music pattern featuring the classic amen break, a sawtooth bassline with an automated cutoff, hi-hats, and a clap layer for atmosphere. This example demonstrates a full arrangement. ```javascript // Complete jungle pattern with amen break, bass, and effects stack( // Main break "amen*8".s('drumkit').fast(8), // Bassline "".note().s('sawtooth').cutoff(sine.slow(7).range(300,5000)).fast(4), // Hi-hats "hh*32".s('drumkit').fast(16), // Atmosphere "cp*8".s('drumkit').fast(4).room(0.3) ) ``` -------------------------------- ### Layered Bass with Complementary Characteristics (STRUDEL) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This STRUDEL example illustrates layered timbre techniques by creating a complex bass sound from multiple complementary layers. It combines a sine wave for the fundamental, a sawtooth wave for harmonic content, and noise for high-frequency attack. ```javascript // Layered bass with complementary characteristics stack( // Fundamental - low and warm "*4".note().s('sine').gain(0.7), // Harmonic content - mid-range "*4".note().s('sawtooth').cutoff(800).gain(0.4), // Attack - high and transient "*4".note().s('noise').hpf(2000).decay(0.1).gain(0.3) ) ``` -------------------------------- ### Sample Slicing and Manipulation (JavaScript) Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Demonstrates how to chop, striate, slice, splice, and scrub audio samples. These functions allow for dividing samples into segments, layering them, selecting specific slices, rearranging them while preserving timing, and granular scanning. ```javascript s("amen") .chop(8) // divide into 8 slices .n("<0 1 2 3 4 5 6 7>") s("amen") .striate(16) // 16 slices layered s("amen") .slice(8, "<0 2 4 6 1 3 5 7>") s("amen") .splice(8, "<7 6 5 4 3 2 1 0>") s("amen") .chop(16) .n(irand(16)) s("amen") .scrub(8) .n(sine.range(0, 7).slow(4)) ``` -------------------------------- ### Dynamic EQ Techniques with Strudel Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md Illustrates dynamic EQ techniques by applying a low-pass filter (lpf) with a dynamic cutoff frequency to a piano sound. This allows for frequency-specific modulation using a sine wave. ```javascript // Dynamic EQ for problematic frequencies "*4" .note() .s('piano') .lpf(sine.slow(8).range(1000, 4000)) // Dynamic filtering .lpq(0.5) // Controlled resonance .gain(0.7) // Overall gain ``` -------------------------------- ### Loading Custom Samples from GitHub Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/QUICK_REFERENCE.md Loads sample packs directly from a GitHub repository. This is a convenient way to access community-shared sample libraries. The function automatically fetches and organizes the samples from the specified repository. ```javascript samples('github:tidalcycles/dirt-samples') s("bd sd hh") ``` -------------------------------- ### Atmospheric Pad Example (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/theory/form.md Creates an atmospheric pad sound using STRUDEL's instrument and release syntax. This code defines a sustained chord with a long release time, suitable for background textures. It utilizes STRUDEL's instrument definition and parameter controls. ```javascript // Atmospheric pad "*8".s('pad').release(4) ``` -------------------------------- ### Automated Mixing Elements with Dynamic Gain (JavaScript) Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/sound-design/mixing-reference.md This snippet demonstrates automated mixing by varying the gain of elements over time using a sine wave LFO. It keeps the bass consistent while dynamically adjusting percussion intensity and chord presence. ```javascript // Automated mixing elements stack( // Bass - stays consistent "*4".note().s('sawtooth').gain(0.8), // Percussion - varies in intensity "hh*16".s('drumkit').gain(sine.slow(4).range(0.5, 1.0)), // Chords - comes and goes // The following line is incomplete in the original text, but demonstrates the concept of dynamic gain for chords. // "*4".note().s('piano').gain(sine.slow(8).range(0, 0.7)) ) ``` -------------------------------- ### Develop Modern House Variation in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/genres/house.md Builds a modern house music pattern incorporating syncopated rhythms, vocal chops, and modulated synth lines. This example showcases contemporary production techniques with complex drum programming and creative use of effects like bit crushing. ```javascript // Modern house with vocal chops stack( // Complex kick pattern "bd(5,8)*2 bd(3,8)*2", // Syncopated hi-hats "hh(7,16)*4", // Percussion layer "cp(3,8)*8 sd*4", // Bass "*4".note().s('sawtooth').cutoff(300).gain(0.7), // Chords "*4".note().s('piano').cutoff(sine.slow(1).range(500,2000)), // Vocal chops "vocal(3,8)*4".s('vocal').crush(8).room(0.3), // Lead synth "*2".fast(4).note().s('square').release(0.2) ) ``` -------------------------------- ### Design Progressive House Build-up in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/genres/house.md Creates a progressive house music build-up pattern that gradually increases in intensity. It starts with a simple foundation and progressively adds elements like claps, snares, and applies effects like fast playback and reverse, culminating in a filter sweep on chords. ```javascript // Progressive house build-up pattern stack( // Simple foundation "bd*4 hh*8", // Gradual addition "bd*4 hh*16 cp*8".every(4, x => x.fast(1.1)), // Energy building "bd*4 hh*16 cp*8 sd*4".every(2, x => x.rev()), // Full energy "bd*4 hh*16 cp*8 sd*4".every(1, x => x.jux(rev)), // Filter sweep "*4".cutoff(env([500,3000,500], [4,2,4]).slow(8)) ) ``` -------------------------------- ### Multi-orbit Routing and Effects in JavaScript Source: https://context7.com/thatsright-itstj/strudel-for-context7/llms.txt Shows how to route musical patterns to different audio processing 'orbits' for applying independent effects. It covers default orbit usage, explicitly setting orbits, applying unique effects to different orbits (e.g., reverb), sending signals to multiple orbits, and an explanation of multi-channel output mode where orbit N maps to channels 2N and 2N+1. ```javascript // Default orbit is 1 s("bd sd") // automatically uses orbit 1 // Specify orbit s("bd sd") .orbit(2) // Different orbits = different effects $: s("triangle*4") .decay(0.5) .n(irand(12)) .scale('C minor') .room(1) .roomsize(10) .orbit(2) // reverb only on orbit 2 $: s("bd*4") .room(0.01) .roomsize(0.01) .postgain(0) .orbit(1) // minimal reverb on orbit 1 // Send to multiple orbits (be careful with volume!) s("white") .orbit("2,3,4") .gain(0.2) // reduce gain when multi-routing // Multi-channel output mode // Enable in Settings > Multi Channel Orbits // Orbit N routes to channels 2N and 2N+1 ``` -------------------------------- ### STRUDEL Migration: Basic Syntax Conversion Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/TIDAL_DIFFERENCES.md Demonstrates fundamental syntax conversions from Tidal Cycles to STRUDEL, including reversing order, replacing '#' with '.', and using method chaining. ```javascript // Tidal: // fast 2 $ s "bd" // STRUDEL: s("bd").fast(2) ``` ```javascript // Tidal: // s "bd" # gain 0.5 // STRUDEL: s("bd").gain(0.5) ``` -------------------------------- ### Jux Effects for Stereo Separation in JavaScript Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/docs-markdown/sound-design/mixing.md This example demonstrates using STRUDEL's `jux` function for stereo separation. It separates a dry kick and snare in the center from a stereo-panned hi-hat and cymbal combination. The `jux` function is applied with a `rev` (reverb) effect and a wetness level of 0.5, creating a sense of width and space. ```javascript // Using jux for stereo separation stack( // Dry center "bd*4 sd*4".s('drumkit'), // Wet stereo sides "hh*16 cp*8".s('drumkit').jux(rev, 0.5) ) ``` -------------------------------- ### Ambient Textures and Harmonic Analysis in STRUDEL Source: https://github.com/thatsright-itstj/strudel-for-context7/blob/main/strudel/reference/theory/harmony-reference.md Shows how to create slow, evolving harmonies for ambient music using sus chords and long release times. Also demonstrates analyzing chord functions within a progression using `.tonal()`. ```javascript // Slow, evolving harmony for ambient textures "*8" .voicing('spread') .s('pad') .release(4) ``` ```javascript // Analyze chord functions "*2" .dict('ireal') .tonal() // Analyze chord tones .scaleTranspose("<0 1 2 3>*2") // Move through scale degrees ```