sourceextensions/audio/demos/synth.xtl
1⍝# A synthesizer made of arrays: X_eTaL computes every sample of a little
2⍝# piece -- notes from equal temperament, harmonics, envelopes, chords,
3⍝# stereo (the instruments are in Instruments.xtl, beside this file) --
4⍝# and the audio extension plays them as they are made.
5⍝# Run: just demo audio synth
6
7ᵃᵘ⁼u̲se< "Audio"
8ⁱⁿ⁼u̲se< "Instruments"
9
10v ← ᵃᵘo̲utput ⁱⁿrate
11
12⍝# play eight bars, each made while the one before is sounding
13ᵘp̲lay ← { b →
14 s ← v ᵃᵘq̲ueue! ⁱⁿb̲ar b
15 w ← v ᵃᵘw̲ait! 0.5
16 b + 1
17}
18last ← 8 'ᵘp̲lay p̲ower 1
19c ← ᵃᵘc̲lose! v
20"played 8 bars (8 seconds), every sample computed in X_eTaL"