Cabbage Logo
Back to Cabbage Site

Channel name string lengths

Not sure what’s going on here as I can’t seem to find any restrictions in CSound for string lengths for channel names. Does CSound have limitations on string lengths? I thought I saw something like 256 characters, but I can’t seem to find where I might have read this.

I’ve created a program where all the widgets are generated using cabbageCreate, and the names for the channels are chunks of strings that get concatenated. When I read back the channel names once I’ve created them, I noticed that some of the longer names are truncated.

I am curious is this a limitation of CSound or Cabbage, or something else? It also appears that I can still call these widgets with the full length string, and cabbage returns the correct widget and it’s associated data.

Guess I’m just wondering if there are any issues regarding string lengths? I assume that as long as the strings are still unique when truncated, then there shouldn’t be an issue. Right?

Can you prepare a simply .csd to demonstrate? There are definitely string limitations in Csound, but as far as I know it’s a lot longer than 256 chars. This sounds to me like an issue with Cabbage rather than Csound. A .csd will help a lot :wink:

OK, I created a short example, but it doesn’t truncate the channel names like my other program is doing. I zipped up the relevant files, and if you run it in Cabbage, you should see a listing of all the channels that are created, and when I run it, all of the channel names are limited to 15 characters. I also included my attempt to recreate this… I used the same snippet of code to display the names created.

filenametest.zip (302.3 KB) longchannelnames.csd (942 Bytes)

Here are a couple of screen captures of the output I am getting. The highlighted text in the first file (“rightband1cente”) should have an ‘r’ at the end of the string. But if you notice the other capture shows a much longer string.

Screen Shot 2021-06-26 at 10.17.52 AM

Thanks for posting these, I’ll take a look and see if I can work out what’s happening.

Looks good to me.
Screen Shot 2021-06-26 at 17.55.43

I’m using 2.7.1 is that’s any help. This is the output from the console:

bounds(450, 0, 250, 150) channel("leftear") parent("aWindow") colour(255, 255, 255, 255) backgroundColour(0, 255, 0, 255) displayType("spectroscope") signalVariable("aLeft") zoom(-1)
bounds(450, 150, 250, 150) channel("rightear") parent("aWindow") colour(255, 255, 255, 255) backgroundColour(0, 0, 255, 255) displayType("spectroscope") signalVariable("aRight") zoom(-1)
index: 0 one.wav ear: 0
str: form1
str: aWindow
str: wavedisplay
str: wavespectrogram
str: voicesrc
str: noisesrc
str: earlink
str: randomize
str: left
str: left_lab
str: left1
str: left2
str: left3
str: left4
str: left5
str: left6
str: leftband1
str: leftband1center
str: leftband1width
str: leftband1gain
str: leftband2
str: leftband2center
str: leftband2width
str: leftband2gain
str: leftband3
str: leftband3center
str: leftband3width
str: leftband3gain
str: leftband4
str: leftband4center
str: leftband4width
str: leftband4gain
str: leftband5
str: leftband5center
str: leftband5width
str: leftband5gain
str: leftband6
str: leftband6center
str: leftband6width
str: leftband6gain
str: right
str: right_lab
str: right1
str: right2
str: right3
str: right4
str: right5
str: right6
str: rightband1
str: rightband1cente
str: rightband1width
str: rightband1gain
str: rightband2
str: rightband2cente
str: rightband2width
str: rightband2gain
str: rightband3
str: rightband3cente
str: rightband3width
str: rightband3gain
str: rightband4
str: rightband4cente
str: rightband4width
str: rightband4gain
str: rightband5
str: rightband5cente
str: rightband5width
str: rightband5gain
str: rightband6
str: rightband6cente
str: rightband6width
str: rightband6gain
str: leftear
str: rightear
leftband1center leftband1width leftband1gain rightband1center rightband1width rightband1gain
leftband2center leftband2width leftband2gain rightband2center rightband2width rightband2gain
leftband3center leftband3width leftband3gain rightband3center rightband3width rightband3gain
leftband4center leftband4width leftband4gain rightband4center rightband4width rightband4gain
leftband5center leftband5width leftband5gain rightband5center rightband5width rightband5gain
leftband6center leftband6width leftband6gain rightband6center rightband6width rightband6gain
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
index: 1 two.wav ear: 1
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000
2000.000000 200.000000 1.000000

Good thing you posted the text of what you got rather than just the screen capture. If you look further down for the ‘rightband3cente’, it’s missing the ‘r’ at the end. It seems to be that there is a 15 character limit, but I can’t make it happen anywhere else. Also, I’m still using 2.7.

I see it. Ok, I have something to go on now :wink:

I have a fix for this. Can you test it out when you get a chance? It looks like I need to allocate an extra char when outputting strings from a Csound opcode. I’ve updated all other opcodes that also output strings as I assume they suffer the same issue with longer strings.

Works great! So, this had to do with creating strings in a UDO? Guess I’ll just have to make everything a UDO from now on!

Thanks, again! Rory!

No no, nothing on your side. It was an issue on my end. :+1: Work away as you were doing.

I understood. I was trying to make a joke. I figured since cabbageCreate is a new thing, and we were able to find this bug, I figured I’d keep you busy with more UDO’s!

Sorry, I’m usually a little slower on the weekends :joy:

Too much or not enough beer?

Good question! :rofl:

1 Like