/usr/share/doc/csound/examples/lua_scoregen.csd is in csound 1:5.17.6~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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | <CsoundSynthesizer>
<CsInstruments>
sr = 48000
ksmps = 100
nchnls = 2
; Lua code to generate a score in the orchestra header.
lua_exec {{
local ffi = require("ffi")
local math = require("math")
local string = require("string")
local csoundApi = ffi.load('C:\\utah\\opt\\Csound\\bin\\csound64.dll')
-- 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>
e 4.0
</CsScore>
</CsoundSynthesizer>
<bsbPanel>
<label>Widgets</label>
<objectName/>
<x>0</x>
<y>0</y>
<width>30</width>
<height>105</height>
<visible>true</visible>
<uuid/>
<bgcolor mode="nobackground">
<r>231</r>
<g>46</g>
<b>255</b>
</bgcolor>
<bsbObject version="2" type="BSBVSlider">
<objectName>slider1</objectName>
<x>5</x>
<y>5</y>
<width>20</width>
<height>100</height>
<uuid>{930dd6dd-5342-4be2-969c-8a8e68d109c4}</uuid>
<visible>true</visible>
<midichan>0</midichan>
<midicc>-3</midicc>
<minimum>0.00000000</minimum>
<maximum>1.00000000</maximum>
<value>0.00000000</value>
<mode>lin</mode>
<mouseControl act="jump">continuous</mouseControl>
<resolution>-1.00000000</resolution>
<randomizable group="0">false</randomizable>
</bsbObject>
</bsbPanel>
<bsbPresets>
</bsbPresets>
|