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 | ||
| @@ -0,0 +1,41 @@ | |||
| 1 | #include <stdlib.h> | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <string.h> | ||
| 4 | #include "lil/lil.h" | ||
| 5 | #include "patchwerk/patchwerk.h" | ||
| 6 | #include "core.h" | ||
| 7 | #include "sklil.h" | ||
| 8 | |||
| 9 | static lil_value_t hold(lil_t lil, size_t argc, lil_value_t *argv) | ||
| 10 | { | ||
| 11 | sk_core *core; | ||
| 12 | int rc; | ||
| 13 | |||
| 14 | core = lil_get_data(lil); | ||
| 15 | |||
| 16 | rc = sk_core_hold(core); | ||
| 17 | |||
| 18 | SKLIL_ERROR_CHECK(lil, rc, "hold didn't work out."); | ||
| 19 | |||
| 20 | return NULL; | ||
| 21 | } | ||
| 22 | |||
| 23 | static lil_value_t unhold(lil_t lil, size_t argc, lil_value_t *argv) | ||
| 24 | { | ||
| 25 | sk_core *core; | ||
| 26 | int rc; | ||
| 27 | |||
| 28 | core = lil_get_data(lil); | ||
| 29 | |||
| 30 | rc = sk_core_hold(core); | ||
| 31 | |||
| 32 | SKLIL_ERROR_CHECK(lil, rc, "unhold didn't work out."); | ||
| 33 | |||
| 34 | return NULL; | ||
| 35 | } | ||
| 36 | |||
| 37 | void sklil_load_buffer(lil_t lil) | ||
| 38 | { | ||
| 39 | lil_register(lil, "hold", hold); | ||
| 40 | lil_register(lil, "unhold", unhold); | ||
| 41 | } | ||
| @@ -0,0 +1 @@ | |||
| 1 | OBJ+=nodes/buffer/buffer.o | ||
| @@ -8,3 +8,4 @@ include nodes/tabnew/config.mk · 7 unmodified lines | |||
| 8 | include nodes/gensine/config.mk | 8 | include nodes/gensine/config.mk |
| 9 | include nodes/osc/config.mk | 9 | include nodes/osc/config.mk |
| 10 | include nodes/reg/config.mk | 10 | include nodes/reg/config.mk |
| 11 | include nodes/buffer/config.mk | ||
| @@ -15,6 +15,7 @@ void sklil_load_tabnew(lil_t lil); · 14 unmodified lines | |||
| 15 | void sklil_load_gensine(lil_t lil); | 15 | void sklil_load_gensine(lil_t lil); |
| 16 | void sklil_load_osc(lil_t lil); | 16 | void sklil_load_osc(lil_t lil); |
| 17 | void sklil_load_reg(lil_t lil); | 17 | void sklil_load_reg(lil_t lil); |
| 18 | void sklil_load_buffer(lil_t lil); | ||
| 18 | 19 | ||
| 19 | void sklil_nodes(lil_t lil) | 20 | void sklil_nodes(lil_t lil) |
| 20 | { | 21 | { |
| @@ -28,6 +29,7 @@ void sklil_nodes(lil_t lil) · 7 unmodified lines | |||
| 28 | sklil_load_gensine(lil); | 29 | sklil_load_gensine(lil); |
| 29 | sklil_load_osc(lil); | 30 | sklil_load_osc(lil); |
| 30 | sklil_load_reg(lil); | 31 | sklil_load_reg(lil); |
| 32 | sklil_load_buffer(lil); | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | static lil_value_t computes(lil_t lil, size_t argc, lil_value_t *argv) | 35 | static lil_value_t computes(lil_t lil, size_t argc, lil_value_t *argv) |