Hi, I like to write csound code within Cabbage editor (on a Windows PC), but now I encountered a big problem: when my code is bigger than ~86KB the editor becomes slow and a little unresponsive. 86KB is not very big to me, and I think very soon my csound code will be much bigger than that, so I’m a little worried…
It is quite annoying, but there is not much I can do about it as it’s based on the JUCE code editor component. I just a large file into the JUCE demo editor and it suffers the same fate. The text editor in Cabbage is the weakest aspect of the whole project. it drives me mad, which is why I created CabbageLite for those who wish to use an external editor instead. The other thing would be to split the file into small fragments and use includes. While it’s never a bad idea to modularise one’s code, I’m not sure the error reporting from Csound will still work well when dealing with multiple files.
For what’s it worth, I did look into using a JS based editor within Cabbage, but an issue with how JUCE runs web pages is preventing me from using such a thing. At times like this one is reminded that JUCE is first and foremost an audio library
Btew, it’s also a reason I implemented this feature.
Nice! I will try with the “;- Region: tag” and, if it doesn’t work well, I will try modularizing my code. I hope I don’t have to use an external editor…
Is a CabbageLite binary available for Windows too?
Should be there right beside the main Cabbage program
Found it, thanks!
If I modify the code with another text editor, I suppose I have to reload the file in CabbageLite… Is there a key shortcut to reload the CSD in CabbageLite after I modded the csound file within another text editor without have to navigate in the Options menu?
No, it will automatically update for you. It checks the file on disk every second or so to make sure it has the most up to date version loaded.
Very nice, thanks!
Just to chime in, I edit all my Csound code, Cabbage stuff included, using Vim with Luis Jure’s Csound plugin and am generally very pleased with that setup. Editing source files with Vim and running them from Cabbage works pretty seamlessly in my experience. Even the main Cabbage program works fine as long as you just press the play button and don’t try to save the code from within the editor.
I gived up on using the editor integrated in Cabbage, because with my actual csound code (about 1600 lines) the editor is unbearably slow when I use my notebook in power saving mode (I don’t like the CPU fan runs at full speed only to edit a text file!).
Fortunately, the CabbageLite solution is very good for me. On Windows now I use CabbageLite with Notepad++, an open-source text-editor that is really really fast, despite all its features. With it you can easily define your User Defined Language for syntax highlighting and other things.
For those interested I attached an XML file you can import in Notepad++ to have the syntax highlighting for Csound code.
myCSOUND.xml (14.8 KB)
I use Visual Studio Code quite a lot these days. It has a Csound package, as too does Atom. That one is very nice.
I tried Atom on a Linux machine… It’s a very cool-looking text editor! It has a very nice and clean graphic style and I like the easyness with which you can display multiple documents next to each other. But with the Csound language pack installed, I think the auto-completion feature is so invasive that it’s annoying and I don’t know how to disable it (if you can).
File an issue on his github page. He usually responds quite quickly
I noticed that (on Windows) Atom installation file is 145MB vs 4.4MB of Notepad++ !!!
If I have to use an external text-editor with Cabbage, I prefer a little and fast one, so I think on Windows I will stick to Notepad++ (that does all I want: syntax highlighting, not-too-invasive code-completion, function list, code-folding, multi-document, multi-view, is fully customizable and… I already said this, but it’s very fast!!).
I just found that there is a “Notepad++”-inspired text-editor on Linux too: it’s called Notepadqq… I have to try it!
The other thing about Atom and Visual Code is they are Electron based, meaning they are huge memory consumers. Check these benchmarks. It’s almost impressive how much memory they use.
It’s really crazy… Now I have Notepad++ open with 8 tabs (8 different source code files) and the memory occupied is just 18MB of which 5MB are used by Notepad++ only and 13MB are shared with other apps. And Atom would use 256MB with only a single little file open? This is not my “idea” of text-editor… I know today we have plenty of RAM, but… I don’t know, maybe I’m too old-school…
P.S.: do the JUCE guys know of the editor slowness with big files? Do you think they will fix it soon?
I don’t think they will any time soon, it seems to be low priority with them. I must check if it’s sluggish on Windows and OSX. On Linux I found scrolling to be slow with very large files. I’ll check and if so I’ll get back to the JUCE guys and ask what’s up.
If it can help you, with my csound file (about 1630 lines), in Cabbage 2.0 (on a Windows 10 laptop in power saving mode), there are at least 1 or 2 seconds of lag between a key press and the display of a character in the editor area. But the strange thing is that sometimes I see a similar lag with a little file too… I think there could be something wrong with JUCE editor syntax highlighting routines (or the code that parses a line and display the opcode parameters in the helper bar under the editor area) that put too much stress on the CPU. Or maybe the regular expressions used are too complex. Have you tried to check if the editor control is slow without syntax highlighting or other things activated too?
Actually, this shouldn’t happen. I thought it was just a scrolling thing? I’ll take a look tomorrow.
I tested some of Iain’s largest instruments and I could not recreate this, even with the auto-complete enabled in Cabbage. Even files of over 10,000 lines cause me no issues (apart from sluggish scrolling). The latest Cabbage version is 2.02, is this the one you’re using?