[Csnd] Image opcodes
Date | 2007-11-18 19:40 |
From | Cesare Marilungo |
Subject | [Csnd] Image opcodes |
Please test: http://www.cesaremarilungo.com/download/csound/imageOpcodes.tar.gz The opcodes are: imageload - usage: imgnum imageload filename (Ex. img1 imageload "myimage.png") imagecreate - usage: imgnum imagecreate width height (Ex. img1 imagecreate 800, 600) imagesize - usage: width, height imagesize imgnum (Ex. iw, ih imagesize img1) imagegetpixel - usage: kred, kgreen, kblue imagegetpixel imgnum, kx, ky imagesetpixel - usage: imagesetpixel imgnum kx, ky, kr, kg, kb imagesave - usage: imagesave imgnum, filename (Ex. imagesave img1, "test.png") imagegetpixel and imagesetpixel can be used at k-rate or at a-rate. By default these two opcodes use values scaled from 0.0 to 1.0 so the top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As Michael suggested I plan to add an extra parameter to choose if you want to use the exact pixel indexes. So 0 would be default, 1 would be with exact pixel indexes and r g b values. I would like to hear from you about the naming conventions and such, if there's a better way to name these opcodes. If you think they would be useful or if they're worthless. Anything. Also, at the moment I'm using Imlib and Xlib for this and I developed it on gnu/Linux. What library would you use for Windows and MacOS X? Thanks in advance for the feedback. Ciao, c. p.s. Here's a .csd to test everything: |
Date | 2007-11-18 21:31 |
From | "Richard Bowers" |
Subject | [Csnd] RE: Image opcodes |
I have been looking for something which would enable a synthesis method similar to Rasmus Ekman's Coagula, but with the flexibility of Csound - ie. the ability to apply the data in a variety of ways at micro, meso and macro levels. It looks as if these could be the answer. Would there be some way of getting this data into standard f-tables? (I'm speaking as a Csound user. I don't know anything about the programming of opcodes). -Richard. -----Original Message----- From: Cesare Marilungo [mailto:cesare@poeticstudios.com] Sent: 18 November 2007 19:41 To: csound@lists.bath.ac.uk Subject: [Csnd] Image opcodes Please test: http://www.cesaremarilungo.com/download/csound/imageOpcodes.tar.gz The opcodes are: imageload - usage: imgnum imageload filename (Ex. img1 imageload "myimage.png") imagecreate - usage: imgnum imagecreate width height (Ex. img1 imagecreate 800, 600) imagesize - usage: width, height imagesize imgnum (Ex. iw, ih imagesize img1) imagegetpixel - usage: kred, kgreen, kblue imagegetpixel imgnum, kx, ky imagesetpixel - usage: imagesetpixel imgnum kx, ky, kr, kg, kb imagesave - usage: imagesave imgnum, filename (Ex. imagesave img1, "test.png") imagegetpixel and imagesetpixel can be used at k-rate or at a-rate. By default these two opcodes use values scaled from 0.0 to 1.0 so the top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As Michael suggested I plan to add an extra parameter to choose if you want to use the exact pixel indexes. So 0 would be default, 1 would be with exact pixel indexes and r g b values. I would like to hear from you about the naming conventions and such, if there's a better way to name these opcodes. If you think they would be useful or if they're worthless. Anything. Also, at the moment I'm using Imlib and Xlib for this and I developed it on gnu/Linux. What library would you use for Windows and MacOS X? Thanks in advance for the feedback. Ciao, c. p.s. Here's a .csd to test everything: |
Date | 2007-11-18 22:09 |
From | Cesare Marilungo |
Subject | [Csnd] Re: RE: Image opcodes |
You can do something like this: giImage imageload "myimage.png" ;load the image giImagew, giImageh imagesize giImage giTable ftGen 1, 0, giImagew, 7, 0, giImagew,, 0; this can use whatever table gen you want since we're going to rewrite it instr1 kord linseg 0, kr, 1 kred, kgreen, kblue imagegetpixel giImage, kord, 0; we read the first line of our image tablew kred, kord, 1, 1 ;write the values to our table endin instr2 a1 oscil 20000, kfreq, 1 out a1 endin Then in score: i1 0 1 ; read the line and write values to our table i2 1 1 ; play one second of our table. Maybe I can write other opcodes to do this automagically. The problem is that one has to choose how to map the data inside the image to table values. Using the data directly requires some more code to write but leaves the user more freedom to interpret the image as he/she wants. Ciao, -c. Richard Bowers wrote: > I have been looking for something which would enable a synthesis method > similar to Rasmus Ekman's Coagula, but with the flexibility of Csound - > ie. the ability to apply the data in a variety of ways at micro, meso > and macro levels. It looks as if these could be the answer. Would there > be some way of getting this data into standard f-tables? (I'm speaking > as a Csound user. I don't know anything about the programming of > opcodes). > > -Richard. > > -----Original Message----- > From: Cesare Marilungo [mailto:cesare@poeticstudios.com] > Sent: 18 November 2007 19:41 > To: csound@lists.bath.ac.uk > Subject: [Csnd] Image opcodes > > > Please test: > > http://www.cesaremarilungo.com/download/csound/imageOpcodes.tar.gz > > The opcodes are: > > imageload - usage: imgnum imageload filename (Ex. img1 imageload > "myimage.png") > imagecreate - usage: imgnum imagecreate width height (Ex. img1 > imagecreate 800, 600) > imagesize - usage: width, height imagesize imgnum (Ex. iw, ih imagesize > img1) > imagegetpixel - usage: kred, kgreen, kblue imagegetpixel imgnum, kx, ky > imagesetpixel - usage: imagesetpixel imgnum kx, ky, kr, kg, kb imagesave > - usage: imagesave imgnum, filename (Ex. imagesave img1, > "test.png") > > imagegetpixel and imagesetpixel can be used at k-rate or at a-rate. > > By default these two opcodes use values scaled from 0.0 to 1.0 so the > top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As > Michael suggested I plan to add an extra parameter to choose if you want > > to use the exact pixel indexes. So 0 would be default, 1 would be with > exact pixel indexes and r g b values. > > I would like to hear from you about the naming conventions and such, if > there's a better way to name these opcodes. If you think they would be > useful or if they're worthless. Anything. > > Also, at the moment I'm using Imlib and Xlib for this and I developed it > > on gnu/Linux. What library would you use for Windows and MacOS X? > > Thanks in advance for the feedback. > > Ciao, > > c. > > p.s. Here's a .csd to test everything: > > |
Date | 2007-11-18 22:17 |
From | Kevin Krebs |
Subject | [Csnd] Re: RE: Image opcodes |
Richard Bowers wrote: > I have been looking for something which would enable a synthesis method > similar to Rasmus Ekman's Coagula, but with the flexibility of Csound - Another free program that may be of interest to everyone working with image to sound synthesis is Blip from the recent KvRaudio Developer's challenge. http://www.nicolasfournel.com/blip.htm He's also got quite a selection of other audio software that you can find via his homepage: http://www.nicolasfournel.com/ -- --------- ------- ----- ---- --- -- - - - - - k.m.krebs \ 833-45 : http://833-45.net --------- ------- ----- ---- --- -- - - - - - "Sound is all our dreams of music. Noise is music's dreams of us." - Morton Feldman |
Date | 2007-11-18 23:56 |
From | Cesare Marilungo |
Subject | [Csnd] Re: Re: RE: Image opcodes |
Here's a .csd I actually tested: |
Date | 2007-11-19 15:28 |
From | Andres Cabrera |
Subject | [Csnd] Re: Image opcodes |
Hi Cesare, El dom, 18-11-2007 a las 20:40 +0100, Cesare Marilungo escribió: > > By default these two opcodes use values scaled from 0.0 to 1.0 so the > top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As > Michael suggested I plan to add an extra parameter to choose if you want > to use the exact pixel indexes. So 0 would be default, 1 would be with > exact pixel indexes and r g b values. > Thanks for your work. Just one suggestion to keep values more in line with existing opcodes, it might be good to use ranges between 0 and 255 to keep consistency with the existing FL opcodes like FLcolor, etc. Do you think these opcodes could be used to replace the bmopen opcode (which is currently only available on CsoundAV, but is designed to interact with other existing opcodes)? http://www.csounds.com/maldonado/Manual/index.htm Cheers, Andrés > I would like to hear from you about the naming conventions and such, if > there's a better way to name these opcodes. If you think they would be > useful or if they're worthless. Anything. > > Also, at the moment I'm using Imlib and Xlib for this and I developed it > on gnu/Linux. What library would you use for Windows and MacOS X? > > Thanks in advance for the feedback. > > Ciao, > > c. > > p.s. Here's a .csd to test everything: > > |
Date | 2007-11-19 17:33 |
From | Cesare Marilungo |
Subject | [Csnd] Re: Re: Image opcodes |
Hi Andres, I agree with Michael about the default behavior for scaling values. Keep in mind that my idea was to use these opcodes to extract information from images for musical purposes, not for GUIs (I thought there was a FL opcode for this, already). My idea was to add an optional parameter to set the behavior you're talking about (mapping r g b values as bytes and coords as ints). I didn't know about CsoundAV, lots of interesting stuff. Can't try it since I'm on gnu/Linux. Anyway it would be good reuse stuff wherever it's possible. Another problem is which library/ies to use for loading images on the various platforms. Ciao, c. Andres Cabrera wrote: > Hi Cesare, > > El dom, 18-11-2007 a las 20:40 +0100, Cesare Marilungo escribió: > >> By default these two opcodes use values scaled from 0.0 to 1.0 so the >> top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As >> Michael suggested I plan to add an extra parameter to choose if you want >> to use the exact pixel indexes. So 0 would be default, 1 would be with >> exact pixel indexes and r g b values. >> >> > Thanks for your work. Just one suggestion to keep values more in line > with existing opcodes, it might be good to use ranges between 0 and 255 > to keep consistency with the existing FL opcodes like FLcolor, etc. > Do you think these opcodes could be used to replace the bmopen opcode > (which is currently only available on CsoundAV, but is designed to > interact with other existing opcodes)? > > http://www.csounds.com/maldonado/Manual/index.htm > > Cheers, > Andrés > > >> I would like to hear from you about the naming conventions and such, if >> there's a better way to name these opcodes. If you think they would be >> useful or if they're worthless. Anything. >> >> Also, at the moment I'm using Imlib and Xlib for this and I developed it >> on gnu/Linux. What library would you use for Windows and MacOS X? >> >> Thanks in advance for the feedback. >> >> Ciao, >> >> c. >> >> p.s. Here's a .csd to test everything: >> >> |
Date | 2007-11-19 20:03 |
From | "Richard Bowers" |
Subject | [Csnd] RE: Re: RE: Image opcodes |
Thanks for this. I'm looking forward to seeing these in the next release. -Richard. Subject: [Csnd] Re: RE: Image opcodes You can do something like this: giImage imageload "myimage.png" ;load the image giImagew, giImageh imagesize giImage giTable ftGen 1, 0, giImagew, 7, 0, giImagew,, 0; this can use whatever table gen you want since we're going to rewrite it instr1 kord linseg 0, kr, 1 kred, kgreen, kblue imagegetpixel giImage, kord, 0; we read the first line of our image tablew kred, kord, 1, 1 ;write the values to our table endin instr2 a1 oscil 20000, kfreq, 1 out a1 endin Then in score: i1 0 1 ; read the line and write values to our table i2 1 1 ; play one second of our table. Maybe I can write other opcodes to do this automagically. The problem is that one has to choose how to map the data inside the image to table values. Using the data directly requires some more code to write but leaves the user more freedom to interpret the image as he/she wants. Ciao, -c. Richard Bowers wrote: > I have been looking for something which would enable a synthesis > method similar to Rasmus Ekman's Coagula, but with the flexibility of > Csound - ie. the ability to apply the data in a variety of ways at > micro, meso and macro levels. It looks as if these could be the > answer. Would there be some way of getting this data into standard > f-tables? (I'm speaking as a Csound user. I don't know anything about > the programming of opcodes). > > -Richard. > > -----Original Message----- > From: Cesare Marilungo [mailto:cesare@poeticstudios.com] > Sent: 18 November 2007 19:41 > To: csound@lists.bath.ac.uk > Subject: [Csnd] Image opcodes > > > Please test: > > http://www.cesaremarilungo.com/download/csound/imageOpcodes.tar.gz > > The opcodes are: > > imageload - usage: imgnum imageload filename (Ex. img1 imageload > "myimage.png") > imagecreate - usage: imgnum imagecreate width height (Ex. img1 > imagecreate 800, 600) > imagesize - usage: width, height imagesize imgnum (Ex. iw, ih imagesize > img1) > imagegetpixel - usage: kred, kgreen, kblue imagegetpixel imgnum, kx, ky > imagesetpixel - usage: imagesetpixel imgnum kx, ky, kr, kg, kb imagesave > - usage: imagesave imgnum, filename (Ex. imagesave img1, > "test.png") > > imagegetpixel and imagesetpixel can be used at k-rate or at a-rate. > > By default these two opcodes use values scaled from 0.0 to 1.0 so the > top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As > Michael suggested I plan to add an extra parameter to choose if you want > > to use the exact pixel indexes. So 0 would be default, 1 would be with > exact pixel indexes and r g b values. > > I would like to hear from you about the naming conventions and such, > if > there's a better way to name these opcodes. If you think they would be > useful or if they're worthless. Anything. > > Also, at the moment I'm using Imlib and Xlib for this and I developed > it > > on gnu/Linux. What library would you use for Windows and MacOS X? > > Thanks in advance for the feedback. > > Ciao, > > c. > > p.s. Here's a .csd to test everything: > > |
Date | 2007-11-19 20:07 |
From | "Richard Bowers" |
Subject | [Csnd] RE: Re: RE: Image opcodes |
Many thanks, Kevin. This stuff looks really interesting. > Another free program that may be of interest to everyone working with image to sound synthesis is Blip from the recent KvRaudio Developer's challenge. http://www.nicolasfournel.com/blip.htm He's also got quite a selection of other audio software that you can find via his homepage: http://www.nicolasfournel.com/ -- --------- ------- ----- ---- --- -- - - - - - k.m.krebs \ 833-45 : http://833-45.net --------- ------- ----- ---- --- -- - - - - - "Sound is all our dreams of music. Noise is music's dreams of us." - Morton Feldman Send bugs reports to this list. To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2007-11-20 16:58 |
From | "David Akbari" |
Subject | [Csnd] Re: RE: Re: RE: Image opcodes |
Attachments | None |
Date | 2007-11-20 18:33 |
From | Cesare Marilungo |
Subject | [Csnd] Re: Re: RE: Re: RE: Image opcodes |
Of course you can. imagesetpixel accepts both control and audio rate. You can create an empty image, fill it and save it. But really, these opcodes are nothing special. It's just a bunch of code I've hacked up to learn csound plugin development. It the idea of using images in this way that is exciting. Ciao, - c. David Akbari wrote: > These new opcodes look very very cool! > > One question though, it seems that it is possible to go from an image > file to sound... but is there a way to do the opposite..? By having > some arbitrary generated program material stored in an image format? > > In this way we could possibly have a new way to store and transfer > musical compositions! Also a good reminder about the csb64enc utility > for embedding images in our .csd file for transfer... > > > > David Akbari > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > -- www.cesaremarilungo.com |
Date | 2007-11-20 22:41 |
From | "Richard Bowers" |
Subject | [Csnd] bmopen, bmtable etc. [was: Image opcodes] |
Spurred on by this discussion I've been taking a look at Gabriel Maldonado's bitmap opcodes which are present only (afaik) in Csound AV. Has anyone had any experience with these and would be willing to pass on any successful examples? I get some strange behaviour at times but I seem to be able at least to read a bitmap's RGB values. Also, are these opcodes likely to find their way into canonical? They are: bmopen; bmtable(i); bmoscil(i); rgb2hsvl(_i); bmscan(i). -Richard. -----Original Message----- From: Cesare Marilungo [mailto:cesare@poeticstudios.com] Sent: 20 November 2007 18:34 To: csound@lists.bath.ac.uk Subject: [Csnd] Re: Re: RE: Re: RE: Image opcodes Of course you can. imagesetpixel accepts both control and audio rate. You can create an empty image, fill it and save it. But really, these opcodes are nothing special. It's just a bunch of code I've hacked up to learn csound plugin development. It the idea of using images in this way that is exciting. Ciao, - c. David Akbari wrote: > These new opcodes look very very cool! > > One question though, it seems that it is possible to go from an image > file to sound... but is there a way to do the opposite..? By having > some arbitrary generated program material stored in an image format? > > In this way we could possibly have a new way to store and transfer > musical compositions! Also a good reminder about the csb64enc utility > for embedding images in our .csd file for transfer... > > > > David Akbari > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body > "unsubscribe csound" > > > -- www.cesaremarilungo.com Send bugs reports to this list. To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |