Csound Csound-dev Csound-tekno Search About

Re: output sound envelope in image file

Date2017-01-21 11:55
FromAndrea Strappa
SubjectRe: 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>
 
------------------
 
 
 
----- Original Message -----
Sent: Friday, January 20, 2017 10:08 AM
Subject: Re: [Csnd] output sound envelope in image file

Thank you for suggestions.
Andrea S.
 
----- Original Message -----
From: John ff
Sent: Friday, January 20, 2017 1:47 AM
Subject: Re: [Csnd] output sound envelope in image file

It is possible to draw audio as PDF I think.

Sent from TypeApp
On 19 Jan 2017, at 23:39, Steven Yi <stevenyi@GMAIL.COM> wrote:
One thing I've done before is to write my envelope signal to audio output, then opened the wav file in Audacity to view the curves.  

On Thu, Jan 19, 2017 at 6:27 PM, Richard <zappfinger@gmail.com> wrote:

That should be possible. You could write the envelope (presumably k-rate) to a csound table, then export that to a file. From there  you can - with some programming - convert that to an image.

Richard


On 19/01/17 23:40, Andrea Strappa wrote:
Hi list,
Is there a way to write directly output sound envelope in a image file as png, jpg or bmp?
Andrea S.





Avast logo

Questa e-mail è stata controllata per individuare virus con Avast antivirus.
www.avast.com