Csound Csound-dev Csound-tekno Search About

Re: audio phenomenon or problem?

Date2016-12-05 05:06
FromPeter Hoekje
SubjectRe: audio phenomenon or problem?
Hi Joe,

It's actually a pretty simple and familiar phenomenon.  In the first two seconds you are playing a pure tone of about 131 Hz, in the next two seconds you are playing two pure tones of equal amplitude and frequencies 131 and 147 Hz.  Those two pure tones together can be represented mathematically as a sine wave of the average frequency (131+147)/2 = 139 Hz that is modulated at the difference frequency of (147-131) = 16 Hz.  (Actually the modulation signal is a sine wave of 16/2 = 8 Hz, but it has max amplitude twice each cycle, so it beats at 16 Hz.)  Compare your second note (between 2 and 4 secs) with

instr 2
; a simple AM instrument
;p4 = ampl, p5 = carrier freq, p6 = mod. freq
out oscil:a(oscil:a(p4,p6),p5)
endin


i2 0 2 0.2 139 8


If you like playing with trig functions, try thinking about this one.  Suppose A = (2 pi f1 t) and B = (2 pi f2 t), so that sin(A) and sin(B) are the pure tones that you are adding together in the second section.  Then introduce P = (A+B)/2 and Q = (A-B)/2.   That means you can write A = P+Q and B = P-Q, or 
	sin(A) + sin(B) = sin(P+Q) + sin(P-Q)
I will let you work out the rest for fun, using the corresponding trig identities.

Because the two pure tones are close in frequency, they are in the same critical band and so they are processed together.  Because they are equal in amplitude and have nothing to distinguish them as being distinct, they are heard as a single tone.  In the third section, the greater amplitude of the higher frequency forces the issue.  Now, I wonder what would happen if the amplitude of the higher frequency tone grew slowly from 0.0 to 0.6?

Hope that helps, thanks for this fun demonstration!

peter

-----Original Message-----

Date:    Sun, 4 Dec 2016 21:14:45 -0600
From:    "Joe ." 
Subject: Re: audio phenomenon or problem?

I've attached a wav of what I hear. Is it what you are hearing?

My original question: Why does it sound like C-C#-D and not C-D-D?

/* Joe */


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

Date2016-12-05 05:25
From"Joe ."
SubjectRe: audio phenomenon or problem?
Thank you Peter. A great explanation. 

I played around with growing the amplitude of the higher frequency, it sounds like a glis from the pseudo C# to a D. Very interesting. 

/* Joe */

On Sun, Dec 4, 2016 at 11:06 PM, Peter Hoekje <phoekje@bw.edu> wrote:
Hi Joe,

It's actually a pretty simple and familiar phenomenon.  In the first two seconds you are playing a pure tone of about 131 Hz, in the next two seconds you are playing two pure tones of equal amplitude and frequencies 131 and 147 Hz.  Those two pure tones together can be represented mathematically as a sine wave of the average frequency (131+147)/2 = 139 Hz that is modulated at the difference frequency of (147-131) = 16 Hz.  (Actually the modulation signal is a sine wave of 16/2 = 8 Hz, but it has max amplitude twice each cycle, so it beats at 16 Hz.)  Compare your second note (between 2 and 4 secs) with

instr 2
; a simple AM instrument
;p4 = ampl, p5 = carrier freq, p6 = mod. freq
out oscil:a(oscil:a(p4,p6),p5)
endin

<CsScore>
i2 0 2 0.2 139 8
</CsScore>

If you like playing with trig functions, try thinking about this one.  Suppose A = (2 pi f1 t) and B = (2 pi f2 t), so that sin(A) and sin(B) are the pure tones that you are adding together in the second section.  Then introduce P = (A+B)/2 and Q = (A-B)/2.   That means you can write A = P+Q and B = P-Q, or
        sin(A) + sin(B) = sin(P+Q) + sin(P-Q)
I will let you work out the rest for fun, using the corresponding trig identities.

Because the two pure tones are close in frequency, they are in the same critical band and so they are processed together.  Because they are equal in amplitude and have nothing to distinguish them as being distinct, they are heard as a single tone.  In the third section, the greater amplitude of the higher frequency forces the issue.  Now, I wonder what would happen if the amplitude of the higher frequency tone grew slowly from 0.0 to 0.6?

Hope that helps, thanks for this fun demonstration!

peter

-----Original Message-----

Date:    Sun, 4 Dec 2016 21:14:45 -0600
From:    "Joe ." <not007ful@GMAIL.COM>
Subject: Re: audio phenomenon or problem?

I've attached a wav of what I hear. Is it what you are hearing?

My original question: Why does it sound like C-C#-D and not C-D-D?

/* Joe */


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

Date2016-12-05 06:40
FromPeter Hoekje
SubjectRe: audio phenomenon or problem?
Hi Joe,

Hmm, the effect also depends on the speakers being used.  When I play it through my laptop's little speakers, the effects you describe are clear.  But those speakers are small, have some distortion, and don't put out much around 100 Hz, so in fact they are putting out a rich spectrum and more of the 3rd harmonic than 1st harmonic.  But then when I play it out over the little sound system on my desk that has more fidelity, the two pitches are a bit easier to distinguish.  Interesting!  (and it doesn't seem to be a binaural effect, because I tried playing it out one speaker and closing one ear).

peter

-----Original Message-----
Thank you Peter. A great explanation. 

I played around with growing the amplitude of the higher frequency, it sounds like a glis from the pseudo C# to a D. Very interesting. 

/* Joe */


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