Cabbage Logo
Back to Cabbage Site

Tweak Requests

A couple of tweak requests:

When editing the code from Cabbage’s built-in examples and saving or restarting the CSD, the edits are not applied because the CSD is stored in the applications folder and therefore cannot be overwritten. The misleading thing is that the changed code remains in the editor and no error or warning is given and this has caught a few students out. Would it be possible to provoke a warning dialogue upon a save attempt that the CSD needs to be saved to a location with user-save privileges?

The second tweak may be trickier. When using fout to render audio from Cabbage, the rendered file cannot be opened properly, even when the CSD is stopped. It is necessary to quit Cabbage for the file to be opened with audio contents revealed which is a slight pain. Can anything be done here?
Students lament the fact that CsoundQt has a built-in mechanism for recording audio. I have a feeling that this feature may have been discussed before in relation to standalone Cabbage.

This should be simple enough to do :+1:

You’re not wrong about this being a little tricker. I’ll take a look. Does using ficlose not solve the issue?

This example lets me open the wav file as soon as it has being written, even though the instrument is still performing? I’m on MacOS…

form size(500, 300), caption("Untitled") nchnls = 2 0dbfs = 1

instr 1
avco vco2 p5, p4
outs avco, avco
fout “/Users/rwalsh/Desktop/test.wav”, 4, avco

f1 0 1024 10 1 i1 0 5 200 1 f0 z

My experience is that the file can be opened but contains nothing useful (headerless?) until quitting Cabbage.

ficlose needs a handle and therefore will only work with fiopen and not fout.

Ok, in my tests the instrument that was doing the recording had finished before I tried the sound file. So it seems that stopping it during recording leaves the file process open somehow. It’s strange because Csound gets destroyed after each run. It is a pain. I’ll investigate when I get a chance. You don’t have class again till September right, I have some time :rofl:

I was showing my two-line method for capturing audio in Cabbage using monitor and fout to the student and they complained: “I have to write all that code? In CsoundQt I just have to hit a button”. Victor teaches just using CsoundQt (perhaps you should have a word) so by the time they reach me I have to convince them of the benefits of Cabbage. To be honest, quitting Cabbage each time is not a big deal, it’s just a mild embarrassment for demos.

How does it go in CsoundQT? You hit record, and the csd plays whilst CsoundQT records the output to a file, do you need to name the file first, or is it just some generic name?

It’s an alternative to hitting play (it activates the play/perform button at the same time) so it just captures the audio from the entire performance and puts it into a sound file with the same name as the CSD with “-000” appended, incrementing each time another recording with the same CSD is made. The sound file is placed in the same directory as the CSD. The sound file is accessible while CsoundQt is still playing the CSD so I guess it is periodically overwriting the file with a header.

Thanks Iain. I can look into doing this. It’s a little more complex here because I have to capture the output of the entire graph rather than one .csd - but I’ll take a look.

I’ve fixed the issue of fout not writing until Cabbage is closed. I’m also looking into a simple realtime render to disk ala CsoundQT. I’ll let you know when I’ve pushed the changes.

I just pushed a new way to record to the develop branch. Simply hit the ‘rec’ button on the file tab and Cabbage will record the output of that instrument to a file with the same name as the .csd file. Note subsequent runs will overwrite the previous output file. I can change this in the future, but I’m running out of time here today…

That’s amazing, Rory.

The fout thing works from my side too.

The ‘rec’ feature works as described. It creates a mono, 16-bit sound file. Could the channel count reflect nchnls? Also, could the bit depth be selected in Cabbage Settings? 32-bit float would be great option to include as clipped audio could then be rescued.

I’m amazed you were able to implement this so quickly. It will be very useful for many users. I sometimes encourage student to request features they think are missing but I suspect they think that Cabbage Inc. is a huge, faceless corporation that won’t listen to them.

Thanks for testing this Iain. All the elves here at Cabbage Inc. worked tirelessly to implement it :rofl:

The output should match the nchnls, I didn’t even test it to be honest. I must have gone awry somewhere.
Adding a bit-depth setting is a good idea. I will take a look when I get a chance. Probably won’t be till later in the week. :+1: I’m not sure how well the icon looks but it will do as a placeholder until I can work out something better :slight_smile:

It’s fine as a placeholder but it is an oval and if the file name is long, it gets hidden:

Is there any reason why some of these tab buttons can’t be on the main toolbar? If pressed they can then be applied to the CSD tab that is in focus.

That sounds like way too obvious a solution :rofl: I will take a look. Having them as children of the tab makes it easy to keep track of them. But the rec button could definitely be there. Good shout. And I could probably work in a nicer logo too :+1:

1 Like

I just pushed some updates on this. I moved the record button to the main tool bar, and added a bit-depth setting. It’s 32 by default. I also sorted the channels issue. :+1:

I’m not having much luck with this. Is it supposed to record a file with the same name as the currently focussed .csd and in the same location?
I found the bit depth setting, there are both floating-point and fixed-point 32 bit formats so I imagine that this will have to be set using a drop-down list. Should this setting not go in the ‘Audio and MIDI’ tab?

Yes, so long as you have write access to that directory, so for me here it won’t work when I try to record one of the examples, I need to first save it to a location I have access to. But apart from that, it seems to work fine for me.

With JUCE we can only set the bit depth in ints. So I think it’s Ok to have a text box? Although anything under 8 is not supported it seems.

Probably, but that will involve more work as that Audio/MIDI settings window is a JUCE component in itself, so I’d need to hack it in order to add an extra field. :frowning:

p.s. I could add a recording output directory to the settings either so that all recordings end up in the same place?

Okay, got it now. I have to press REC first and then play on the CSD. Stopping record doesn’t stop the recording, even if the button deactivates, only stopping the CSD does. This is all fit for purpose, just aspects of the procedure weren’t entirely intuitive for a dunce like me.

How about this:
Pressing REC, REC blinks continuously until a CSD is played when it goes solid red. Pressing REC again while the CSD is still playing does nothing. Only stopping the CSD deactivates REC once recording has begun. Have I just made your life a nightmare?

Selecting an output folder could be a useful but this could be a tickable option with the default being the same directory as the CSD.

1 Like

My life is a constant nightmare, don’t worry about it :rofl:

Blinking and flashing all sound great but I’m not sure how easy it will be to achieve it. So we might have to think about a solid colour scheme, but I’ll take a look and let you know. :grin: