Csound Csound-dev Csound-tekno Search About

[Csnd] question concerning virtual pitch

Date2020-08-30 17:15
FromStefan Thomas
Subject[Csnd] question concerning virtual pitch
Dear community,
in the below quoted example I expect to hear the pitches a4 (midi note number 69) and a3 (note number 57) but they seem to be an augmented fourth lower.
It seems to be the phenomenon of virtual pitch.
My question is:
is there a formula available that allows us to calculate the perceived fundamental?
Here is my short patch:
<CsoundSynthesizer>
<CsOptions>
-odac  -m0d
</CsOptions>
; ==============================================
<CsInstruments>

sr = 44100
ksmps = 100
giWave ftgen 0,0,16384,10,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1/2,0,0,0,1/3,0,0,0,1/4,0,0,0,1/5
nchnls = 2
0dbfs = 1
instr 1
idur = p3
icps = p4/12
iamp = p5
kenv linseg 0,0.03,1,idur,0
aSound poscil iamp*kenv,icps,giWave
outs aSound,aSound
endin

</CsInstruments>
; ==============================================
<CsScore>
i1 0 1 440 0.2
i1 1 1 220 0.2

</CsScore>
</CsoundSynthesizer>


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

Date2020-08-31 15:43
FromSteven Yi
SubjectRe: [Csnd] question concerning virtual pitch
Hi Stefan,

I didn't try the file but I saw that the ftable generated has its
first harmonic value at the 11th but you are dividing cps by 12.
Perhaps this is causing an issue here?

steven

On Sun, Aug 30, 2020 at 12:15 PM Stefan Thomas
 wrote:
>
> Dear community,
> in the below quoted example I expect to hear the pitches a4 (midi note number 69) and a3 (note number 57) but they seem to be an augmented fourth lower.
> It seems to be the phenomenon of virtual pitch.
> My question is:
> is there a formula available that allows us to calculate the perceived fundamental?
> Here is my short patch:
> 
> 
> -odac  -m0d
> 
> ; ==============================================
> 
>
> sr = 44100
> ksmps = 100
> giWave ftgen 0,0,16384,10,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1/2,0,0,0,1/3,0,0,0,1/4,0,0,0,1/5
> nchnls = 2
> 0dbfs = 1
> instr 1
> idur = p3
> icps = p4/12
> iamp = p5
> kenv linseg 0,0.03,1,idur,0
> aSound poscil iamp*kenv,icps,giWave
> outs aSound,aSound
> endin
>
> 
> ; ==============================================
> 
> i1 0 1 440 0.2
> i1 1 1 220 0.2
>
> 
> 
>
>
> 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

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

Date2020-08-31 20:16
FromStefan Thomas
SubjectRe: [Csnd] question concerning virtual pitch
Dear Steven,
yes, this is obviously wrong, the pitch must be divided through 11. But I still do not hear the a4 or a3!


Am Mo., 31. Aug. 2020 um 16:43 Uhr schrieb Steven Yi <stevenyi@gmail.com>:
Hi Stefan,

I didn't try the file but I saw that the ftable generated has its
first harmonic value at the 11th but you are dividing cps by 12.
Perhaps this is causing an issue here?

steven

On Sun, Aug 30, 2020 at 12:15 PM Stefan Thomas
<kontrapunktstefan@gmail.com> wrote:
>
> Dear community,
> in the below quoted example I expect to hear the pitches a4 (midi note number 69) and a3 (note number 57) but they seem to be an augmented fourth lower.
> It seems to be the phenomenon of virtual pitch.
> My question is:
> is there a formula available that allows us to calculate the perceived fundamental?
> Here is my short patch:
> <CsoundSynthesizer>
> <CsOptions>
> -odac  -m0d
> </CsOptions>
> ; ==============================================
> <CsInstruments>
>
> sr = 44100
> ksmps = 100
> giWave ftgen 0,0,16384,10,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1/2,0,0,0,1/3,0,0,0,1/4,0,0,0,1/5
> nchnls = 2
> 0dbfs = 1
> instr 1
> idur = p3
> icps = p4/12
> iamp = p5
> kenv linseg 0,0.03,1,idur,0
> aSound poscil iamp*kenv,icps,giWave
> outs aSound,aSound
> endin
>
> </CsInstruments>
> ; ==============================================
> <CsScore>
> i1 0 1 440 0.2
> i1 1 1 220 0.2
>
> </CsScore>
> </CsoundSynthesizer>
>
>
> 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

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
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

Date2020-08-31 20:25
Fromjohn
SubjectRe: [Csnd] question concerning virtual pitch
If I change the 12 to 11 I get a 441h/z tone for the first note which 
seems ok to me.

On Mon, 31 Aug 2020, Stefan Thomas wrote:

