Cabbage Logo
Back to Cabbage Site

The Sample Rate of one Cabbage Instrument

Hi,

one stupid situation/question:

I work in Reaper at SR 44100 24bit but I exported one Cabbage Instrument that have one sr = 48000 (NO flag for bith depth)
What is the real SR and BIT depth of this instrument in my Reaper rendered file/project?

again

in the Cabbage Edit/Settings/Audio and MIDI/Sample Rate = 44100
but I set sr = 48000 in the Cabbage Instrument Header.

what is the audio sr and BIT depth for this instrument?

Thanks

I believe Csound processes samples internally at 64bit. When the sound is output from Csound, the audio module takes care of the bit depth. So Reaper will set the bit depth before outputting sound. Good question about the sampling rate. I never really gave it much throught, but I think they actually run independently of each other. The sample rate you set for Csound will be used by Csound, and likewise the one you set for Reaper will be used by Reaper. Cabbage can run at a different sampling rate than the host. If not, you would hear repitching when you changed the sampling rate.

[edit] when working with sound files I believe things are different. I don’t think Csound does any realtime resampling of sound files.

Hi,
I have tested this now, and find that the interfacing between the host and Csound may have problems related to sample rate. Really, it would be practical if Csound/Cabbage could pick up the sampling rate of the host, and then use that (unless sr is explicitly set in the csd).
I always thought this was the way it worked, but now I tested, and see that it does not. This means that a change of sample rate in the host will make the plugin change pitch. Apparently (I am guessing here, based on what I hear), Csound produces a chunk of samples, and this chunk is used by the host as if it has the correct sample rate. This means that running at 96000, asking for a 6kHz sine tone, I get a 12 kHz sine tone.
If sr is not specified, it will run at 44100, regardless of the host sampling rate.

Tested in Reaper with the attached csd
sinetst.csd (738 Bytes)

Hi Oeyvind. Cabbage should assume the sample rate of the host if it is not set by the user. I just checked the source code and it looks Ok to me. Can you print sr to the console in your Cabbage plugin to confirm the problem. Sorry, I don’t have access to a host at the moment, otherwise I’d try myself.

Btw, what version are you using? I only made this change in February. The latest beta build is here.

Ah, ok, yes, it works like I had hoped in the latest beta.
I did recently download the latest version visible on the web page, since I will be teaching, and expect the students will probably find that version first.
All good then. Sorry for the noise. Wish for the beta to be published!

When does teaching start for you? I will publish this beta as soon as I return to Ireland in a few weeks.

Monday :-),
but it will be until next Monday before I use Cabbage.

Ok. Maybe you can direct them to the beta link in that case. In the meantime I will try to get a colleague of mine to update the site before I get back :wink:

p.s. ther eis a bug in this version when working with the patcher. I’ll need to sort that first…

Will do.

Hi…as per experience the sample rate you set for Csound will be used by Csound, and likewise the one you set for Reaper will be used by Reaper. Cabbage can run at a different sampling rate than the host. If not, you would hear repitching when you changed the sampling rate.

seo consultant

Actually, that’s what used to happen, and will do still if you set a different sample rate in Csound to say Reaper. The best thing to do is leave out the sample rate definition from your .csd file, and then Cabbage will set it to be the same as the host. Therefore you’ll hear no strange re-pitching of the signal.

@Oeyvind I’ve released a new version and updated the website. :wink:

Perfect. Thank you so much!