| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-n ;no sound output |
| 5 |
</CsOptions> |
| 6 |
<CsInstruments> |
| 7 |
|
| 8 |
sr = 44100 |
| 9 |
ksmps = 32 |
| 10 |
0dbfs = 1 |
| 11 |
nchnls = 2 |
| 12 |
|
| 13 |
; by Cesare Marilungo 2008 |
| 14 |
; additions by Menno Knevel 2021 |
| 15 |
; image opcodes need a black canvas- black = no sound! |
| 16 |
|
| 17 |
giimage1 imageload "imageOpcode01.png" ; load this image |
| 18 |
giimagew, giimageh imagesize giimage1 ; get dimensions of imageOpcode01.png |
| 19 |
giimageNEW imagecreate giimagew,giimageh ; and use those same dimensions for the new image |
| 20 |
|
| 21 |
instr 1 ; copies imageOpcode01.png and changes it |
| 22 |
|
| 23 |
kndx = 0 |
| 24 |
kx linseg 0, p3, 1 |
| 25 |
prints "\nwidth = %d pixels, heigth = %d pixels\n\n", giimagew, giimageh |
| 26 |
|
| 27 |
myloop: |
| 28 |
ky = kndx/(giimageh) ; y-axis |
| 29 |
krd, kgn, kbl imagegetpixel giimage1, kx, ky ; get pixels from 'old' image |
| 30 |
imagesetpixel giimageNEW, kx*.9, ky*.5, krd, kgn, kbl; redesign the image |
| 31 |
loop_lt kndx, 0.5, giimageh, myloop |
| 32 |
endin |
| 33 |
|
| 34 |
instr 2 |
| 35 |
imagesave giimageNEW, "imageOUT.png" ; save this new image |
| 36 |
endin |
| 37 |
|
| 38 |
instr 3 |
| 39 |
imagefree giimage1 ; unload images |
| 40 |
imagefree giimageNEW |
| 41 |
endin |
| 42 |
|
| 43 |
</CsInstruments> |
| 44 |
<CsScore> |
| 45 |
|
| 46 |
i1 1 1 |
| 47 |
i2 2 1 |
| 48 |
i3 3 .1 |
| 49 |
e |
| 50 |
</CsScore> |
| 51 |
</CsoundSynthesizer> |
| 52 |
|