> Dear Steven,
> yes, this is obviously wrong, the pitch must be divided through 11. But I
> still do not hear the a4 or a3!
> 
> 
> Am Mo., 31. Aug. 2020 um 16:43 Uhr schrieb Steven Yi :
>       Hi Stefan,
>
>       I didn't try the file but I saw that the ftable generated has its
>       first harmonic value at the 11th but you are dividing cps by 12.
>       Perhaps this is causing an issue here?
>
>       steven
>
>       On Sun, Aug 30, 2020 at 12:15 PM Stefan Thomas
>        wrote:
>       >
>       > Dear community,
>       > in the below quoted example I expect to hear the pitches a4
>       (midi note number 69) and a3 (note number 57) but they seem to be
>       an augmented fourth lower.
>       > It seems to be the phenomenon of virtual pitch.
>       > My question is:
>       > is there a formula available that allows us to calculate the
>       perceived fundamental?
>       > Here is my short patch:
>       > 
>       > 
>       > -odac  -m0d
>       > 
>       > ; ==============================================
>       > 
>       >
>       > sr = 44100
>       > ksmps = 100
>       > giWave ftgen
>       0,0,16384,10,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1/2,0,0,0,1/3,0,0,0,1/4,0,0,0,1/5
>       > nchnls = 2
>       > 0dbfs = 1
>       > instr 1
>       > idur = p3
>       > icps = p4/12
>       > iamp = p5
>       > kenv linseg 0,0.03,1,idur,0
>       > aSound poscil iamp*kenv,icps,giWave
>       > outs aSound,aSound
>       > endin
>       >
>       > 
>       > ; ==============================================
>       > 
>       > i1 0 1 440 0.2
>       > i1 1 1 220 0.2
>       >
>       > 
>       > 
>       >
>       >
>       > 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
>
>       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
> 
> 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
>

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

Date2020-08-31 21:30
FromSteven Yi
SubjectRe: [Csnd] question concerning virtual pitch
Attachmentsvirtual_pitch.csd  
I think that makes sense to me as the fundamental's period would be
what the others fit within, and the relationships of the sines in the
table relative to that 11th harmonic are kind of strange to hear on
its own.  With the 11th, an augmented 4 makes sense to me.

Thinking out loud:

For the sake of easier math, let's say this was the 12th harmonic
you're starting on. The fundamental's frequency should be 1/12 of the
tone you're playing back. You're giving A4 = 440 Hz. 1/2 is one sub
octave down (220, A3), 1/4 is two octaves down (110, A2), 1/8 is three
octaves (55, A1), 1/16 is four octaves (22.5, A0). 1/12 is between 1/8
and 1/16 (440 /12 = 33.667), so I would expect to hear a virtual pitch
between them, and 12 is half-way between 8 and 16, so we'd get a
perfect 5th below + 3 octaves.

Or said in reverse view: if you don't adjust the oscillator's
frequency by /12, your first sounding harmonic is the 12th harmonic
up, which is 3 octaves + a perfect 5th.

I had a chance to listen to this and I added a sine playing instrument
for reference.  I also adjusted the table so that the first sine
starts at the 12th harmonic. The attached file plays back with a sine
at 440 and 220, then plays your instrument back.  You should hear it
with a fundamental of a perfect fifth below + some octaves below.

I think in this case though, with the spacing of harmonics in the
table, the fundamental would not be 1/12 but more of 1/3 below the
given frequency. With the revised table, you have harmonics:

12, 16, 20, 24, 28

and those relationships could be divided down

6,8,10,12,14  (moving fundamental one octave higher)

then

3,4,5,6,7 (moving fundamental one octave higher)

So the sounding fundamental would be one octave + one perfect fifth
below the lowest harmonic played back.

Hopefully that helps?  Apologies if that isn't the clearest explanation!

On Mon, Aug 31, 2020 at 3:16 PM Stefan Thomas
 wrote:
>
> Dear Steven,
> yes, this is obviously wrong, the pitch must be divided through 11. But I still do not hear the a4 or a3!
>
>
> Am Mo., 31. Aug. 2020 um 16:43 Uhr schrieb Steven Yi :
>>
>> Hi Stefan,
>>
>> I didn't try the file but I saw that the ftable generated has its
>> first harmonic value at the 11th but you are dividing cps by 12.
>> Perhaps this is causing an issue here?
>>
>> steven
>>
>> On Sun, Aug 30, 2020 at 12:15 PM Stefan Thomas
>>  wrote:
>> >
>> > Dear community,
>> > in the below quoted example I expect to hear the pitches a4 (midi note number 69) and a3 (note number 57) but they seem to be an augmented fourth lower.
>> > It seems to be the phenomenon of virtual pitch.
>> > My question is:
>> > is there a formula available that allows us to calculate the perceived fundamental?
>> > Here is my short patch:
>> > 
>> > 
>> > -odac  -m0d
>> > 
>> > ; ==============================================
>> > 
>> >
>> > sr = 44100
>> > ksmps = 100
>> > giWave ftgen 0,0,16384,10,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1/2,0,0,0,1/3,0,0,0,1/4,0,0,0,1/5
>> > nchnls = 2
>> > 0dbfs = 1
>> > instr 1
>> > idur = p3
>> > icps = p4/12
>> > iamp = p5
>> > kenv linseg 0,0.03,1,idur,0
>> > aSound poscil iamp*kenv,icps,giWave
>> > outs aSound,aSound
>> > endin
>> >
>> > 
>> > ; ==============================================
>> > 
>> > i1 0 1 440 0.2
>> > i1 1 1 220 0.2
>> >
>> > 
>> > 
>> >
>> >
>> > 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
>>
>> 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
>
> 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

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