Reply by Jerry Avins April 13, 20062006-04-13
Carlos Moreno wrote:

...

> The period is 4 samples. It looks more or less like the following: > > o o > | | > | | > | | > --+---o---+---o---+---o---+---o--- .... > | | > | | > | | > o o > > > If all the non-zero samples had the same magnitude, then the above > would exactly represent a sinusoid with frequency = Fs/4 (angular > frequency pi/2) > > But then, the bottom samples are not equal to -7FFF, but -7FFF - 1 > > So, the resulting signal is a perfect sinusoid at Fs/4, plus a > signal that consists of one sample with value -1 every four samples > (ok, I said +1 every four samples -- is that the detail you're > picking on? -- it would be +1 if we look at the sinusoid being > +8000 and -8000 -- assuming that there wasn't integer overflow > in such case -- but yes, it makes more sense to think of +7FFF > and -7FFF, which is the only way that it could fit in the binary > representation).
>
> That involves a DC component of -0.25, plus spectral content at > Fs/4 (because this is the fundamental period of the "added" > signal), with harmonics at Fs/2. > > Notice that the detail you mention ("the pair occurs twice") > is not correct; the second occurence belongs in the next > period of the signal; it occurs once per period, or once > every four samples.
I was wrong on two counts. There are no added harmonics at all, only an offset. The pattern isn't repeated twice (why on earth did I think so?) so the DC bin is simply $7FFF + $8000 - -1. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by Carlos Moreno April 13, 20062006-04-13
Jerry Avins wrote:

> P.S. Do you now see that [1 1 0 -1 -1 0] is sinusoidal at Fs/6?
Oh, yes -- I see it now, and I always saw it; my comment in your original post about this was that if we are trying to make the ear hurt, we might as well go for the "ultimate pain" that would cause the sequence [1 1 -1 -1] :-)
> It has > no even harmonics or harmonics divisible by 3, so the lowest harmonic is > 5Fs/6, and that is 14 dB down. It is the so-called "modified sine wave" > of uninterruptible power supplies.
Ok, no, this part, I hadn't thought about :-) I always thought the UPS generation was based on approximating a sine wave with a width-modulated pulses that was naturally LP-filtered by the transformer. I guess the above sequence *is* LP-filtered by the transformer (otherwise the power-amp required to handle the analog output signal would be too expensive) -- aren't there any unwanted effects from the sinc spectral envelope involved in the reconstruction filter when each sample is output as a constant signal during the entire sampling period? (subject for a whole new thread, maybe?) Carlos --
Reply by Carlos Moreno April 13, 20062006-04-13
Jerry Avins wrote:
> Carlos Moreno wrote: > >> Al Clark wrote: >> >>>> There's no need to get into that. The generated second harmonic will >>>> be 96 dB down from the fundamental. Masking will surely make it >>>> inaudible even in the absence of a reconstruction filter (which >>>> should remove >>> >>> >>> >>> Yeh, and it will be at DC and PI (fs/2). >> >> >> >> No -- it's one added 1 every four samples -- that's fs/4, with DC >> and harmonic content at fs/2 > > > What's with you in this thread? There is DC because $7FFF +$8000 = -1 > and the pair occurs twice to give a DC of -2.
Let's revisit the original C code with the glitch detected by Randy:
>>for(k = 0;k < N/4;k++) { >>> sound[4*k] = 0x7FFF; >>> sound[4*k+1] = 0; >>> sound[4*k+2] = 0x8000; >>> sound[4*k+3] = 0; >>> } > > > 1. Not a sine. Try 0x8001 instead of 0x8000. ;)
The period is 4 samples. It looks more or less like the following: o o | | | | | | --+---o---+---o---+---o---+---o--- .... | | | | | | o o If all the non-zero samples had the same magnitude, then the above would exactly represent a sinusoid with frequency = Fs/4 (angular frequency pi/2) But then, the bottom samples are not equal to -7FFF, but -7FFF - 1 So, the resulting signal is a perfect sinusoid at Fs/4, plus a signal that consists of one sample with value -1 every four samples (ok, I said +1 every four samples -- is that the detail you're picking on? -- it would be +1 if we look at the sinusoid being +8000 and -8000 -- assuming that there wasn't integer overflow in such case -- but yes, it makes more sense to think of +7FFF and -7FFF, which is the only way that it could fit in the binary representation). That involves a DC component of -0.25, plus spectral content at Fs/4 (because this is the fundamental period of the "added" signal), with harmonics at Fs/2. Notice that the detail you mention ("the pair occurs twice") is not correct; the second occurence belongs in the next period of the signal; it occurs once per period, or once every four samples. Carlos --
Reply by Jerry Avins April 13, 20062006-04-13
Carlos Moreno wrote:

   ...

