Csound Function Table Scaling Error
Date | 2016-01-29 02:29 |
From | "akshay.rama" |
Subject | Csound Function Table Scaling Error |
I am currently working on a multi channel audio convolver using Csound. I am creating two ftables and loading an Impulse Response 2048 points long into them at a sample rate of 48kHz. I am using the first gen function table commands (iRL ftgen 0, 0, 2048, -1, "IRL.wav", 0, 0, 0) and (iRR ftgen 0, 0, 2048, -1, "IRR.wav", 0, 0, 0 ). One problem i currently have is setting the function table number to negative (-1) does stop scaling but each ftable is scaled differently. One scalemax value is 0.155 and the other 0.145. This causes a shift in the stereo image toward the left the (table scaled by 0.155). I was wandering wether it would be possible to stop this scaling from happening. -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-01-29 03:53 |
From | "akshay.rama" |
Subject | Re: Csound Function Table Scaling Error |
I have attached a link to my code and also the console output of csound when running the file. Both the Impulse Responses are Stereo IR's. https://www.dropbox.com/sh/q5hw3c3aa5jmvk0/AAAOne2ZeLTfV4snhiKV7p7qa?dl=0 -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749p5746750.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-01-29 04:11 |
From | Steven Yi |
Subject | Re: Csound Function Table Scaling Error |
Hi Akshay, I think you posted this question on Stackoverflow and I'll reiterate one part of Joachim's answer: are you sure the two files for the Stereo IR don't have two different maxima? Could you post the IR files? steven On Thu, Jan 28, 2016 at 10:53 PM, akshay.rama |
Date | 2016-01-29 04:20 |
From | "akshay.rama" |
Subject | Re: Csound Function Table Scaling Error |
Hi Steven, Both the files do have a slightly different maxima, but I do not wan't csound to make this maxima the same since it causes the stereo image to shift position to either the left or right depending on which is scaled more. Would it be possible to completely skip the scaling so it uses the two impulse responses in the same format I provided? I was initially using the pconvolve opcode in csound and this worked perfectly, but I am currently trying to use a function table so I can get rid of the IR files after csound has loaded it. -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749p5746752.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-01-29 05:02 |
From | Steven Yi |
Subject | Re: Csound Function Table Scaling Error |
I think the scalemax is reporting the abs max and not a scaling coefficient (if I interpreted the code it correctly, the message is reporting what the winascii driver is scaling value by for drawing, which would be the max values). I haven't used ftconv before: Are IRL and IRR both stereo wav files? Also could you post what you used for pconvolve? On Thu, Jan 28, 2016 at 11:20 PM, akshay.rama |
Date | 2016-01-29 05:35 |
From | "akshay.rama" |
Subject | Re: Csound Function Table Scaling Error |
Hi Steven, I have attached the pconvolve code on the dropbox link too. (https://www.dropbox.com/sh/q5hw3c3aa5jmvk0/AAAOne2ZeLTfV4snhiKV7p7qa?dl=0) With the following code, the pconvolve function's audio output is perfectly centred, but with the ftconv opcode, the stereo image is instantly shifted slightly to the left. This is why I think the impulse response files are still being scaled. Both IRL and IRR are stereo WAV files. The reason i shifted to the ftconv opcode is because I need to be able to delete the wav impulse response files from the hard disk as soon as csound initializes and loads the files. With pconv deleting the file causes an error ( i think this is because it reads through the wav file every time the filter is activated). Thanks -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749p5746754.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-01-29 08:59 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
Can you provide the IR files so we can investigate? ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 29 Jan 2016, at 05:35, akshay.rama |
Date | 2016-01-29 09:06 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
yes, scalemax reports the max value at the table. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 29 Jan 2016, at 05:02, Steven Yi |
Date | 2016-01-29 09:23 |
From | Karin Daum |
Subject | Re: Csound Function Table Scaling Error |
another possibility I would try is combining the two stereo IR files into a single 4 channel IR file you would then use: gir ftgen 0, 0, 2048, -1, "IR4chwav", 0, 0, 0 ; e.g. chan1,2==irL, chan3,4==irR then adummy1, adummy2,ar3 , ar4 ftconv gaR, gir, ipartitionsize, 0, 0, 0 ar1 , ar2,adummy1,adummy2 ftconv gaL, gir, ipartitionsize, 0, 0, 0 this should preserve the relative amplitudes among the channels cheers, Karin > On 29 Jan 2016, at 06:35, akshay.rama |
Date | 2016-01-29 09:42 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
That is a good idea, then you don’t even need to suppress rescaling. In any case, I just went and checkrf all the steps with a stereo IR I created, and I could not find any problems, the outputs of pconvolve and convolve are identical. Rescaling is suppressed as expected. This is the test. “ir.wav” is any stereo IR, and “input.wav” is any mono input file. nchnls=2 0dbfs=1 gi1 ftgen 1,0,0,-1,"ir.wav",0,0,1 gi2 ftgen 2,0,0,-1,"ir.wav”,0,0,2 instr 1 a1 diskin “input.wav" a2 ftconv a1,1,512 a3 ftconv a1,2,512 outs a2,a3 endin instr 2 a1 diskin “input.wav" a2,a3 pconvolve a1,"ir.wav",512 outs a2,a3 endin So whatever the problem is, it is not with rescaling, and not with ftconv. Regards ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 29 Jan 2016, at 09:23, Karin Daum |
Date | 2016-01-29 18:06 |
From | Steven Yi |
Subject | Re: Csound Function Table Scaling Error |
I looked at the code to pconvolve and ftconv (ftconv does some scaling by calling csoundGetInverseRealFFTScale and multiplying, but that function always returns 1.0, so it's not a factor). I also didn't see anything significant between the pconvolve and ftconv examples. On the other hand, I just realized looking at the screenshot that Akshay is using Csound 5.17. I have no idea if there was any changes between then and now that might contribute to this (whether it's in the gen01 code, or the convolution opcodes). At this point, it'd be best to get the IR's to test. Also, if Akshay could try on Csound 6 that would give more information. On Fri, Jan 29, 2016 at 4:42 AM, Victor Lazzarini |
Date | 2016-01-29 18:21 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
Very difficult to say anything about 5.07. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 29 Jan 2016, at 18:06, Steven Yi |
Date | 2016-02-02 07:20 |
From | "akshay.rama" |
Subject | Re: Csound Function Table Scaling Error |
I can't provide the IR files since they are intellectual property. For the past few days I have been trying the same code on my mac. On my mac, there seems to be no difference in the audio output and there is no scaling. However when running it on the Beaglebone Black the same problem persists. I have upgraded to csound 6.07 on the beaglebone, but there still seems to be apparent scaling. I have attached a screenshot of the printed output in the same dropbox link. I have also tried changing the order of the convolution to see if it affected the audio output and was the reason the stereo image seems shifting to the left, however this has no affect in the audio output. -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749p5746883.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-02-02 07:24 |
From | "akshay.rama" |
Subject | Re: Csound Function Table Scaling Error |
Hi Karin, This seems like a great way to ensure none of the stereo ir files are scaled differently. I have been trying to implement this, but after loading the 4 channel IR file using : ir4 ftgen 0, 0, 2048, -1, "IR4ch.wav", 0, 0, 0 I cant seem to find a way to split it into two different variables ( chan1,2 == irl , chan3,4 == irr ) before using it for the convolution. Thanks, -- View this message in context: http://csound.1045644.n5.nabble.com/Csound-Function-Table-Scaling-Error-tp5746749p5746884.html Sent from the Csound - General mailing list archive at Nabble.com. 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 |
Date | 2016-02-02 08:22 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
Well, can you provide any examples of the issue with other files than the copyrighted ones? We can’t reproduce what you describe with any files here. I showed an example here that demonstrated that scaling is suppressed correctly and that pconvolve and ftconv behave identically. If it is working on the Mac and not on the Beaglebone, maybe there is a hardware issue. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 2 Feb 2016, at 07:20, akshay.rama |
Date | 2016-02-02 10:05 |
From | Karin Daum |
Subject | Re: Csound Function Table Scaling Error |
Attachments | oneping0305_2050_0_87_59.wav oneping1505_2050_0_87_59_stereo.wav |
well, I’m not an expert on Csound. I’m just starting and convolution with pulse response files (surround 5.1 in my case) was the first thing I looked at. My proposal was just tailored to your example. I’m afraid there is no simple way by means of a single opcode to extract the two channels to another function table directly. I guess you would need to do it by hand using table and then writing it to an empty table via tablew. I have just a similar problem having stored a couple of small pieces of sound in tables which later-on have to be processed. Concerning pulse response files Victor asked for, I’ve attached two pulse response files I’ve calculated for two different source position in my setup ( a virtual room of 20 x 50 metres high reflectivity of 0.87 resulting in a hall time T_60 of about 4 second - something like a cathedral) for 5.1 and then converted to stereo. These can be used for tests. cheers, Karin 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 > On 2 Feb 2016, at 08:24, akshay.rama |
Date | 2016-02-02 10:11 |
From | Karin Daum |
Subject | Re: Csound Function Table Scaling Error |
I forgot to say that the channels are stored for every sample t as ch1,ch2,ch3,ch4 so for a given ksmps you would need to read 4*ksmps elements from the table in the order ch1,ch2,ch3,ch4,ch1,ch2,ch3,ch4,… cheers, Karin > On 2 Feb 2016, at 08:24, akshay.rama |
Date | 2016-02-02 10:24 |
From | Victor Lazzarini |
Subject | Re: Csound Function Table Scaling Error |
Thanks for the files, but I need someone to provide an example showing the rescaling is not happening (or that there is some other fault). ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 2 Feb 2016, at 10:05, Karin Daum |
Date | 2016-02-02 10:53 |
From | Anders Genell |
Subject | Re: Csound Function Table Scaling Error |
Maybe the original poster could try, on the beagle bone, with the files generously provided by Karin and write the output to disk to allow analysis of the results? Regards, Anders On Tue, Feb 2, 2016 at 11:24 AM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Thanks for the files, but I need someone to provide an example showing the rescaling is not happening (or that there is some other fault). |