Re: [Csnd] What is the difference between "sum" and "+"?

Hi Scott,

in my setup the 220hz-tone gets trough only in the second instrument. In instr 1 there is only the 440hz tone audible, the 220hz sound is missing..

This is not audible in the speakers of my laptop (as they do not transmit sound of lower pitch very well anyway) but with headphones the difference is well audible.

Now I wonder what the reason for that could be...

Cheers,

Jan Jacob

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

Just update your Csound version or use ‘+’ only

Dear Victor, dear list,

I updated to today's version now - same result. I now also changed the frequency of the test-tone to 683 hz instead of 220 (see .csd below), so it is easier to recognize: In instr.1 the 683 hz tone does not get through, while in instr.2 it is clearly audible.

Somehow the 683 hz signal is overwritten in instr.1. I would not have expected that and I am interested to learn why that is so...

My csound-version is now:

--Csound version 6.18 (double samples) Sep 26 2022 [commit: 0202b14ac91c4e297e99462333116a537cb4790b]

(on Ubuntu 20.4)

Best,

Jan Jacob

<CsoundSynthesizer>

<CsOptions>

</CsOptions>

<CsInstruments>

sr = 44100

ksmps = 128

nchnls = 2

0dbfs = 1.0

instr 1

aout = 0

aout0 oscil .2, 683

aout sum aout, aout0

aout1 oscil .2, 440

aout sum aout, aout1

outs aout, aout

endin

instr 2

aout = 0

aout0 oscil .2, 683

aout = aout + aout0

aout1 oscil .2, 440

aout = aout + aout1

outs aout, aout

endin

</CsInstruments>

<CsScore>

i1 0 1

i2 1.2 1

</CsScore>

</CsoundSynthesizer>

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

Looking at the code the report is correct and the problem has to do with using the same variable for output as for input. The output should be correct if you use another variable for output.

The problem relies on the fact that the output variable is used as the accumulator for the sum and is cleared at the beginning of each cycle.

Here is a fix: fix sum by gesellkammer · Pull Request #1634 · csound/csound · GitHub

cheers,

Eduardo

Dear Eduardo, dear list,

so - to answer my question of the subject-line of this thread - there actually should not be any difference between „sum“ and „+“.
I had wanted to make sure first that I had not misunderstood something of the Csound language.
I thus will file a bug soon. Thanks for dealing with that to all…

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

Dear list,

there really was a bug in sum which is fixed since yesterday. Now sum works like expected.
Thanks Eduardo and Victor.

Cheers,

Jan Jacob

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

Fantastic news.

Dr. Richard Boulanger
Professor
Electronic Production and Design
Berklee College of Music

Thanks Eduardo. I didn’t do anything :wink:

Thanks, Eduardo. Thanks to all who work so hard on the code.