[Csnd-dev] New API progress report
Date | 2024-07-25 16:27 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | [Csnd-dev] New API progress report |
Just another progress report for the feature/newapi branch - I have now mainlined the new API in csound.h - Updated the csound.hpp wrapper - Updated the csPerformanceThread code - Modified frontends to use it - Modified the C++ test suite It is all working, I guess frontend developers can take a look and see what they think. François: could you take a look at the Python wrapper? It is out of sync now. Victor |
Date | 2024-07-26 10:31 |
From | Francois PINOT |
Subject | Re: [Csnd-dev] New API progress report |
I just built Csound from the feature/newapi branch. I'm using it to sync the Python wrapper. I'll let you know when it's ready. François Le jeu. 25 juil. 2024 à 17:27, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> a écrit :
|
Date | 2024-07-26 10:44 |
From | vlz |
Subject | Re: [Csnd-dev] New API progress report |
Great. Let me know if you think we should add things to the interface. Prof. Victor Lazzarini Maynooth University Ireland On 26 Jul 2024, at 10:31, Francois PINOT <fggpinot@gmail.com> wrote:
|
Date | 2024-07-26 10:50 |
From | Francois PINOT |
Subject | Re: [Csnd-dev] New API progress report |
I realized that when I wrote ctcsound.py I used camelCase to name the functions. The norm in Python is to use underscore to separate the components of a function name: for example, csound_create instead of csoundCreate. Do you think it's worth it to do so writing the new python wrapper for the API? This way, we would follow the Python rules and it could be an easy way to differentiate the new API wrapper from the old one. François Le ven. 26 juil. 2024 à 11:31, Francois PINOT <fggpinot@gmail.com> a écrit :
|
Date | 2024-07-26 11:06 |
From | vlz |
Subject | Re: [Csnd-dev] New API progress report |
yes, I think it is a good idea on both counts. Also I am wondering whether we should call it csound.py instead of ctcsound.py? Would it make more sense since it's wrapping csound.h? Prof. Victor Lazzarini Maynooth University Ireland On 26 Jul 2024, at 10:50, Francois PINOT <fggpinot@gmail.com> wrote:
|
Date | 2024-07-26 12:55 |
From | Francois PINOT |
Subject | Re: [Csnd-dev] New API progress report |
There are different ways to interface Python with c libraries: - the hard way, using the Python C-API - FFI, using ctypes, - Cython, there's a project recently discussed on the list for this - SWIG, the way you did it before. I used the ct prefix to highlight the fact that it was based on ctypes, which gives us a pure python unit without any need for extra tools. Well, there's still the numpy dependency, to give easy access to the huge set of scientific computing libraries around Python. And in a way, I like the association with the city: Csound in the city, vs Csound on the beach, vs Csound in the countryside, etc ;) (just kidding) François Le ven. 26 juil. 2024 à 12:06, vlz <viclazzarini@gmail.com> a écrit :
|
Date | 2024-07-26 14:38 |
From | Steven Yi |
Subject | Re: [Csnd-dev] New API progress report |
I haven't had a chance to look at the new branch yet, as I was stuck on the message callback system for the Java FFM binding (though, I just realized I got around valist in Csound JNI by using csoundSetMessageStringCallback). I'm just about finished getting Csound FFM up to speed with CS6. I think it shouldn't be too hard to make it work with both CS6 and CS7. To note, the Csound FFM code looks very similar to ctcsound.py as Python FFI and Java FFM are somewhat similar. I'll follow Francois's lead and try to sync with ctcsound.py changes for cs7. On Fri, Jul 26, 2024 at 7:56 AM Francois PINOT |
Date | 2024-07-26 20:29 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] New API progress report |
Hi! I tried out the new API from feature/newapi branch. Building csound7 went fine, I installed it to $HOME/.local (Linux) and added $HOME/.local/lib to ldconfig libraries' path. First I tried it with a relatively simple Qt project using Csound C++ API (csound.hpp). After some changes everything worked fine. One question: when before there was Csound::stop() / csoundStop() , how is it now the proper way to end Csound's work? Also csoundCleanup() is gone. is csoundReset() it that does it all? Then I went to CsoundQt and of course that is much, much more complex case. First - I guess libcsnd7 is not is built by default? Is it still existing, how should I configure it? CsoundQt uses that for recording. Maybe there is now a better way to rewrite the recording part. CsoundQt used the following functions that are not to be there any more: csoundGetModule csoundSetMIDIModule csoundSetRTAudioModule I commented these lines out for now to move on. What covers their functionality? There is no more circular buffer functions: csoundCreateCircularBuffer csoundReadCircularBuffer etc CsoundQt leaned heavily on them for internal MIDI handling. What is the correct way to handle it now? For example reading MIDI data one should set the callback like: csoundSetExternalMidiReadCallback(ud->csound, &midiReadCb); CsoundQt used to have such a function for the callback: int CsoundEngine::midiReadCb(CSOUND *csound, void *ud_, unsigned char *buf, int nBytes) { CsoundUserData *ud = (CsoundUserData *) ud_; Q_UNUSED(csound); int count, countVirtual; count = csoundReadCircularBuffer(ud->csound, ud->midiBuffer, buf, nBytes); countVirtual = csoundReadCircularBuffer(ud->csound, ud->virtualMidiBuffer, buf + count, nBytes - count); return count + countVirtual; } Should the host implement writing to the buffer and handling the index itself? Is it so that csoundSetHostImplementedMIDIIO is replaced now with PUBLIC void csoundSetHostMIDIIO(CSOUND *csound); How to deal with global variables? csoundQueryGlobalVariable csoundCreateGlobalVariable are gone, csoundGetEnv is there but no csoundSetEnv, csoundSetGlobalEnv or similar? at the moment I replaced them with Qt specific functions to deal with environment variables. What is the correct environment variable for the plugins directory, OPCODE7DIR64? I got CsoundQt building but it crashes when I run a file. I did not have time yet to dig into it, there are many possible reasons. I hope to continue tomorrow. Exciting! tarmo Kontakt Victor Lazzarini (<000010b17ddd988e-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval N, 25. juuli 2024 kell 18:27:
|
Date | 2024-07-26 22:39 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Thanks for this. Responses below > On 26 Jul 2024, at 20:29, Tarmo Johannes |
Date | 2024-07-26 22:55 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi Tarmo, I put back > csoundGetModule > csoundSetMIDIModule > csoundSetRTAudioModule plus the set global env and the circular buffer functions. It’s in the repo now. Best Victor > On 26 Jul 2024, at 20:29, Tarmo Johannes |
Date | 2024-07-27 09:31 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi Victor! Thank you for the changes, it helps a lot. > csoundGetModule > csoundSetMIDIModule > csoundSetRTAudioModule Are used in config dialog to populate a menu to list the available modules. Now it works fine again. I reverted some of my changes, left libcsnd out of libraries (this is good news that it is not needed any more!) and CsoundQt build fine. I still get crash when running a csd. MYFLT *outputBuffer = csoundGetSpout(udata->csound); returns 0 in some reason, I will see if I can figure out the reason later. Thanks! tarmo Kontakt Victor Lazzarini (<000010b17ddd988e-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval L, 27. juuli 2024 kell 00:55: Hi Tarmo, |
Date | 2024-07-27 10:20 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi Tarmo, that’s great, this is one of the reasons we needed your input, so the API can be tailored to the needs of users. Regarding your issue, make sure the call is always after csoundStart(), otherwise the spout will not have been created. Here’s a simple test to show it csoundStart(Csound); MYFLT *spout = csoundGetSpout(Csound); printf("spout = %p \n", spout) best ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 27 Jul 2024, at 09:31, Tarmo Johannes |
Date | 2024-07-27 11:12 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
With regards to: > csoundQueryGlobalVariable > csoundCreateGlobalVariable I have been using these methods to pass custom data structs between my opcodes and my host. I should have mentioned this earlier, but they slipped my attention. For example, some of my Csound opcodes can access widget classes owned by Cabbage. Perhaps it was never meant to be used in this way, but it's super powerful. I'm not sure how I can do this without them? On Sat, 27 Jul 2024 at 11:20, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote: Hi Tarmo, |
Date | 2024-07-27 11:51 |
From | vlz |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
I think you should use hostdata for passing anything from host to Csound and vice-versa. It is probably more straightforward as you just pass the pointers directly. Would that be a problem? Prof. Victor Lazzarini Maynooth University Ireland On 27 Jul 2024, at 11:12, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2024-07-27 11:58 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
I can access host data using the CPOF? I never thought of this. On Sat, 27 Jul 2024 at 12:51, vlz <viclazzarini@gmail.com> wrote:
|
Date | 2024-07-27 12:03 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
I see it now in plugin.h, that's great. I'll give it a go for Cabbage 3. Actually, I can start using it now with Csound 6 right? On Sat 27 Jul 2024, 12:58 Rory Walsh, <rorywalsh@ear.ie> wrote:
|
Date | 2024-07-27 12:10 |
From | vlz |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
yes, that's right. Btw you can access any functions from the CSOUND structure by taking the CSOUND pointer with the relevant method in CPOF. Prof. Victor Lazzarini Maynooth University Ireland On 27 Jul 2024, at 12:04, Rory Walsh <rorywalsh@ear.ie> wrote:
|
Date | 2024-07-27 13:12 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
what is CPOF? On Sat, Jul 27, 2024, 07:10 vlz <viclazzarini@gmail.com> wrote:
|
Date | 2024-07-27 13:54 |
From | Rory Walsh |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
On Sat 27 Jul 2024, 14:13 Michael Gogins, <michael.gogins@gmail.com> wrote:
|
Date | 2024-07-27 13:54 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Attachments | favicon.ico |
Prof. Victor Lazzarini
Maynooth University
Ireland
On 27 Jul 2024, at 13:13, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2024-07-27 16:37 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi Victor,
Yes, that was it! I added it before starting the perfromance thread. Now sound works, only thing is that is exit CsoundQt crashes when destroying the circular buffer. csoundDestroyCircularBuffer(ud->csound, ud->midiBuffer); I tried to build Csound in debug mode to look into it (unchecked BUILD_RELEASE) but somehow CsoundQt did not find the plugins any more after that. Most likely the problem is in CsoundQt code and I guess now the Csound object gets destroyed before. I will test more later. Anyway - it is a step forward! tarmo Kontakt Victor Lazzarini (<000010b17ddd988e-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval L, 27. juuli 2024 kell 12:20: Hi Tarmo, |
Date | 2024-07-27 17:16 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Make sure the csound instance is still in existence before you call that function. In fact, if you destroy Csound before calling that, the circular buffer memory will be released as well, so you probably don’t even need to do it. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 27 Jul 2024, at 16:37, Tarmo Johannes |
Date | 2024-07-27 19:46 |
From | Werner Mendizabal |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hello, I tried the new changes of the new API and I was able to easily integrate them into the Godot game engine using my gdextension bindings. Everything is working great. I did have a few suggestions that I think could help facilitate using the api. I encountered a few methods that take a parameter to change behaviour of the method. Example: PUBLIC uint32_t csoundGetChannels(CSOUND *, int isInput); PUBLIC int csoundCompileCSD(CSOUND *csound, const char *csd, int mode); I think it might be easier for consumers of the api to have separate methods for some of these. Example: PUBLIC uint32_t csoundGetInputChannels(CSOUND *); PUBLIC uint32_t csoundGetOutputChannels(CSOUND *); PUBLIC int csoundCompileCSD(CSOUND *csound, const char *csd); PUBLIC int csoundCompileCSDString(CSOUND *csound, const char *csd); I believe that with these changes it makes it easier to use the methods without having to read through the documentation and it is also easier to type when using the api. Thanks, Werner. On Sat, Jul 27, 2024 at 11:17 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote: Make sure the csound instance is still in existence before you call that function. |
Date | 2024-07-27 20:05 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi, Yes, now it works as expected. I made now the most simple build of CsoundQt, later I will test with rtmidi and html support that might bring out more questions. At least in very initial variant of CsoundQt+Csound 7 works. It need much testing and might be unstable, of course. Best! tarmo Kontakt Victor Lazzarini (<000010b17ddd988e-dmarc-request@listserv.heanet.ie>) kirjutas kuupäeval L, 27. juuli 2024 kell 19:17: Make sure the csound instance is still in existence before you call that function. |
Date | 2024-07-27 21:01 | |||
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> | |||
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report | |||
Thanks for this. I think your suggestions are good, I'll see how I can accommodate them.
best
Prof. Victor Lazzarini
Maynooth University
Ireland
On 27 Jul 2024, at 19:57, Werner Mendizabal <nonameentername@gmail.com> wrote:
|
Date | 2024-07-27 21:03 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Thanks. That part hasn't changed, so hopefully it won't be a problem.
Victor
On 27 Jul 2024, at 20:06, Tarmo Johannes <trmjhnns@gmail.com> wrote:
|
Date | 2024-10-04 07:00 |
From | Blake Mitchell |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
I finally got around to testing out the new Csound 7 API with my .NET wrappers and updating what I had partially done for Csound 6. Things are working okay so far. A few follow-ups:
On Sat, Jul 27, 2024 at 4:03 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
|
Date | 2024-10-04 08:27 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Thanks. I’ll work on those things. best ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 4 Oct 2024, at 07:00, Blake Mitchell |
Date | 2024-10-04 08:52 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Not sure why you are getting these versions. These are defined in the CMakeLists.txt # Project definitions set(APIVERSION "7.0") set(CS_VERSION "7") set(CS_SUBVER "0") set(CS_PATCHLEVEL "0”) and are written to header files. Testing with this program on my system #include |
Date | 2024-10-04 15:58 |
From | Blake Mitchell |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Hi Victor, I got the builds from the GitHub Actions. I just scrolled down to the most recent `develop` build and downloaded the .zip file for Windows. If it helps, here's the exact name of the .zip file: "csound-7.0.0-2839-windows-x64-binaries.zip". Thanks for taking a look at and fixing the documentation! On Fri, Oct 4, 2024 at 3:52 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote: Not sure why you are getting these versions. These are defined in the CMakeLists.txt |
Date | 2024-10-04 16:12 |
From | vlz |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Ok, so there's something wrong with the build, but the version set in the codebase is correct. When you run csound in the command line what version is reported? Prof. Victor Lazzarini Maynooth University Ireland On 4 Oct 2024, at 15:58, Blake Mitchell <bmitchell33@gmail.com> wrote:
|
Date | 2024-10-04 16:14 |
From | Blake Mitchell |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Here's the output: > csound --version --Csound version 6.18 (double samples) Nov 23 2022 [commit: a1580f9cdf331c35dceb486f4231871ce0b00266] On Fri, Oct 4, 2024 at 11:12 AM vlz <viclazzarini@gmail.com> wrote:
|
Date | 2024-10-04 16:23 |
From | vlz |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
And you only have 1 version of Csound installed, nothing else lying around in your system? Prof. Victor Lazzarini Maynooth University Ireland On 4 Oct 2024, at 16:15, Blake Mitchell <bmitchell33@gmail.com> wrote:
|
Date | 2024-10-04 16:26 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
That’s a very old version, looking by the commit victor@firebird debug % git log a1580f9cdf331c35dceb486f4231871ce0b00266 commit a1580f9cdf331c35dceb486f4231871ce0b00266 (tag: 6.18.1, origin/master, master) Merge: be2520225 f9f44bada Author: John ffitch |
Date | 2024-10-04 16:32 |
From | Blake Mitchell |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Whoops. I ran that `csound --version` command local to the Csound 7 download directory, but for some reason, it still picked up the csound in my path. Sorry about that. Here is the correct output from the csound.exe I downloaded. > C:\Users\<username>\Downloads\csound-7.0.0-2839-windows-x64-binaries\build\Release\csound.exe --version --Csound version 7.0 (double samples) Oct 1 2024 For the API, though, is the csound64.dll completely self-contained? I had assumed it was, but given that the version of Csound in my path is 6.18.1 and the API returned version 6181, I'm guessing that the csound64.dll still relies on csound.exe? If so, that would explain the version returned by the API. On Fri, Oct 4, 2024 at 11:26 AM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote: That’s a very old version, looking by the commit |
Date | 2024-10-04 16:52 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
It’s the other way round, csound.exe is linked to Csound64.dll. The csound.exe is only a frontend. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 4 Oct 2024, at 16:32, Blake Mitchell |
Date | 2024-10-04 17:09 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
For Csound7 and beyond... Would it be worth creating some sort of script/makefile/brew/??? that could/would completely uninstall Csound and all its dependencies? Dr. Richard Boulanger Professor Electronic Production and Design Berklee College of Music > On Oct 4, 2024, at 11:52 AM, Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote: > > It’s the other way round, csound.exe is linked to Csound64.dll. The csound.exe is only a frontend. > ======================== > Prof. Victor Lazzarini > Maynooth University > Ireland > >> On 4 Oct 2024, at 16:32, Blake Mitchell |
Date | 2024-10-04 21:20 |
From | Blake Mitchell |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
At least for Windows, there is already an uninstaller for Csound 6. So, it turns out that my bindings were finding the csound64.dll for Csound 6 in my path. (I thought I was passing in a path to the new Csound 7 DLL, but that's on my side to figure out.) It just so happens that my bindings, despite being built for the Csound 7 API, were working with the Csound 6 API. A few notes:
Sorry about the confusion here. I'll keep plugging away now that I know I'm dealing with the right DLL. And thank you for the heads up on the DLL and EXE relationship. Just to double-check: csound64.dll require no other dependencies, correct? Thank you! On Fri, Oct 4, 2024 at 12:09 PM Dr. Richard Boulanger <rboulanger@berklee.edu> wrote: For Csound7 and beyond... |
Date | 2024-10-04 21:33 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
It will depend on the build, whether libsndfile is use as a dll or just .lib. Csound uses libsndfile but I don't know how the actual CI build does it.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 4 Oct 2024, at 21:20, Blake Mitchell <bmitchell33@gmail.com> wrote:
|
Date | 2024-10-05 09:03 |
From | Victor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] New API progress report |
Thanks, the APIVERSION was hardcode so I correct that in a recent PR. Need to chase the Csd versus CSD as the function name changed. ======================== Prof. Victor Lazzarini Maynooth University Ireland > On 4 Oct 2024, at 21:20, Blake Mitchell |