-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmessiaen.lua
executable file
·856 lines (783 loc) · 27.5 KB
/
messiaen.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
--- messiaen v1.0 @fellowfinch
--- @sonoCircuit GUI @mechtai.
--- llllllll.co/t/url
---
--- "birds are the first and
--- the greatest performers"
--- -Messiaen
--- .--. .--.
--- ." o \__ __/ . ".
--- _.-" / \. "-._.
----" ) ( "_
--- ▼▼▼ instructions below ▼▼▼
---
--- E1 change that bird!
--- E2 bird mood
--- E3 chirp volume
---
--- K1 combo
--- K2 it sings
--- K3 it flips
--- K1+K2 toggle garden
--- K1+K3 toggle info
---
--- play something for the bird
--- and the active bird shall
--- listen )))
--- make it sing by pressing K2.
---
--libs req
_flt = require 'filters'
bird = include 'lib/birds'
-------- VARIABLES --------
-- constants
REC_LOOP_SIZE = 60
MAX_SEED_LENGTH = 2
FADE_TIME = 0.01
MAX_BUFFER = 350
NUM_BIRDS = 4
-- UI variables
info = false
k1_pressed = false
is_memorizing = false
-- bird variables
bird_params = {"main_bird", "visitor_1", "visitor_2", "visitor_3"}
bird_param_names = {"main bird", "visitor 1", "visitor 2", "visitor 3"}
main_bird = 1
separation = 2.2
bird_to_feed = 0
global_level = 1
bird_voice = {}
for i = 1, NUM_BIRDS do
bird_voice[i] = {}
bird_voice[i].name = ""
bird_voice[i].key = ""
-- levels
bird_voice[i].level = 0
bird_voice[i].pan = 0
bird_voice[i].cutoff = 18500
-- playback
bird_voice[i].pos = (REC_LOOP_SIZE + 1) + (MAX_SEED_LENGTH + 1) * (i - 1)
bird_voice[i].loop_size = 0.5
-- activity
bird_voice[i].active = false
bird_voice[i].clock = nil
-- temp storage
bird_voice[i].prev_pan = 0
bird_voice[i].prev_cutoff = 18500
bird_voice[i].prev_loop_size = 0.5
end
-- movement variables
auto_position = false
birds_moving = false
-- seed variables (rec voice)
seed_voice = 5
seed_voice_pos = 1
threshold_upper = 0
threshold_lower = 0
thresh_armed = false
-- forest variables (ambient voice)
forest_voice = 6
forest_level = 0.2
forest_is_planted = true
garden_is_planted = false
default_forest = "/home/we/dust/audio/hermit_leaves.wav"
-------- FUNCTIONS --------
-- the ultimate ultra super bird clocking function!
function play_birdsongs(bird_num, bird_tab)
local bird_num = bird_num or 1
while true do
local birdsong = bird_tab[math.random(1, #bird_tab)]
-- play notes
for i = 1, #birdsong do
local current_note = birdsong[i]
local rate = math.pow(2, current_note.r / 12) * 3
local level = current_note.l * bird_voice[bird_num].level * global_level
softcut.rate_slew_time(bird_num, current_note.pb)
softcut.rate(bird_num, rate)
softcut.level_slew_time(bird_num, current_note.ft + 0.2)
softcut.level(bird_num, level)
clock.sleep(current_note.d)
end
softcut.level(bird_num, 0)
softcut.rate_slew_time(bird_num, 0)
softcut.level_slew_time(bird_num, 0.2)
clock.sleep(math.random(1) + separation)
end
end
function get_pos(i, pos)
seed_voice_pos = pos - FADE_TIME
end
function grab_seed()
softcut.query_position(seed_voice)
is_memorizing = true
dirtyscreen = true
clock.run(function()
clock.sleep(MAX_SEED_LENGTH)
if (feed_mode == 1 or not garden_is_planted) then
for i = 1, 4 do
softcut.buffer_copy_mono(1, 1, seed_voice_pos, bird_voice[i].pos, MAX_SEED_LENGTH, FADE_TIME)
end
elseif feed_mode == 2 then
bird_to_feed = util.wrap(bird_to_feed + 1, 1, 4)
softcut.buffer_copy_mono(1, 1, seed_voice_pos, bird_voice[bird_to_feed].pos, MAX_SEED_LENGTH, FADE_TIME)
elseif feed_mode == 3 then
local bird_num = math.random(1, 4)
softcut.buffer_copy_mono(1, 1, seed_voice_pos, bird_voice[bird_num].pos, MAX_SEED_LENGTH, FADE_TIME)
end
is_memorizing = false
dirtyscreen = true
end)
end
function set_softcut_input(option)
if option == 1 or option > 3 then -- summed
softcut.level_input_cut(1, seed_voice, 0.707)
softcut.level_input_cut(2, seed_voice, 0.707)
elseif option == 2 then -- L IN
softcut.level_input_cut(1, seed_voice, 1)
softcut.level_input_cut(2, seed_voice, 0)
elseif option == 3 then -- R IN
softcut.level_input_cut(1, seed_voice, 0)
softcut.level_input_cut(2, seed_voice, 1)
end
end
function save_bird_params()
for i = 1, 4 do
bird_voice[i].prev_loop_size = bird_voice[i].loop_size
bird_voice[i].prev_pan = bird_voice[i].pan
bird_voice[i].prev_cutoff = bird_voice[i].cutoff
end
end
function restore_bird_params()
for i = 1, 4 do
params:set(bird_params[i].."_mood", bird_voice[i].prev_loop_size)
params:set(bird_params[i].."_pan", bird_voice[i].prev_pan)
params:set(bird_params[i].."_cutoff", bird_voice[i].prev_cutoff)
end
end
function rnd_bird_params()
for i = 1, 4 do
params:set(bird_params[i].."_mood", math.random())
params:set(bird_params[i].."_pan", math.random(-10, 10) / 10)
params:set(bird_params[i].."_cutoff", math.random())
end
end
function call_bird(bird_num, bird_tab)
if bird_voice[bird_num].clock ~= nil then
clock.cancel(bird_voice[bird_num].clock)
end
bird_voice[bird_num].clock = clock.run(play_birdsongs, bird_num, bird_tab)
bird_voice[bird_num].active = true
end
function silent_bird(bird_num)
if bird_voice[bird_num].clock ~= nil then
clock.cancel(bird_voice[bird_num].clock)
end
softcut.level(bird_num, 0)
softcut.rate(bird_num, 1)
bird_voice[bird_num].active = false
end
function change_bird(bird_num, idx)
bird_voice[bird_num].name = bird.names[idx]
bird_voice[bird_num].key = bird.keys[idx]
if bird_voice[bird_num].active then
call_bird(bird_num, bird[bird_voice[bird_num].key])
end
dirtyscreen = true
end
function toggle_garden()
if garden_is_planted then
save_bird_params()
-- call birds
call_bird(main_bird, bird[bird_voice[main_bird].key])
call_visitors_clock = clock.run(function()
for bird_num = 2, 4 do
clock.sleep(math.random(2, 8))
call_bird(bird_num, bird[bird_voice[bird_num].key])
end
end)
if auto_position then rnd_bird_params() end
else
-- silent birds
if call_visitors_clock ~= nil then
clock.cancel(call_visitors_clock)
end
for bird_num = 1, 4 do
silent_bird(bird_num)
end
if auto_position then restore_bird_params() end
end
end
-- set the birds free
function trig_bird_movement()
while true do
clock.sleep(1)
if auto_position and garden_is_planted then
if math.random(0, 100) < bird_movement_prob then
move_birds()
end
end
end
end
--bird activity
function move_birds()
if birds_moving == false then
birds_moving = true
clock.run(function()
local num = 0
local new_position
local new_distance
while birds_moving do
num = num + 1
-- set values
if num == 1 then
new_position = math.random(-10, 10) / 10
new_distance = math.random()
elseif num == 2 then
local pos_min = bird_voice[num - 1].pan < 0 and 0 or -10
local pos_max = bird_voice[num - 1].pan > 0 and 0 or 10
new_position = math.random(pos_min, pos_max) / 10
new_distance = math.random()
else
local pos_min = bird_voice[num - 1].pan < 0 and 0 or -10
local pos_max = bird_voice[num - 1].pan > 0 and 0 or 10
local dis_min = bird_voice[num - 1].cutoff < 0.5 and 0 or 5
local dis_max = bird_voice[num - 1].cutoff > 0.5 and 10 or 5
new_position = math.random(pos_min, pos_max) / 10
new_distance = math.random(dis_min, dis_max) / 10
end
-- set params
softcut.pan_slew_time(num, math.random(0, 20) / 10)
params:set(bird_params[num].."_pan", new_position)
params:set(bird_params[num].."_cutoff", new_distance)
clock.sleep(math.random(2, 10) / 10) -- sleep between 0.2s and 1s
-- reset pan slew
softcut.pan_slew_time(num, 0)
-- check progress and flip bool
if num == 4 then birds_moving = false end
end
end)
end
end
function load_audio(path)
if path ~= "cancel" and path ~= "" then
local ch, len = audio.file_info(path)
if ch > 0 and len > 0 then
softcut.buffer_clear_channel(2)
softcut.buffer_read_mono(path, 0, 1, -1, 1, 2, 0, 1)
local l = math.min(len / 48000, MAX_BUFFER)
softcut.loop_start(forest_voice, 1)
softcut.loop_end(forest_voice, 1 + l)
print("file loaded: "..path.." is "..l.."s")
else
params:set("plant_forest", 1)
params:set("load_forest", "")
print("not a sound file")
end
end
end
function set_forest_level()
if forest_is_planted then
softcut.level(forest_voice, forest_level)
else
softcut.level(forest_voice, 0)
end
end
---------- init function -----------
function init()
-- sofcut setup
audio.level_adc_cut(1)
audio.level_eng_cut(1)
audio.level_tape_cut(0)
softcut.buffer_clear()
for i = 1, NUM_BIRDS do
softcut.enable(i, 1)
softcut.buffer(i, 1)
softcut.level(i, 0)
softcut.pan(i, 0)
softcut.rate(i, 1.0)
softcut.loop(i, 1)
softcut.loop_start(i, bird_voice[i].pos)
softcut.loop_end(i, bird_voice[i].pos + bird_voice[i].loop_size)
softcut.position(i, bird_voice[i].pos)
softcut.play(i, 1)
softcut.fade_time(i, FADE_TIME)
-- slew
softcut.level_slew_time(i, 0.2)
softcut.pan_slew_time(i, 0.1)
softcut.rate_slew_time(i, 0)
-- filter
softcut.post_filter_dry(i, 0)
softcut.post_filter_lp(i, 1)
softcut.post_filter_fc(i, bird_voice[i].cutoff)
softcut.post_filter_rq(i, 2)
end
-- softcut recording
softcut.enable(seed_voice, 1)
softcut.buffer(seed_voice, 1)
-- route adc to seed_voice
softcut.level_input_cut(1, seed_voice, 1.0)
softcut.level_input_cut(2, seed_voice, 1.0)
-- enable rec and play
softcut.rec(seed_voice, 1)
softcut.play(seed_voice, 1)
-- set levels
softcut.level(seed_voice, 0)
softcut.pan(seed_voice, 0)
softcut.rec_level(seed_voice, 1)
softcut.pre_level(seed_voice, 0)
-- set loop
softcut.rate(seed_voice, 1)
softcut.loop(seed_voice, 1)
softcut.loop_start(seed_voice, 1)
softcut.loop_end(seed_voice, 5)
softcut.position(seed_voice, 1)
softcut.fade_time(seed_voice, FADE_TIME)
-- forest playback
softcut.enable(forest_voice, 1)
softcut.buffer(forest_voice, 2)
softcut.level(forest_voice, 0)
softcut.rate(forest_voice, 1)
softcut.loop(forest_voice, 1)
softcut.loop_start(forest_voice, 0)
softcut.loop_end(forest_voice, MAX_BUFFER)
softcut.position(forest_voice, 1)
softcut.play(forest_voice, 1)
softcut.fade_time(forest_voice, 0.01)
-- callbacks
softcut.event_position(get_pos)
-- bird voice parameters
params:add_separator("bird_voicing", "birds")
params:add_control("global_level", "main level", controlspec.new(0, 1, 'lin', 0, 1), function(param) return (round_form(util.linlin(0, 1, 0, 100, param:get()), 1, "%")) end)
params:set_action("global_level", function(val) global_level = val end)
for i = 1, 4 do
params:add_group(bird_params[i], bird_param_names[i], 5)
params:add_option(bird_params[i].."_active", "bird", bird.names, i)
params:set_action(bird_params[i].."_active", function (idx) change_bird(i, idx) end)
params:add_control(bird_params[i].."_level", "level", controlspec.new(0, 1, 'lin', 0, 0.4), function(param) return (round_form(util.linlin(0, 1, 0, 100, param:get()), 1, "%")) end)
params:set_action(bird_params[i].."_level", function(val) bird_voice[i].level = val dirtyscreen = true end)
params:add_control(bird_params[i].."_mood", "mood", controlspec.new(0.01, 1, 'lin', 0, 0.38), function(param) return (round_form(util.linlin(0.01, 1, 0, 100, param:get()), 1, "%")) end)
params:set_action(bird_params[i].."_mood", function(val) bird_voice[i].loop_size = val softcut.loop_end(i, bird_voice[i].pos + bird_voice[i].loop_size) end)
params:add_control(bird_params[i].."_pan", "position", controlspec.new(-1, 1, 'lin', 0, 0, ""), function(param) return pan_display(param:get()) end)
params:set_action(bird_params[i].."_pan", function(val) bird_voice[i].pan = val softcut.pan(i, val) end)
params:add_control(bird_params[i].."_cutoff", "distance", controlspec.new(0, 1, 'lin', 0, 0.4), function(param) return (round_form(util.linlin(0, 1, 0, 100, param:get()), 1, "%")) end)
params:set_action(bird_params[i].."_cutoff", function(x) local freq = util.linexp(0, 1, 20000, 400, x) bird_voice[i].cutoff = freq softcut.post_filter_fc(i, freq) end)
end
-- rec parameters
params:add_separator("bird_rec", "recording")
params:add_option("input_source", "input source", {"sum l+r", "mono l", "mono r"}, 1)
params:set_action("input_source", function(option) set_softcut_input(option) end)
params:add_control("rec_threshold", "threshold", controlspec.new(-20, 0, 'lin', 0, -18, "dB"))
params:set_action("rec_threshold", function(val)
threshold_upper = util.round((util.dbamp(val) / 10), 0.01)
threshold_lower = threshold_upper * 0.6
end)
-- garden parameters
params:add_separator("garden", "garden")
params:add_option("invite_birds", "invite friends", {"no", "yes"}, 1)
params:set_action("invite_birds", function(val) garden_is_planted = val == 2 and true or false toggle_garden() end)
params:add_option("position_birds", "birds position", {"manual", "auto"}, 1)
params:set_action("position_birds", function(mode) auto_position = mode == 2 and true or false build_menu() end)
params:add_control("bird_activity", "bird activity", controlspec.new(0, 1, 'lin', 0, 0), function(param) return (round_form(param:get() * 100, 1, "%")) end)
params:set_action("bird_activity", function(val) bird_movement_prob = val * 100 end)
params:add_control("bird_talk", "song density", controlspec.new(0, 5, 'lin', 0, 2), function(param) return (round_form(util.linlin(0, 5, 0, 100, param:get()), 1, "%")) end)
params:set_action("bird_talk", function(val) separation = 7.2 - val end)
params:add_option("feed_birds", "feed birds", {"simultanious", "sequential", "random"}, 1)
params:set_action("feed_birds", function(val) feed_mode = val end)
-- forest parameters
params:add_separator("forest_params", "forest")
params:add_file("load_forest", "> select forest", "")
params:set_action("load_forest", function(path) load_audio(path) end)
params:add_option("plant_forest", "plant?", {"no", "yes"}, 2) --dont want to have the enviroment playing from the get go? change the "2" to "1"
params:set_action("plant_forest", function(val) forest_is_planted = val == 2 and true or false softcut.position(forest_voice, 1) set_forest_level() end)
params:add_control("forest_level", "intensity", controlspec.new(0, 1, 'lin', 0, 0.3), function(param) return (round_form(util.linlin(0, 1, 0, 100, param:get()), 1, "%")) end)
params:set_action("forest_level", function(val) forest_level = val set_forest_level() end)
params:bang()
params:set("load_forest", default_forest)
-- metros
screenredrawtimer = metro.init(function() screen_redraw() end, 1/15, -1)
screenredrawtimer:start()
-- clocks
clock.run(trig_bird_movement)
-- setup smoothing for amp poll
get_mean = _flt.mean.new(10)
-- threshold rec poll
amp_in = {}
amp_src = {"amp_in_l", "amp_in_r"}
amp_prev_level = 0
threshold_reached = false
for ch = 1, 2 do
amp_in[ch] = poll.set(amp_src[ch])
amp_in[ch].time = 1/100
amp_in[ch].callback = function(val)
local amp_level = get_mean:next(util.round(val, 0.01))
if amp_level > threshold_upper and not threshold_reached and thresh_armed then
threshold_reached = true
grab_seed()
amp_prev_level = amp_level
elseif amp_level < threshold_lower then
threshold_reached = false
end
end
amp_in[ch]:start()
end
-- end of init
end
-------- UI --------
function enc(n, d)
if garden_is_planted then
if n == 1 then
params:delta("global_level", d)
elseif n == 2 then
params:delta("main_bird_pan", d)
params:delta("visitor_1_pan", -d)
params:delta("visitor_2_pan", d * 0.5)
params:delta("visitor_3_pan", -d * 0.5)
elseif n == 3 then
params:delta("bird_talk", d)
end
else
if n == 1 then
params:delta("main_bird_active", d)
end
if k1_pressed then
if n == 2 then
params:delta("main_bird_cutoff", d)
elseif n == 3 then
params:delta("main_bird_pan", d)
end
else
if n == 2 then
params:delta("main_bird_mood", d)
elseif n == 3 then
params:delta("main_bird_level", d)
end
end
end
dirtyscreen = true
end
function key(n, z)
if n == 1 then
k1_pressed = z == 1 and true or false
end
if n == 2 and z == 1 then
if k1_pressed then
params:set("invite_birds", garden_is_planted and 1 or 2)
else
if garden_is_planted then
move_birds()
else
if bird_voice[main_bird].active then
silent_bird(main_bird)
else
call_bird(main_bird, bird[bird_voice[main_bird].key])
end
end
end
elseif n == 3 and z == 1 then
if k1_pressed then
info = not info
else
thresh_armed = not thresh_armed
end
end
dirtyscreen = true
end
function redraw()
screen.clear()
screen.level(15)
if garden_is_planted then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/garden.png", 0, 0)
if thresh_armed then
screen.level(is_memorizing and 15 or 1)
screen.font_size(16)
screen.move(62, 18)
screen.text_center(">)(<")
end
else
local name_e2 = k1_pressed and "distance" or "mood"
local value_e2 = k1_pressed and params:string("main_bird_cutoff") or params:string("main_bird_mood")
local name_e3 = k1_pressed and "position" or "chirp"
local value_e3 = k1_pressed and params:string("main_bird_pan") or params:string("main_bird_level")
screen.font_size(8)
screen.move(2, 50)
screen.text(name_e2)
screen.move(126, 50)
screen.text_right(name_e3)
screen.level(4)
screen.move(2, 60)
screen.text(value_e2)
screen.move(126, 60)
screen.text_right(value_e3)
if bird_voice[main_bird].active and not info then
screen.level(15)
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/note.png", 98, 20)
end
if thresh_armed and not info then
screen.level(is_memorizing and 15 or 1)
screen.font_size(22)
screen.move(108, 30)
screen.text("(")
screen.font_size(14)
screen.move(116, 28)
screen.text("(")
screen.font_size(10)
screen.move(121, 27)
screen.text("(")
end
screen.level(15)
screen.font_size(8)
if bird_voice[main_bird].name == "weird" then --future concept
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/weird1.png", 38, 18)
screen.move(65, 10)
screen.text_center("weird boi")--future concept
elseif bird_voice[main_bird].name == "awesomebird" then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/awesome1.png", 38, 18)
screen.move(65, 10)
screen.text_center("good boi")--future concept
elseif bird_voice[main_bird].name =="green finch" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greenfinch_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("green")
screen.move(50,21)
screen.text("finch")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("this little singer")
screen.move(50,40)
screen.text("is characterized")
screen.move(0,50)
screen.text("by its melodious mellow trills")
screen.move(0,60)
screen.text("and a slow wheeze like dweez.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greenfinch_sin.png", -2, 6)
screen.move(65, 10)
screen.text_center("greenfinch")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greenfinch1.png",-2, 6)
screen.move(65, 10)
screen.text_center("greenfinch")
end
elseif bird_voice[main_bird].name == "willow warbler" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/willowwarbler_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("willow")
screen.move(50,21)
screen.text("warbler")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("gentle cascades")
screen.move(50,40)
screen.text("with a downward")
screen.move(0,50)
screen.text("melody and a calm but careful")
screen.move(0,60)
screen.text("sounding fragility to its voice.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/willowwarbler_sin.png", 0, 8)
screen.move(65, 10)
screen.text_center("willow warbler")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/willowwarbler1.png", 0, 8)
screen.move(65, 10)
screen.text_center("willow warbler")
end
elseif bird_voice[main_bird].name =="great tit" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greattit_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("great")
screen.move(50,21)
screen.text("tit")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("blessed with a big")
screen.move(50,40)
screen.text("repertoire, yet is")
screen.move(0,50)
screen.text("most known for its signature")
screen.move(0,60)
screen.text("couplets of sweet tee-cher!")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greattit_sin.png", -8, 6)
screen.move(65, 10)
screen.text_center("great tit")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/greattit1.png", -8, 6)
screen.move(65, 10)
screen.text_center("great tit")
end
elseif bird_voice[main_bird].name =="chaffinch" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/chaffinch_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("chaffinch")
screen.move(50,20)
screen.font_size(8)
screen.font_face(1)
screen.text("jigs and")
screen.move(50,30)
screen.text("squibbles with")
screen.move(50,40)
screen.text("a downward pull")
screen.move(0,50)
screen.text("chaffinch is confident with")
screen.move(0,60)
screen.text("its bold & theatrical ending.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/chaffinch_sin.png",0, 8)
screen.move(65, 10)
screen.text_center("chaffinch")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/chaffinch1.png", 0, 8)
screen.move(65, 10)
screen.text_center("chaffinch")
end
elseif bird_voice[main_bird].name == "robin" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/robin_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("european")
screen.move(50,21)
screen.text("robin")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("its scrible and")
screen.move(50,40)
screen.text("doodle like")
screen.move(0,50)
screen.text("melodies are heard loudly")
screen.move(0,60)
screen.text("in the calmness of winter.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/robin_sin.png", 0, 8)
screen.move(65, 10)
screen.text_center("european robin")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/robin1.png", 0, 8)
screen.move(65, 10)
screen.text_center("european robin")
end
elseif bird_voice[main_bird].name == "blackbird" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/blackbird_info.png", 0, 0)
screen.move(50,9)
screen.font_size(11)
screen.font_face(15)
screen.text("eurasian")
screen.move(50,21)
screen.text("blackbird")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("soundtrack to")
screen.move(50,40)
screen.text("summer, this bird")
screen.move(0,50)
screen.text("can improvise with a large")
screen.move(0,60)
screen.text("catalogue of complex beauty.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/blackbird_sin.png", 8, 8)
screen.move(65, 10)
screen.text_center("eurasian blackbird")
elseif info == false then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/blackbird1.png", 8, 8)
screen.move(65, 10)
screen.text_center("eurasian blackbird")
end
elseif bird_voice[main_bird].name == "wren" then
if info == true then
screen.clear()
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/wren_info.png", 0, 0)
screen.move(50,10)
screen.font_size(11)
screen.font_face(15)
screen.text("eurasian")
screen.move(50,20)
screen.text("wren")
screen.move(50,30)
screen.font_size(8)
screen.font_face(1)
screen.text("although small")
screen.move(50,40)
screen.text("in size the wren")
screen.move(0,50)
screen.text("is loud. full of trills and long")
screen.move(0,60)
screen.text("verses with rapid-fire bursts.")
elseif info == false and bird_voice[main_bird].active == true then
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/wren_sin.png", 0, 8)
screen.move(65, 10)
screen.text_center("eurasian wren")
else
screen.display_png(_path.code .. "/messiaen/assets/brd_pngs/wren1.png", 0,8)
screen.move(65, 10)
screen.text_center("eurasian wren")
end
end
end
screen.update()
end
-------- UTILITIES --------
function r()
norns.script.load(norns.state.script)
end
function round_form(param, quant, form)
return(util.round(param, quant)..form)
end
function pan_display(param)
local pos_right = ""
local pos_left = ""
if param < -0.01 then
pos_right = ""
pos_left = "L< "
elseif param > 0.01 then
pos_right = " >R"
pos_left = ""
else
pos_right = "<"
pos_left = ">"
end
return (pos_left..math.abs(util.round(util.linlin(-1, 1, -100, 100, param), 1))..pos_right)
end
function build_menu()
if auto_position then
params:show("bird_activity")
else
params:hide("bird_activity")
end
_menu.rebuild_params()
end
function screen_redraw()
if dirtyscreen then
redraw()
dirtyscreen = false
end
end
function cleanup()
print("cleaned up all the bird poop")
end