> Well, again, this goes exactly with what I was saying -- when > saying that who would distinguish the two versions, someone > claim (well, implied) that a dog would. There's plenty of > reasons why neither a dog nor a human would be able to > distinguish them -- my point was that if anything, the > argument would have to be in reverse: if *one* of them were > able to, it would be the human ear.
This started out about dogs being able ho hear much higher frequencies that humans. Google "dog whistle".
> Why would it remove it? If it is part of the samples, the it > is part of the signal that would be reconstructed. It's a > perfect sine wave added to a signal that consists of a sample > with value 1 every four samples. Why would that be eliminated > by the reconstruction filter?
A brainfart. I was thinking Fs/2 for the fundamental and Fs for the harmonic. In fact, the frequencies are half those. Jerry P.S. Do you now see that [1 1 0 -1 -1 0] is sinusoidal at Fs/6? It has no even harmonics or harmonics divisible by 3, so the lowest harmonic is 5Fs/6, and that is 14 dB down. It is the so-called "modified sine wave" of uninterruptible power supplies. -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by decorr April 13, 20062006-04-13
thanks a lor krishna for your valuable advice eill try to get the book
and read it.
also when i say sine wave it should o/p sine wave from any of the
computer ports

Reply by Jerry Avins April 13, 20062006-04-13
Carlos Moreno wrote:
> Al Clark wrote: > >>> There's no need to get into that. The generated second harmonic will >>> be 96 dB down from the fundamental. Masking will surely make it >>> inaudible even in the absence of a reconstruction filter (which >>> should remove >> >> >> Yeh, and it will be at DC and PI (fs/2). > > > No -- it's one added 1 every four samples -- that's fs/4, with DC > and harmonic content at fs/2
What's with you in this thread? There is DC because $7FFF +$8000 = -1 and the pair occurs twice to give a DC of -2. the waveform consists of an offset of 2, a fundamental of $7FFF.8 at Fs/4, and a second harmonic $-0.8 at Fs/2. On the positive peaks $7FFF.8 and $-.8 add to $7FFF. On the negative peaks, $-7FFF.8 and $-.8 add to $8000 (IOW, $-8000). (Note that the harmonic changes sign twice when the fundamental changes once.) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by Carlos Moreno April 13, 20062006-04-13
Al Clark wrote:

