Showing the changes to examples (1 of 5 files). Show all
Unified · Split
| @@ -0,0 +1,33 @@ | ||
| 1 | +# mainly testing out hold/unhold functionality | |
| 2 | +# one LFO controls the frequency of 4 oscillators | |
| 3 | + | |
| 4 | +# function to create a voice | |
| 5 | +func voice {min max} { | |
| 6 | + osc [regget 0] \ | |
| 7 | + [biscale [regget 1] $min $max] \ | |
| 8 | + [param 0.1] [param 0] | |
| 9 | +} | |
| 10 | + | |
| 11 | +# generate sine table in register 0 | |
| 12 | +regset [gensine [tabnew 8192]] 0 | |
| 13 | + | |
| 14 | +# generate held LFO signal in register 1 | |
| 15 | +regset [hold [osc [regget 0] 0.1 1 0]] 1 | |
| 16 | + | |
| 17 | +# create 4 voices and add them together | |
| 18 | +voice 400 500 | |
| 19 | +voice 400 600 | |
| 20 | +add zz zz | |
| 21 | +voice 400 300 | |
| 22 | +add zz zz | |
| 23 | +voice 400 200 | |
| 24 | +add zz zz | |
| 25 | + | |
| 26 | +# write output to wav file | |
| 27 | +wavout zz "sines.wav" | |
| 28 | + | |
| 29 | +# release LFO signal | |
| 30 | +unhold [regget 1] | |
| 31 | + | |
| 32 | +# compute ~30 seconds of sound | |
| 33 | +computes 30 | |