/usr/share/doc/csound/examples/lua_scoregen.csd is in csound 1:6.10.0~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <CsoundSynthesizer>
<CsInstruments>
sr = 48000
ksmps = 100
nchnls = 2
; Lua code to generate a score in the orchestra header.
lua_exec "print(2+2)"
lua_exec {{
local ffi = require("ffi")
local math = require("math")
local string = require("string")
local csoundApi = ffi.load('csound64')
-- Declare the parts of the Csound API that we need.
ffi.cdef[[
int csoundGetKsmps(void *);
double csoundGetSr(void *);
int csoundInputMessage(void *, const char *message);
]]
-- Print that we have acquired the global Csound object.
print('csound:', csound)
-- Prove that the Csound API and object are working.
print('sr:', csoundApi.csoundGetSr(csound))
-- Compute a score using the logistic equation.
local c = .93849
local y = 0.5
local y1 = 0.5
local interval = 0.125
local duration = 0.5
local insno = 1
local scoretime = 0.5
for i = 1, 200 do
scoretime = scoretime + interval
y1 = c * y * (1 - y) * 4
y = y1
local key = math.floor(36 + y * 60)
local velocity = 80
-- Format each iteration of the logistic equation as a Csound score event and schedule it.
local message = string.format('i %d %9.4f %9.4f %9.4f %9.4f', insno, scoretime, duration, key, velocity)
print(message)
csoundApi.csoundInputMessage(csound, message)
end
}}
instr 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Simple FM instrument.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
khz = cpsmidinn(p4)
kamplitude = ampdb(p5) * 0.1
kcarrier = 1
kmodulator = 1.44
; Intensity sidebands.
kindex line 0, p3, 20
isine ftgenonce 1, 0, 16384, 10, 1
asignal foscili kamplitude, khz, kcarrier, kmodulator, kindex, isine
outs asignal, asignal
endin
</CsInstruments>
<CsScore>
f 0 35
</CsScore>
</CsoundSynthesizer>
<bsbPanel>
<label>Widgets</label>
<objectName/>
<x>100</x>
<y>100</y>
<width>320</width>
<height>240</height>
<visible>true</visible>
<uuid/>
<bgcolor mode="nobackground">
<r>255</r>
<g>255</g>
<b>255</b>
</bgcolor>
</bsbPanel>
<bsbPresets>
</bsbPresets>
|