>>There's no need to get into that. The generated second harmonic will be >>96 dB down from the fundamental. Masking will surely make it inaudible >>even in the absence of a reconstruction filter (which should remove > > Yeh, and it will be at DC and PI (fs/2).
No -- it's one added 1 every four samples -- that's fs/4, with DC and harmonic content at fs/2 Carlos --
Reply by Carlos Moreno April 13, 20062006-04-13
Jerry Avins wrote:
> Carlos Moreno wrote: > >> Al Clark wrote: >> >>>>>> Yeah, but what about my dog... >>>> >>>> >>>> >>>> Your dog?? Your dog is far (faaaaaaaar) less capable than you >>>> to *distinguish* the two versions. Probably wouldn't even >>>> distinguish two things with frequencies 10% apart -- which is >>>> a much much much more severe difference than the tiny 1-bit of >>>> noise that Randy caught (on the screen -- no way he would have >>>> caught it coming from a speaker or headphones! ;-)) >>> >>> >>> >>> The 0x8000 is going to cause even order harmonic distortion. Its not >>> going to impact the frequency (fs/4). >> >> >> >> This is exactly what I was saying. >> >> My point was precisely, a dog would be utterly incapable of >> distinguishing both versions -- from what I've read, the dog's >> ear is actually far less capable than the human in terms of >> *distinguishing* sounds with slightly different characteristics >> (even if it was a frequency change that for us, humans, was >> extremely obvious) > > > There's no need to get into that. The generated second harmonic will be > 96 dB down from the fundamental.
Well, again, this goes exactly with what I was saying -- when saying that who would distinguish the two versions, someone claim (well, implied) that a dog would. There's plenty of reasons why neither a dog nor a human would be able to distinguish them -- my point was that if anything, the argument would have to be in reverse: if *one* of them were able to, it would be the human ear.
> Masking will surely make it inaudible > even in the absence of a reconstruction filter (which should remove it).
Why would it remove it? If it is part of the samples, the it is part of the signal that would be reconstructed. It's a perfect sine wave added to a signal that consists of a sample with value 1 every four samples. Why would that be eliminated by the reconstruction filter? Carlos --
Reply by Al Clark April 13, 20062006-04-13
Jerry Avins <jya@ieee.org> wrote in news:5fGdndU-
GtXu6aPZnZ2dneKdnZydnZ2d@rcn.net:

> Carlos Moreno wrote: >> Al Clark wrote: >> >>>>>> Yeah, but what about my dog... >>>> >>>> >>>> Your dog?? Your dog is far (faaaaaaaar) less capable than you >>>> to *distinguish* the two versions. Probably wouldn't even >>>> distinguish two things with frequencies 10% apart -- which is >>>> a much much much more severe difference than the tiny 1-bit of >>>> noise that Randy caught (on the screen -- no way he would have >>>> caught it coming from a speaker or headphones! ;-)) >>> >>> >>> The 0x8000 is going to cause even order harmonic distortion. Its not >>> going to impact the frequency (fs/4). >> >> >> This is exactly what I was saying. >> >> My point was precisely, a dog would be utterly incapable of >> distinguishing both versions -- from what I've read, the dog's >> ear is actually far less capable than the human in terms of >> *distinguishing* sounds with slightly different characteristics >> (even if it was a frequency change that for us, humans, was >> extremely obvious) > > There's no need to get into that. The generated second harmonic will be > 96 dB down from the fundamental. Masking will surely make it inaudible > even in the absence of a reconstruction filter (which should remove
it).
> > Jerry
Yeh, and it will be at DC and PI (fs/2). -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Reply by Jerry Avins April 13, 20062006-04-13
Carlos Moreno wrote:
> Al Clark wrote: > >>>>> Yeah, but what about my dog... >>> >>> >>> Your dog?? Your dog is far (faaaaaaaar) less capable than you >>> to *distinguish* the two versions. Probably wouldn't even >>> distinguish two things with frequencies 10% apart -- which is >>> a much much much more severe difference than the tiny 1-bit of >>> noise that Randy caught (on the screen -- no way he would have >>> caught it coming from a speaker or headphones! ;-)) >> >> >> The 0x8000 is going to cause even order harmonic distortion. Its not >> going to impact the frequency (fs/4). > > > This is exactly what I was saying. > > My point was precisely, a dog would be utterly incapable of > distinguishing both versions -- from what I've read, the dog's > ear is actually far less capable than the human in terms of > *distinguishing* sounds with slightly different characteristics > (even if it was a frequency change that for us, humans, was > extremely obvious)
There's no need to get into that. The generated second harmonic will be 96 dB down from the fundamental. Masking will surely make it inaudible even in the absence of a reconstruction filter (which should remove it). Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;