Hi, newbie here.
I’ve done this. The long list of numbers is the fist thousand or so numbers in Bell’s Triangle, which I computed using a different language and then copy-pasted into the Sonic Pi code.
I’ll be doing a lot of that - precalculating numbers, as some of the sequences I hope to use could take a very long time to compute, so can’t realistically be done during execution of a Sonic Pi piece. The sequences will typically be a lot longer than the one here.
My question is this - rather than copy-pasting the list, as I have done here, how do I say
`my_variable = <a list of the numbers in the text file bell_numbers.txt>
Here’s the composition. It’s my first ever. Any observations/suggestions are welcome.
bellnums = [
1, 1, 2, 5, 15, 16, 23, 13, 0, 15, 19, 6, 13, 1,
34, 5, 23, 0, 31, 5, 28, 15, 15, 10, 33, 13, 10,
1, 23, 20, 15, 13, 32, 31, 15, 30, 1, 33, 10, 1,
19, 20, 23, 33, 16, 23, 31, 18, 33, 1, 6, 13, 19,
16, 23, 5, 0, 31, 23, 10, 33, 33, 10, 33, 31, 28,
19, 5, 20, 15, 31, 14, 13, 33, 30, 1, 15, 28, 19,
1, 20, 23, 15, 34, 5, 13, 18, 33, 19, 24, 31, 1,
16, 23, 23, 18, 13, 5, 10, 33, 15, 28, 15, 13, 28,
19, 23, 2, 33, 13, 14, 13, 15, 12, 19, 33, 28, 19,
19, 2, 5, 33, 34, 5, 31, 0, 15, 1, 24, 31, 19, 34,
5, 5, 18, 13, 23, 28, 15, 33, 28, 15, 31, 10, 1,
5, 2, 33, 31, 32, 31, 33, 12, 19, 15, 10, 1, 1, 2,
5, 15, 16, 23, 13, 0, 15, 19, 6, 13, 1, 34, 5, 23,
0, 31, 5, 28, 15, 15, 10, 33, 13, 10, 1, 23, 20,
15, 13, 32, 31, 15, 30, 1, 33, 10, 1, 19, 20, 23,
33, 16, 23, 31, 18, 33, 1, 6, 13, 19, 16, 23, 5,
0, 31, 23, 10, 33, 33, 10, 33, 31, 28, 19, 5, 20,
15, 31, 14, 13, 33, 30, 1, 15, 28, 19, 1, 20, 23,
15, 34, 5, 13, 18, 33, 19, 24, 31, 1, 16, 23, 23,
18, 13, 5, 10, 33, 15, 28, 15, 13, 28, 19, 23, 2,
33, 13, 14, 13, 15, 12, 19, 33, 28, 19, 19, 2, 5,
33, 34, 5, 31, 0, 15, 1, 24, 31, 19, 34, 5, 5, 18,
13, 23, 28, 15, 33, 28, 15, 31, 10, 1, 5, 2, 33,
31, 32, 31, 33, 12, 19, 15, 10, 1, 1, 2, 5, 15,
16, 23, 13, 0, 15, 19, 6, 13, 1, 34, 5, 23, 0, 31,
5, 28, 15, 15, 10, 33, 13, 10, 1, 23, 20, 15, 13,
32, 31, 15, 30, 1, 33, 10, 1, 19, 20, 23, 33, 16,
23, 31, 18, 33, 1, 6, 13, 19, 16, 23, 5, 0, 31,
23, 10, 33, 33, 10, 33, 31, 28, 19, 5, 20, 15, 31,
14, 13, 33, 30, 1, 15, 28, 19, 1, 20, 23, 15, 34,
5, 13, 18, 33, 19, 24, 31, 1, 16, 23, 23, 18, 13,
5, 10, 33, 15, 28, 15, 13, 28, 19, 23, 2, 33, 13,
14, 13, 15, 12, 19, 33, 28, 19, 19, 2, 5, 33, 34,
5, 31, 0, 15, 1, 24, 31, 19, 34, 5, 5, 18, 13, 23,
28, 15, 33, 28, 15, 31, 10, 1, 5, 2, 33, 31, 32,
31, 33, 12, 19, 15, 10, 1, 1, 2, 5, 15, 16, 23,
13, 0, 15, 19, 6, 13, 1, 34, 5, 23, 0, 31, 5, 28,
15, 15, 10, 33, 13, 10, 1, 23, 20, 15, 13, 32, 31,
15, 30, 1, 33, 10, 1, 19, 20, 23, 33, 16, 23, 31,
18, 33, 1, 6, 13, 19, 16, 23, 5, 0, 31, 23, 10,
33, 33, 10, 33, 31, 28, 19, 5, 20, 15, 31, 14, 13,
33, 30, 1, 15, 28, 19, 1, 20, 23, 15, 34, 5, 13,
18, 33, 19, 24, 31, 1, 16, 23, 23, 18, 13, 5, 10,
33, 15, 28, 15, 13, 28, 19, 23, 2, 33, 13, 14, 13,
15, 12, 19, 33, 28, 19, 19, 2, 5, 33, 34, 5, 31,
0, 15, 1, 24, 31, 19, 34, 5, 5, 18, 13, 23, 28,
15, 33, 28, 15, 31, 10, 1, 5, 2, 33, 31, 32, 31,
33, 12, 19, 15, 10, 1, 1, 2, 5, 15, 16, 23, 13, 0,
15, 19, 6, 13, 1, 34, 5, 23, 0, 31, 5, 28, 15, 15,
10, 33, 13, 10, 1, 23, 20, 15, 13, 32, 31, 15, 30,
1, 33, 10, 1, 19, 20, 23, 33, 16, 23, 31, 18, 33,
1, 6, 13, 19, 16, 23, 5, 0, 31, 23, 10, 33, 33,
10, 33, 31, 28, 19, 5, 20, 15, 31, 14, 13, 33, 30,
1, 15, 28, 19, 1, 20, 23, 15, 34, 5, 13, 18, 33,
19, 24, 31, 1, 16, 23, 23, 18, 13, 5, 10, 33, 15,
28, 15, 13, 28, 19, 23, 2, 33, 13, 14, 13, 15, 12,
19, 33, 28, 19, 19, 2, 5, 33, 34, 5, 31, 0, 15, 1,
24, 31, 19, 34, 5, 5, 18, 13, 23, 28, 15, 33, 28,
15, 31, 10, 1, 5, 2, 33, 31, 32, 31, 33, 12, 19,
15, 10, 1, 1, 2, 5, 15, 16, 23, 13, 0, 15, 19, 6,
13, 1, 34, 5, 23, 0, 31, 5, 28, 15, 15, 10, 33,
13, 10, 1, 23, 20, 15, 13, 32, 31, 15, 30, 1, 33,
10, 1, 19, 20, 23, 33, 16, 23, 31, 18, 33, 1, 6,
13, 19, 16, 23, 5, 0, 31, 23, 10, 33, 33, 10, 33,
31, 28, 19, 5, 20, 15, 31, 14, 13, 33, 30, 1, 15,
28, 19, 1, 20, 23, 15, 34, 5, 13, 18, 33, 19, 24,
31, 1, 16, 23, 23, 18, 13, 5, 10, 33, 15, 28, 15,
13, 28, 19, 23, 2, 33, 13, 14, 13, 15, 12, 19, 33,
28, 19, 19, 2, 5, 33, 34, 5, 31, 0, 15, 1, 24, 31,
19, 34, 5, 5, 18, 13, 23, 28, 15, 33, 28, 15, 31,
10, 1, 5, 2, 33, 31, 32, 31, 33, 12, 19, 15, 10,
1, 1, 2, 5, 15, 16, 23, 13, 0, 15, 19, 6, 13, 1,
34, 5, 23, 0, 31, 5, 28, 15, 15, 10, 33, 13, 10,
1, 23, 20, 15, 13, 32, 31, 15, 30, 1, 33, 10, 1 ]
use_synth :pretty_bell
with_fx :bitcrusher do
live_loop :blah do
y = bellnums[tick]
if y == nil then
stop
end
play y+36
sleep ((y % 2)/2+0.5)/4
end
end
Thanks, Gordon