Re: output sound envelope in image file
Date | 2017-01-21 11:55 | ||
From | Andrea Strappa | ||
Subject | Re: output sound envelope in image file | ||
Hi list,
I found a way: image opcodes by Cesare
Marilungo.
Three questions:
1) How could I draw directly black lines on white
background instead white to black?
2) Why I must write
ax line 1, p3, 0
instead
ax line 0, p3, 1
if I desire reading from left to
right?
3) How could I draw lines more thick?
These opcodes can be useful for chrono-proportional
notation score (series of i-time png lines) or graphical
explications.
I send two csd test.
Greetings
Andrea S.
-------------
<CsoundSynthesizer>
<CsOptions> -n </CsOptions> <CsInstruments> sr=44100 ksmps=1 nchnls=2 0dbfs=1 giw = 1000
gih = 100 gimage1 imagecreate giw, gih ;larghezza e altezza in pixel dell'immagine creata giimagew, giimageh imagesize gimage1 gisine ftgen 1, 0, 16384, 10, 1 ;sine wave instr 1
;asig soundin "eterodina.wav" ;ay follow asig, .01 ay poscil .5, 1/p3,
gisine
ay = ay + .5 ax line 1, p3, 0 ;why 1 to 0 instead 0
to 1?
;ay line 1, p3, 0 imagesetpixel gimage1, ax, ay, 1, 1, 1 endin instr 2
imagesave gimage1, "C:\Andrea\csound\prove_varie\image_prova_02.png" endin </CsInstruments> <CsScore>
i1 0 1 i2 1 1 e </CsScore> </CsoundSynthesizer> ---------------
<CsoundSynthesizer>
<CsOptions> -n ;-odac ;-odac streaming don't works properly with image opcodes </CsOptions> <CsInstruments> sr=44100 ksmps=1 nchnls=2 0dbfs=1 gasig init 0
iimgw = 1000 ;image width in pixel iimgh = 100 ;image high in pixel gimage1 imagecreate iimgw, iimgh giimagew, giimageh imagesize gimage1 ;gisine ftgen 1, 0, 16384, 10, 1 ;sine wave instr 1
ifreq = cpspch(p4) kintvl expseg 1, p3*.5, .2, p3*.5,
1
asig mpulse 1, kintvl gasig reson asig, ifreq, 50 out gasig * .04 endin instr 2
ax line 1, p3, 0 ;why 1 to 0 instead 0 to 1? ;isine ftgen 1, 0, 16384, 10, 1 ;sine wave ;ay poscil .5, 1/p3, isine ;ay = ax + .5 ;Tsyn ;asig soundin
"eterodina.wav"
;ay follow asig, .01 ;envelope ay follow gasig, .0001 ;instr out
profile
;ay line 1, p3,
0
imagesetpixel gimage1, ax, ay, 1, 1, 1 ;imagesetpixel gimage1, ax+1, ay+1, 1, 1, 1 ;imagesetpixel gimage1, ax-1, ay-1, 1, 1, 1 ;loop_lt kndx, 0.5, giimageh, myloop endin instr 3
imagesave gimage1, "C:\Andrea\csound\prove_varie\image_prova_05.png" endin </CsInstruments> <CsScore>
; Play Instrument #1 for 4 seconds. i1 0 5 8.00 i2 0 5 i3 5 2 e </CsScore> </CsoundSynthesizer> ------------------
|