Csound Csound-dev Csound-tekno Search About

[Csnd] GEN52 issue

Date2023-09-14 15:00
From"Jeanette C."
Subject[Csnd] GEN52 issue
Hey hey,
I try to combine two audio channels from an audiofile into one interleaved 
table using GEN52:
iLeft = ftgen(0, 0, 0, 1, "input.wav", 0, 0, 1)
iRight = ftgen(0, 0, 0, 1, "input.wav", 0, 0, 2)
iLength = nsamp(iLeft)
iInterleaved = ftgen(0, 0, (iLength * 2), 52, 2, iLeft, 0, 1, iRight, 0, 1)

This fails with:
INIT ERROR in instr 2 line 57: deferred-size ftable102.000000 illegal here
iIR       ftgentmp.i      0 0       #i13    52      2       iLeft  0 1 
iRight   0       1
This fails irrespectively of a negative or positive table size, or whether the 
two channels come from one multichannel GEN01 table or several single channel 
GEN01 tables.

The task is: to get a stereo interleaved table for ftconv, never mind how many 
channels it has, as long as it's >=2 channels.

Tested with one stereo file directly passed into a GEN01 and then used in 
ftconv it works. So the file and table read operations up to that point work.

Any ideas or tips to further tackle the problem would be very welcome!

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

If only I could trade the fancy cars
For a chance today,
it's incomparable <3
(Britney Spears)

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

Date2023-09-14 20:16
Fromjoachim heintz
SubjectRe: [Csnd] GEN52 issue
sounds like a bug to me, and i think you should open an issue for it.

a workaround might be to write the first two channels of your input 
soundfile with a UDO to a stereo file, if this file has more channels 
than 2, and then use it in the way your describe.

another workaround could be to get the required length of the GEN01 
table from the soundfile, and then pass it to ftgen as argument.  so 
something like
iTableLength = filelen("input.wav") * filesr("input.wav")
iLeft = ftgen(0, 0, iTableLength, 1, "input.wav", 0, 0, 1)

if this works, it is certainly better than writing a file to disk ...

On 14/09/2023 11:00, Jeanette C. wrote:
> Hey hey,
> I try to combine two audio channels from an audiofile into one 
> interleaved table using GEN52:
> iLeft = ftgen(0, 0, 0, 1, "input.wav", 0, 0, 1)
> iRight = ftgen(0, 0, 0, 1, "input.wav", 0, 0, 2)
> iLength = nsamp(iLeft)
> iInterleaved = ftgen(0, 0, (iLength * 2), 52, 2, iLeft, 0, 1, iRight, 0, 1)
> 
> This fails with:
> INIT ERROR in instr 2 line 57: deferred-size ftable102.000000 illegal here
> iIR       ftgentmp.i      0 0       #i13    52      2       iLeft  0 1 
> iRight   0       1
> This fails irrespectively of a negative or positive table size, or 
> whether the two channels come from one multichannel GEN01 table or 
> several single channel GEN01 tables.
> 
> The task is: to get a stereo interleaved table for ftconv, never mind 
> how many channels it has, as long as it's >=2 channels.
> 
> Tested with one stereo file directly passed into a GEN01 and then used 
> in ftconv it works. So the file and table read operations up to that 
> point work.
> 
> Any ideas or tips to further tackle the problem would be very welcome!
> 
> Best wishes,
> 
> Jeanette
> 

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

Date2023-09-14 21:05
From"Jeanette C."
SubjectRe: [Csnd] GEN52 issue
Hi Joachim,
thanks for the workaround tip.s The second one is good. I may use this. For 
the time being I have limited the code to only accept stereo files, but I'd 
like to lift that restriction.

Best wishes,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

Can't make you love me
I'm just a girl with a crush on you <3
(Britney Spears)

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