[Csnd] Possible bug in "fin"-opcode?

Dear list,

as we were just discussing Ambisonic and Csound, here is something slightly related to it:
As I do now work up to Ambisonic 7th order, I do need to be capable of also reading in a 64-chnl soundfile into Csound.
"Soundin" and "diskin" are both limited to 40 chnls. So I gave "fin" a try.
The problem is that, although fin reads in my soundfile, it does this with a speed which seems to be related to the number of channels to read in.
This means that a 64 chnl soundfile of 10 minutes duration is compressed to a few seconds duration. For an 9-chnl soundfile there is less compression but still it ends up at approx 15 seconds. The content of the soundfile can be still perceived, but with lots of distortion and at a multiple of the original speed. All this seems to be independent of the file-format I do use, it happened with both .wav and .caf-files the same way.
As this is not the behaviour I would expect I do wonder if there is a bug or if I have missed something?

Here is what did:
- I used Csound 6.18 on a mac
- I initialized all audio-variables to be used beforehand like this: a1 init 0 ....
- iformat was assigned with "0" to use the format from the header of the soundfile.

Maybe somebody has some idea about that?

Best,

Jan Jacob

sound | movement | object | space
sonic architecture | site: http://www.sonicarchitecture.de
spatial electronic composition | higher order ambisonic music

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

I thought that diskin2 with array output would open any file with any number of channels and that the 40-channel restriction was for the multi-output. I have not checked this, but John would know.

Prof. Victor Lazzarini
Maynooth University
Ireland

Can you confirm that this is fin with lots of channels and not the array form?

I have glanced at the code and it is fily cmplex. Ideally I would lke an actual example ssshort as possible. Sent to me not the list to limit confusion.

==John ff

Dear John,

yes, I can confirm that it’s the one with the plenty of channels, not the array. I will prepare a nice example…

Cheers,

Jan Jacob

sound | movement | object | space
sonic architecture | site: http://www.sonicarchitecture.de
spatial electronic composition | higher order ambisonic music

Dear John, dear list,

thanks, I now prepared a nice little example with „fin" and „soundin" to choose by commenting one of them out. I also prepared a short 16 chnl wav- file for testing.

Both may be downloaded from my server:

http://www.sonicarchitecture.de/downloads/fin-test.zip

Best regards,

Jan Jacob

sound | movement | object | space
sonic architecture | site: http://www.sonicarchitecture.de
spatial electronic composition | higher order ambisonic music

As I said before, you don’t need to use fin to read a multichannel file with 64 channels (or more).
Diskin or diskin2 will do it.

I have tested it with 64 channels and it works. Here are my 2 test CSDs.

1. Produce a 64 channel file:

<CsoundSynthesizer>
<CsOptions>
-o64.aif
</CsOptions>
<CsInstruments>
0dbfs = 1
nchnls = 64
instr 1
a1 oscili 0.5,440
outch 64, a1
endin
</CsInstruments>
<CsScore>
i1 0 1
</CsScore>
</CsoundSynthesizer>

2. Read the 64 channel file

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
0dbfs = 1
instr 1
aout[] diskin "64.aif"
out aout[63]
endin
</CsInstruments>
<CsScore>
i1 0 1
</CsScore>
</CsoundSynthesizer>

(this example is a nice one for the diskin opcode manual page…)

Dear Victor, dear John, dear list,

yeah, thanks for the hint, diskin (array version) seems to work in my sense, currently I am working myself towards a solution.
Thanks for the code, Victor, I now see it is not so difficult to work with arrays, it's the first time I am trying that. (Sorry, I have been too reluctant to work my self into that array-subject until now because I always thought it was difficult)

But I also found that my fin-test.csd crashes with the array version of fin without a warning with my very simple 16chnl test-file. The code is basically like this, nchnls is 16:

    fin        &quot;fin\-testfile\-16chnl\.wav&quot;, 0, 0, arr\_\[15\]     ; read in multichannel\-file

What did I do wrong? Any hint? I guess it would be nice if also fin would work in both versions (array and conventional output) but I also guess that diskin will work for me fine in the array-version.

The only drawback of diskin is that I need to set nchnls to 64 for array-reading-in a 64-chnl file. My soundcard supports 8 chnls in maximum, so I will not be able to output an 8-chnl decode in realtime of that 64-chnl Ambisonic encoded input file with diskins array-version. Or is there a way to decorrelate the number of channels from the number of array-fields generated by diskin (which in turn again seems to be dependent from the number of channels the soundfile yields)?

Best wishes + thanks,

Jan Jacob

sound | movement | object | space
sonic architecture | site: http://www.sonicarchitecture.de
spatial electronic composition | higher order ambisonic music

With diskin/diskin2 as I showed you, nchnls is independent of number of channels in a file.

I suggest forgetting fin and working with diskin2 which is much better.

Prof. Victor Lazzarini
Maynooth University
Ireland

I do not understand your fin example. you read one chasnnel orf the 16?

what are you doing with the other 15? The man page for fin states "The user must be sure that the number of channels of the input file is the same as the number of ainX arguments. "
but your example line only gives 1 which is stored in arr_[15], so this id not an array use but just one lement in the array.

Probably I am confused -- I normally am.

==John ff