Csound/fltk as a simple gui for forms?
Date | 2016-12-28 18:45 |
From | David Bellows |
Subject | Csound/fltk as a simple gui for forms? |
I have an odd use-case that I want to run by y'all. I have a program that generates music and it uses Csound for the audio. The program is written in Lua 5.3 and apparently there aren't any GUI libraries that *actually* work for Lua 5.3 (for 5.1, 5.2, and LuaJIT, yes, but not 5.3). I do not want to add another language requirement (for example there are plenty of Python GUI libraries available). So I'm hoping for something simpler. It's worth noting that I am not a programmer though I do a decent job of faking it. So there might be some simple solution that I'm missing -- please feel free to share (keeping in mind that I really don't want to leave Lua 5.3). I see that Csound has some fltk stuff built-in. Since Csound is already a required dependency it makes some kind of sense to me to use its built-in GUI stuff. I want a few text boxes and maybe some radio buttons or other buttons and to be able to generate several pages/sections contingent upon responses. And finally write all the data gathered to a text file (which my software will then use) or possibly even execute a command (with a bunch of flags set). Is this doable with Csound/fltk? Is it way too much work? Completely the wrong tool? And if it is an appropriate approach are there any good tutorials that would help me in this specific use? I'm not actually generating any instruments or scores to use with this instance of Csound, just creating a GUI to get data from the user. Thanks! Dave Bellows Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2016-12-28 22:13 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
Attachments | lua_example_csd_fltk.lua lua_scoregen.csd |
I am a Csound developer and a composer and I have contributed to and developed various facilities for composing with Csound and graphical user interfaces. What operating system and what version of Csound are you using? Can you port your program to run with LuaJIT? It will almost certainly run significantly faster and you will get graphics. Yes, the FLTK widgets will probably work for you. Do you "shell out" to run Csound, or do you use the Lua API for Csound? I have attached a rudimentary example that uses FLTK widgets to control a Csound instrument from a Lua program that runs Csound via the API. Have you tried CsoundQt? It has built-in widgets for controlling Csound. You can use Lua code with csound.node (see below). Have you tried csound.node (desktop with NW.js) or Csound for PNaCl (online with the Google Chrome browser on all desktop operating systems)? These run Csound in the JavaScript context of a Web browser. You get all the GUI widgets you mentioned from HTML and JavaScript, and much more stuff besides. csound.node actually is currently the most powerful environment for using Csound. You can use Lua code with csound.node (see below). By the way, Csound has built-in Lua opcodes that can execute Lua programs. The Lua code is embedded in the Csound orchestra, and can insert notes into the running Csound performance, or change control channel values during Csound. This depends on LuaJIT's foreign function interface. I have attached a sample of this kind of piece. The good thing about the Lua opcodes is that they run in plain Csound, in CsoundQt, and even in csound.node. The Lua opcodes have LuaJIT built in. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Dec 28, 2016 at 1:45 PM, David Bellows |
Date | 2016-12-28 23:47 |
From | "d.vyd@outlook.com" |
Subject | Re: Csound/fltk as a simple gui for forms? |
Michael, I was reading your response to David and noticed your assertion that "csound.node actually is currently the
most powerful environment for using Csound" Having not decided upon a particular way to use Csound or a secondary programming language (Python,
Lua, JavaScript) yet, I'd like to know why Csound.node is so powerful. Do you mean solely in terms of GUI building?
--d.vyd
On Dec 28, 2016 5:13 PM, Michael Gogins <michael.gogins@GMAIL.COM> wrote:
|
Date | 2016-12-28 23:49 |
From | David Bellows |
Subject | Re: Csound/fltk as a simple gui for forms? |
Hello Mike, Thanks for your help on this! > What operating system and what version of Csound are you using? I'm using Kubuntu Linux 16.10 which comes with Csound 6.07. > Can you port your program to run with LuaJIT? It will almost certainly run significantly faster and you will get graphics. Not without more work and headaches than I want to spend on it. I used to maintain compatibility but then ran into some kind of 64 vs 32 bit issue and gave up. Now it's just Lua 5.3. I'm sure a competent programmer could make my software work in LuaJIT but I don't think I have the energy for it any more. > Do you "shell out" to run Csound, or do you use the Lua API for Csound? If I understand you correctly, yes, I use the shell to run Csound. In Lua this would be the os.execute() command. My software generates all the data and then creates a Csound file which it will then convert to audio if required: os.execute("csound " .. filename .. ".csd --ogg -o " .. filename .. ".ogg") That same data is also used to generate sheet music (via Lilypond) and graphic notation (using pdfLaTeX) all with os.execute() commands. I have been unable to get luaCsnd6 to work with Lua 5.3. > Have you tried CsoundQt? It has built-in widgets for controlling Csound. CsoundQT appears to be a front-end for developing Csound works? My program is intended to be used by general users who make various decisions (tuning, scale, etc.) which influence the music that is going to be generated for them. > Have you tried csound.node (desktop with NW.js) or Csound for PNaCl (online with the Google Chrome browser on all desktop operating systems)? These run Csound in the JavaScript context of a Web browser. I'm not familiar with these and quite frankly they look really scary. As I mentioned I'm not really a programmer at all. I know one language (Lua) and I've only written one program (http://www.platonicmusicengine.com) in that language. > By the way, Csound has built-in Lua opcodes that can execute Lua programs. The Lua code is embedded in the Csound orchestra, and can insert notes into the running Csound performance, or change control channel values during Csound. I was aware of this but hadn't experimented with it. My program does a lot of stuff that I don't think would be appropriate for within Csound (generating sheet music and graphical scores and just computing a lot of stuff in general). Creating an audio file is only one result, and it's not intended to be listened to live. So in the end I'm really just looking for a gui that allows the user to enter in their name, choose a scale, choose which durations to use, a few other similar things and write all that information to a file (or execute my software externally with various flags). I'm trying to keep the number of dependencies down as I want this software to be friendly enough for average folk and not just hardcore music people. This is why I'm hoping I can use Csound's fltk capabilities as gui to gather some information from the user (a simple form) which the rest of my software will then process as it does now. Eventually there will be an online front-end but that's a ways down the road and will be another massive undertaking that gives me nightmares thinking about. And I would love, love, love to be able to control Csound directly from my Lua program as that would make things cleaner and open up some really cool possibilities but unless I can get luaCsnd6 to work with Lua 5.3 I don't think that's going to happen. With your examples, I was able to get the Lua one to run in Lua 5.1 but was unable to get the other one to run. I installed luaffi but when I run your program I get: luaL_dostring failed with: 1 error loading module 'ffi' from file '/usr/local/lib/lua/5.1/ffi.so': /usr/local/lib/lua/5.1/ffi.so: undefined symbol: lua_gettop Dave On Wed, Dec 28, 2016 at 2:13 PM, Michael Gogins |
Date | 2016-12-29 01:48 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
Thanks, your explanation clarified a lot of things for me. The ffi module is specific to LuaJIT. The "lua_scoregen.csd" one absolutely requires LuaJIT. You probably don't have the Lua opcodes on your system. If you do, they are in LuaCsound.so. I tried to get my example to work with Lua 5.3. Lua 5.3 is indeed compiled for 64 bit CPU architecture on my computer and so is compatible with Csound. However, the luaCsnd6 shared library was compiled against LuaJIT headers and libraries, and that is almost certainly why it crashes. If the luaCsnd6 library was compiled against Lua 5.3 it would probably work. I will see if I can get luaffi to run Csound. First I have to compile luaffi on my system. Best, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Dec 28, 2016 at 6:49 PM, David Bellows |
Date | 2016-12-29 01:55 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
Not at all solely in terms of GUI building. Run Chrome or some other state of the art Web browser and go to this page: https://html5test.com/ ALL of the capabilities that you find listed there can be used along with Csound in csound.node. They can also be used in the PNaCl build, here is an example: https://gogins.github.io/csound/Scrims_pnacl.html Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Dec 28, 2016 at 6:47 PM, d.vyd@outlook.com |
Date | 2016-12-29 10:48 |
From | fra |
Subject | Re: Csound/fltk as a simple gui for forms? |
Hello Dave, just a thought: are you sure your program will not work with a different Lua version? Changes in the language seems not so incompatible See https://www.lua.org/manual/5.3/manual.html#8 So maybe you can use Lua 5.2 with your files and some GUI library for it. I personally use lgi but for very simple things as i'm not a programmer. ciao, francesco. Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2016-12-29 16:13 |
From | David Bellows |
Subject | Re: Csound/fltk as a simple gui for forms? |
Hello Francesco, > So maybe you can use Lua 5.2 with your files and some GUI library for it. I personally use lgi but for very simple things as i'm not a programmer. Two things about this. I think it was from 5.2 to 5.3 that the switch was made to 64 bits. The problem I had trying to maintain LuaJIT compatibility was this very thing. I have a very specific need for 64 bit integers and while it probably is possible to program around that, it proved too difficult for me. Basically I use two hash algorithms and a prng for some important data processing and somewhere in all that I was getting different results using LuaJIT/Lua5.1 vs Lua 5.3. Like I said, it might have been possible to fix it but I was unable to figure it out -- I just saw the differing results and gave up. The other thing is that I want this software to be in use 5, 10, 20 years from now. So I figure staying with the latest version of whatever language I'm using helps in that cause. Dave On Thu, Dec 29, 2016 at 2:48 AM, fra |
Date | 2016-12-29 16:48 |
From | "d.vyd@outlook.com" |
Subject | Re: Csound/fltk as a simple gui for forms? |
Wow Michael, that is pretty cool! So, when I click on: https://gogins.github.io/csound/Scrims_pnacl.html are graphics and Csound running locally on my machine?
If I am primarily interested in making sliders, knobs, numerical feedback, and oscilloscopes for real-time interaction with instruments, would you still recommend csound.node over the widgets in CsoundQT? From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on behalf of Michael Gogins <michael.gogins@GMAIL.COM>
Sent: Thursday, December 29, 2016 1:55:00 AM To: CSOUND@LISTSERV.HEANET.IE Subject: Re: [Csnd] Csound/fltk as a simple gui for forms? Not at all solely in terms of GUI building. Run Chrome or some other
state of the art Web browser and go to this page: https://html5test.com/ ALL of the capabilities that you find listed there can be used along with Csound in csound.node. They can also be used in the PNaCl build, here is an example: https://gogins.github.io/csound/Scrims_pnacl.html Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, Dec 28, 2016 at 6:47 PM, d.vyd@outlook.com <d.vyd@outlook.com> wrote: > Michael, I was reading your response to David and noticed your assertion > that "csound.node actually is currently the most powerful environment for > using Csound" Having not decided upon a particular way to use Csound or a > secondary programming language (Python, Lua, JavaScript) yet, I'd like to > know why Csound.node is so powerful. Do you mean solely in terms of GUI > building? > > --d.vyd > > > On Dec 28, 2016 5:13 PM, Michael Gogins <michael.gogins@GMAIL.COM> wrote: > > I am a Csound developer and a composer and I have contributed to and > developed various facilities for composing with Csound and graphical > user interfaces. > > What operating system and what version of Csound are you using? > > Can you port your program to run with LuaJIT? It will almost certainly > run significantly faster and you will get graphics. > > Yes, the FLTK widgets will probably work for you. Do you "shell out" > to run Csound, or do you use the Lua API for Csound? I have attached a > rudimentary example that uses FLTK widgets to control a Csound > instrument from a Lua program that runs Csound via the API. > > Have you tried CsoundQt? It has built-in widgets for controlling > Csound. You can use Lua code with csound.node (see below). > > Have you tried csound.node (desktop with NW.js) or Csound for PNaCl > (online with the Google Chrome browser on all desktop operating > systems)? These run Csound in the JavaScript context of a Web browser. > You get all the GUI widgets you mentioned from HTML and JavaScript, > and much more stuff besides. csound.node actually is currently the > most powerful environment for using Csound. You can use Lua code with > csound.node (see below). > > By the way, Csound has built-in Lua opcodes that can execute Lua > programs. The Lua code is embedded in the Csound orchestra, and can > insert notes into the running Csound performance, or change control > channel values during Csound. This depends on LuaJIT's foreign > function interface. I have attached a sample of this kind of piece. > The good thing about the Lua opcodes is that they run in plain Csound, > in CsoundQt, and even in csound.node. The Lua opcodes have LuaJIT > built in. > > Regards, > Mike > > ----------------------------------------------------- > Michael Gogins > Irreducible Productions > http://michaelgogins.tumblr.com > Michael dot Gogins at gmail dot com > > > On Wed, Dec 28, 2016 at 1:45 PM, David Bellows <davebellows@gmail.com> > wrote: >> I have an odd use-case that I want to run by y'all. I have a program >> that generates music and it uses Csound for the audio. The program is >> written in Lua 5.3 and apparently there aren't any GUI libraries that >> *actually* work for Lua 5.3 (for 5.1, 5.2, and LuaJIT, yes, but not >> 5.3). I do not want to add another language requirement (for example >> there are plenty of Python GUI libraries available). So I'm hoping for >> something simpler. >> >> It's worth noting that I am not a programmer though I do a decent job >> of faking it. So there might be some simple solution that I'm missing >> -- please feel free to share (keeping in mind that I really don't want >> to leave Lua 5.3). >> >> I see that Csound has some fltk stuff built-in. Since Csound is >> already a required dependency it makes some kind of sense to me to use >> its built-in GUI stuff. I want a few text boxes and maybe some radio >> buttons or other buttons and to be able to generate several >> pages/sections contingent upon responses. And finally write all the >> data gathered to a text file (which my software will then use) or >> possibly even execute a command (with a bunch of flags set). >> >> Is this doable with Csound/fltk? Is it way too much work? Completely >> the wrong tool? And if it is an appropriate approach are there any >> good tutorials that would help me in this specific use? I'm not >> actually generating any instruments or scores to use with this >> instance of Csound, just creating a GUI to get data from the user. >> >> Thanks! >> Dave Bellows >> >> Csound mailing list >> Csound@listserv.heanet.ie >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND >> Send bugs reports to >> https://github.com/csound/csound/issues >> Discussions of bugs and features can be posted here > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > > > Csound mailing list Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to > https://github.com/csound/csound/issues Discussions of bugs and features can > be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2016-12-29 16:49 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
You are right about using the current versions of languages. Are you saying that you depend upon 64 bit CPU architecture in general, or on 64 bit integers (int64_t) specifically? Are your hash algorithms and prng implemented in Lua, or in C or C++? LuaJIT can be compiled for 64 bit CPU architecture. In that case, one is still limited to a 32 bit (2 gigabyte) address space, and regular Lua numbers are still stuck with 32 bit integers. However, with LuaJIT compiled for 64 bit CPU architecture, it is possible to declare 64 bit integers as C types and use them in Lua code. How difficult would it be to re-implement your algorithms in LuaJIT using int64_t ctypes instead of regular Lua numbers? It is in my view an open question whether Lua and/or LuaJIT are still going to be in use 10 or 20 years from now. I think it much more likely that C and C++ will still be in use 10 or 20 years from now, and that they will be compiled to run in Web browser runtimes using something like WebAssembly, where JavaScript will be used as a scripting language that can call C functions. I also think that JavaScript will become a more useful language and will continue to get faster and faster. I have a great deal of admiration for Lua and LuaJIT (after all I created the Lua interface for Csound and also the Lua opcodes), but I think the future lies with something like WebAssembly. By design, JavaScript is "versionless" in the sense that backward compatibility is strongly enforced. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Thu, Dec 29, 2016 at 11:13 AM, David Bellows |
Date | 2016-12-29 17:16 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
Yes, Scrims runs locally on your machine, in a special virtual machine built into Google's Chrome browser. Similar technology will be used in the upcoming WebAssembly standard. If you are only ever planning on running on the desktop and only on one specific operating system, use the native GUI calls to write your piece as a (Windows/OS X/Linux) program and embed Csound and your Csound code in that program (this gives you the greatest flexibility and the highest possible performance, but requires specific knowledge). If you are only ever planning on running on the desktop but need to run on different operating systems, use the Qt SDK to write your piece as a Qt program and embed Csound and your Csound code in that program (this gives you a fantastic library of widgets and somewhat simplifies the programming). If you are only ever planning on running on the desktop but need to run on different operating systems, but don't need a fantastic library of widgets and find what is built in to CsoundQt satisfactory, that's a very good way to go because it is convenient, reasonably standard, and provides Csound debugging, Python scripting, HTML5 support, built-in help, etc. I think a lot of Csound users fall into this category. Much the same can be said of Cabbage, by the way, which also makes your pieces or Csound code into plugins for audio sequencers. If you are planning to run the same piece on the desktop, on devices, and on line, then write your piece as an HTML5 page that calls an embedded Csound object with a JavaScript interface, as with Scrims. If you use a subset of the Csound API, this will run on csound.node, CsoundQt, Csound for Android, and Csound for PNaCl. Note: you can use HTML widgets in CsoundQt as well as the native CsoundQt widgets. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Thu, Dec 29, 2016 at 11:48 AM, d.vyd@outlook.com |
Date | 2016-12-29 17:54 |
From | "d.vyd@outlook.com" |
Subject | Re: Csound/fltk as a simple gui for forms? |
Thank you Michael. I think CsoundQt might be a good place for me to start. From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on behalf of Michael Gogins <michael.gogins@GMAIL.COM>
Sent: Thursday, December 29, 2016 5:16:07 PM To: CSOUND@LISTSERV.HEANET.IE Subject: Re: [Csnd] Csound/fltk as a simple gui for forms? Yes, Scrims runs locally on your machine, in a special virtual machine
built into Google's Chrome browser. Similar technology will be used in the upcoming WebAssembly standard. If you are only ever planning on running on the desktop and only on one specific operating system, use the native GUI calls to write your piece as a (Windows/OS X/Linux) program and embed Csound and your Csound code in that program (this gives you the greatest flexibility and the highest possible performance, but requires specific knowledge). If you are only ever planning on running on the desktop but need to run on different operating systems, use the Qt SDK to write your piece as a Qt program and embed Csound and your Csound code in that program (this gives you a fantastic library of widgets and somewhat simplifies the programming). If you are only ever planning on running on the desktop but need to run on different operating systems, but don't need a fantastic library of widgets and find what is built in to CsoundQt satisfactory, that's a very good way to go because it is convenient, reasonably standard, and provides Csound debugging, Python scripting, HTML5 support, built-in help, etc. I think a lot of Csound users fall into this category. Much the same can be said of Cabbage, by the way, which also makes your pieces or Csound code into plugins for audio sequencers. If you are planning to run the same piece on the desktop, on devices, and on line, then write your piece as an HTML5 page that calls an embedded Csound object with a JavaScript interface, as with Scrims. If you use a subset of the Csound API, this will run on csound.node, CsoundQt, Csound for Android, and Csound for PNaCl. Note: you can use HTML widgets in CsoundQt as well as the native CsoundQt widgets. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Thu, Dec 29, 2016 at 11:48 AM, d.vyd@outlook.com <d.vyd@outlook.com> wrote: > Wow Michael, that is pretty cool! So, when I click on: > https://gogins.github.io/csound/Scrims_pnacl.html > > are graphics and Csound running locally on my machine? > > > If I am primarily interested in making sliders, knobs, numerical feedback, > and oscilloscopes for real-time interaction with instruments, would you > still recommend csound.node over the widgets in CsoundQT? > > ________________________________ > From: A discussion list for users of Csound <CSOUND@LISTSERV.HEANET.IE> on > behalf of Michael Gogins <michael.gogins@GMAIL.COM> > Sent: Thursday, December 29, 2016 1:55:00 AM > To: CSOUND@LISTSERV.HEANET.IE > Subject: Re: [Csnd] Csound/fltk as a simple gui for forms? > > Not at all solely in terms of GUI building. Run Chrome or some other > state of the art Web browser and go to this page: > > https://html5test.com/ > > ALL of the capabilities that you find listed there can be used along > with Csound in csound.node. They can also be used in the PNaCl build, > here is an example: > > https://gogins.github.io/csound/Scrims_pnacl.html > > Regards, > Mike > > ----------------------------------------------------- > Michael Gogins > Irreducible Productions > http://michaelgogins.tumblr.com > Michael dot Gogins at gmail dot com > > > On Wed, Dec 28, 2016 at 6:47 PM, d.vyd@outlook.com <d.vyd@outlook.com> > wrote: >> Michael, I was reading your response to David and noticed your assertion >> that "csound.node actually is currently the most powerful environment for >> using Csound" Having not decided upon a particular way to use Csound or a >> secondary programming language (Python, Lua, JavaScript) yet, I'd like to >> know why Csound.node is so powerful. Do you mean solely in terms of GUI >> building? >> >> --d.vyd >> >> >> On Dec 28, 2016 5:13 PM, Michael Gogins <michael.gogins@GMAIL.COM> wrote: >> >> I am a Csound developer and a composer and I have contributed to and >> developed various facilities for composing with Csound and graphical >> user interfaces. >> >> What operating system and what version of Csound are you using? >> >> Can you port your program to run with LuaJIT? It will almost certainly >> run significantly faster and you will get graphics. >> >> Yes, the FLTK widgets will probably work for you. Do you "shell out" >> to run Csound, or do you use the Lua API for Csound? I have attached a >> rudimentary example that uses FLTK widgets to control a Csound >> instrument from a Lua program that runs Csound via the API. >> >> Have you tried CsoundQt? It has built-in widgets for controlling >> Csound. You can use Lua code with csound.node (see below). >> >> Have you tried csound.node (desktop with NW.js) or Csound for PNaCl >> (online with the Google Chrome browser on all desktop operating >> systems)? These run Csound in the JavaScript context of a Web browser. >> You get all the GUI widgets you mentioned from HTML and JavaScript, >> and much more stuff besides. csound.node actually is currently the >> most powerful environment for using Csound. You can use Lua code with >> csound.node (see below). >> >> By the way, Csound has built-in Lua opcodes that can execute Lua >> programs. The Lua code is embedded in the Csound orchestra, and can >> insert notes into the running Csound performance, or change control >> channel values during Csound. This depends on LuaJIT's foreign >> function interface. I have attached a sample of this kind of piece. >> The good thing about the Lua opcodes is that they run in plain Csound, >> in CsoundQt, and even in csound.node. The Lua opcodes have LuaJIT >> built in. >> >> Regards, >> Mike >> >> ----------------------------------------------------- >> Michael Gogins >> Irreducible Productions >> http://michaelgogins.tumblr.com >> Michael dot Gogins at gmail dot com >> >> >> On Wed, Dec 28, 2016 at 1:45 PM, David Bellows <davebellows@gmail.com> >> wrote: >>> I have an odd use-case that I want to run by y'all. I have a program >>> that generates music and it uses Csound for the audio. The program is >>> written in Lua 5.3 and apparently there aren't any GUI libraries that >>> *actually* work for Lua 5.3 (for 5.1, 5.2, and LuaJIT, yes, but not >>> 5.3). I do not want to add another language requirement (for example >>> there are plenty of Python GUI libraries available). So I'm hoping for >>> something simpler. >>> >>> It's worth noting that I am not a programmer though I do a decent job >>> of faking it. So there might be some simple solution that I'm missing >>> -- please feel free to share (keeping in mind that I really don't want >>> to leave Lua 5.3). >>> >>> I see that Csound has some fltk stuff built-in. Since Csound is >>> already a required dependency it makes some kind of sense to me to use >>> its built-in GUI stuff. I want a few text boxes and maybe some radio >>> buttons or other buttons and to be able to generate several >>> pages/sections contingent upon responses. And finally write all the >>> data gathered to a text file (which my software will then use) or >>> possibly even execute a command (with a bunch of flags set). >>> >>> Is this doable with Csound/fltk? Is it way too much work? Completely >>> the wrong tool? And if it is an appropriate approach are there any >>> good tutorials that would help me in this specific use? I'm not >>> actually generating any instruments or scores to use with this >>> instance of Csound, just creating a GUI to get data from the user. >>> >>> Thanks! >>> Dave Bellows >>> >>> Csound mailing list >>> Csound@listserv.heanet.ie >>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND >>> Send bugs reports to >>> https://github.com/csound/csound/issues >>> Discussions of bugs and features can be posted here >> >> Csound mailing list >> Csound@listserv.heanet.ie >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND >> Send bugs reports to >> https://github.com/csound/csound/issues >> Discussions of bugs and features can be posted here >> >> >> Csound mailing list Csound@listserv.heanet.ie >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to >> https://github.com/csound/csound/issues Discussions of bugs and features >> can >> be posted here > > Csound mailing list > Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > Csound mailing list Csound@listserv.heanet.ie > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to > https://github.com/csound/csound/issues Discussions of bugs and features can > be posted here Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here |
Date | 2016-12-29 19:26 |
From | David Bellows |
Subject | Re: Csound/fltk as a simple gui for forms? |
Hey Michael, > Are you saying that you depend upon 64 bit CPU architecture in general, or on 64 bit integers (int64_t) specifically? > Are your hash algorithms and prng implemented in Lua, or in C or C++? I'll do my best here. They are definitely implemented in Lua (the only language I know!). And I think they rely on 64 bit integers. I'm not a good enough programmer to have written any of these algorithms. All I know is that running them in LuaJIT produced different results, *somewhere*. But here is a link to one file (scroll down a ways till you get to the hash algorithms): https://gitlab.com/davethecomposer/platonic-music-engine/blob/master/scripts/generic_functions.lua and the rpng I use: https://gitlab.com/davethecomposer/platonic-music-engine/blob/master/scripts/pcg.lua Remember, I did not create any of these and have absolutely no idea how they work. At all. They are black boxes. > How difficult would it be to re-implement your algorithms in LuaJIT using int64_t ctypes instead of regular Lua numbers? For me? Really, really difficult since I have no idea what any of that means. I apologize, I'm really not a programmer at all, I just find things, fiddle with them, make sure the results are correct, and move on to the next problem. I like to think that the most recent fiddled with version works pretty well and looks clean but I'm not trying to fool myself either! > It is in my view an open question whether Lua and/or LuaJIT are still going to be in use 10 or 20 years from now. I think it much more likely that C and C++ will still be in use 10 or 20 years from now, I agree. My thinking is that by keeping my software current with the latest Lua when the day comes that I need to change over I might be able to do it myself and still have a program that runs reasonably well during the transition. I'm getting old and I felt like I needed to hit the ground running with an easier language (Lua) than take the time to learn how to program first (C). It's been two years now and I think I made the right decision. > that they will be compiled to run in Web browser runtimes using something like WebAssembly, where JavaScript will be used as a scripting language that can call C functions. That's really interesting. As my software grows it will end up gobbling up all sorts of other technologies (Lilypond already as well as TeX/LaTeX but that's too big to include in a download!) and will generate all kinds of art using any medium and any technology one wants to use. Its eventual scope is miles beyond what I can imagine from a technological point of view. So in the meantime I keep writing Lua code and trust the future to take care of itself! I don't let myself get overwhelmed with the eventual scope. So because I'm getting a bit lost, where do I stand on using Csound's fltk abilities to generate simple forms (and not actual music!) whose data I can use externally? I know it's a really ugly hack but since the gui stuff is just sitting there it seems to be a solution, of sorts, to my gui problem (since I haven't been able to find any guis that actually work with Lua 5.3). Thanks! On Thu, Dec 29, 2016 at 9:54 AM, d.vyd@outlook.com |
Date | 2016-12-29 20:12 |
From | Michael Gogins |
Subject | Re: Csound/fltk as a simple gui for forms? |
I think you were wrong about C, C is easier than Lua. But if Lua is easy for you and you want to stick with it, fine, you should do that. FLTK should be fine for your GUIs. To use Lua 5.3 with Csound (including the FLTK opcodes) via the shell is no problem at all. To use Csound via the API with Lua 5.3 you will need to use luaffi. I am going to try to get that to work. In either case FLTK can send messages to Csound and Csound can then open files, read and write to files, and so on. But you need the API and luaffi if you want your Lua program to send channel values to Csound during performance, unless of course you want to use OSC or sockets or something but then it gets complicated. Regards, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Thu, Dec 29, 2016 at 2:26 PM, David Bellows |