Hi,
Sorry but I have another question in the same day...
I have a "dac object" and a "number" to variate its value. When the number comes to a negative or positive number, the speaker generates a "tac" sound, and I don't understand why.
Can anyone help? Thanks,
Mickaël.
Hallo, mstamm@itin.fr hat gesagt: // mstamm@itin.fr wrote:
Sorry but I have another question in the same day...
I have a "dac object" and a "number" to variate its value. When the number comes to a negative or positive number, the speaker generates a "tac" sound, and I don't understand why.
If you send anything whose absolute value is greater than 1.0 to a dac~ it will click because of clipping at the soundcard, which is overdriven then.
Frank Barknecht _ ______footils.org__
----- Original Message ----- From: mstamm@itin.fr
Hi,
Sorry but I have another question in the same day...
I have a "dac object" and a "number" to variate its value. When the number comes to a negative or positive number, the speaker
generates
a "tac" sound, and I don't understand why.
Can anyone help? Thanks,
Mickaël.
do you mean [dac~]
[dac~] ist the audio-output of pd (digital>analog converter) [dac~] expects values between -1 and 1, thats why you hear 'tac's.
this is very basic stuff, which is well documented in the manual and the examples. i suggest you would read these things. also to understand the difference between audio- and control-connections.
cheers
roman
mstamm@itin.fr wrote:
Hi, Sorry but I have another question in the same day... I have a "dac object" and a "number" to variate its value. When the number comes to a negative or positive number, the speaker generates a "tac" sound, and I don't understand why. Can anyone help? Thanks, Mickaël.
Yeah, it's all in the documentation, and in MSPs Intro to DSP book on his website. So read on anyways. http://www.crca.ucsd.edu/~msp/techniques.htm
Typically, you'd never connect a control, or DC source (number) directly to a signal [dac~] output. Instead, you'd connect a signal object like oscillator [osc~] (or any ~ object) to the [dac~] outputs
[osc~ 440]
|
|
[dac~]
In Pd, number objects are 'control' (static, outputs when prompted) objects, but [dac~] and all "~" objects are 'signal' (sampled, continuous) objects. You're essentially sending a DC voltage to your speakers, then pushing the speaker cone from neutral (0)to full scale(1,-1) in one sample time (1/44100 of second), hence the click, just like connecting a 1.5V battery directly across the speaker contacts.
If you use the Shift key while scrolling your number object, you'll hear a much softer click, as it will increment/decrement in steps of 0.01 (1%) of "full scale".
Luckily, most soundcard outputs are not DC coupled; so the speaker won't stay pushed out there. DC offset is a problem in analog and digital audio systems because it leads to asymmetrical clipping in the signal processing chain, which sounds pretty bad. Cheap sound cards often have a DC offset in their input circuitry. Sound editing software includes a "DC Offset Removal" filter for this. In high-power speaker systems DC offset can heat (perhaps overheat) the output transistors and speaker coils. Mixers and power amplifiers have "subsonic" filters to block DC.
In Pd, to block DC offsets, we frequently use the [hp~ 5] object, which passes all interesting audio, and blocks DC.
Hallo, Lex Ein hat gesagt: // Lex Ein wrote:
In Pd, to block DC offsets, we frequently use the [hp~ 5] object, which passes all interesting audio, and blocks DC.
Okay, these are questions I wanted to ask for a long time: In the example patches, Miller often puts a [hip~ 5] before the dac~ which as I understand should do exactly that: remove a DC offset.
Two questions: Why do they remove the DC? And is this always necessary? Then why not build something like that directly into [dac~]?
Frank Barknecht _ ______footils.org__
Frank Barknecht wrote:
Hallo, Lex Ein hat gesagt: // Lex Ein wrote:
In Pd, to block DC offsets, we frequently use the [hip~ 5] object, which passes all interesting audio, and blocks DC.
Okay, these are questions I wanted to ask for a long time: In the example patches, Miller often puts a [hip~ 5] before the dac~ which as I understand should do exactly that: remove a DC offset.
Two questions: Why do they remove the DC? And is this always necessary?
A) It's not directly audible, and is therefore useless for audio.
B) DC offset can cause assymetrical clipping in following audio chain.
C) DC steps and transients (and low frequencies) can cause sonic distortions: low frequencies can add an unpleasant FM or doppler effect to superimposed violin or piano sounds in full-range speakers.
D) DC offset can damage DC-coupled inductive loads like speakers, headphones, transformer coupled electrostatic speakers, etc. A DC-coupled amplifier driving those loads will dissipate more power: RMS signal power + the DC offset power (V*I.)
E) Control changes to signal objects such as filters can "bleed through" with low-level DC "thumps" which are audible especially if they happen frequently. Step gain changes using [*~] will cause DC bumps as well. Setting [hip~ FREQ] to just above the lowest used audio frequency in a patch will do a better job of masking these step changes. Of course [line] in the control path goes a long way towards eliminating the source of zipper noise.
F) We never know who's going to plug their laptop into the input of 50,000 watt bass amp stack in the Astrodome and test Pd demo patches, so ...
G) It's good engineering design practice to build equipment and software with input protection against unintended signals, and output protection for following equipment against those same spurious signals. Since some soundcards will pass DC to their outputs, [hip~ 5] will tend to provide some protection to DC-coupled amplifiers and their associated speaker systems.
Then why not build something like that directly into [dac~]?
A) Because Pd isn't necessarily just for audio. Somebody's going to want DC-coupled output for something, and building [hip~] into [dac~] forbids that.
B) The principle of simplicity says: don't cram too much into one thing. Time exists to keep everything from happening all at once, and space exists to allow you to decide exactly how much jam, and not buicks, you want on your toast. By extension, [hip~] must never merge with [dac~] (see attachment)
C) Since [dac~ ] is usually buried in an output subpatch, it's just as easy to bury the [hip~ 5] there as well.
On Thu, 8 Jul 2004 mstamm@itin.fr wrote:
I have a "dac object" and a "number" to variate its value. When the number comes to a negative or positive number, the speaker generates a "tac" sound, and I don't understand why.
The "tac" sound is due to any sudden change of the voltage in a speaker. If your numberbox goes suddenly from -1 to 0 and/or from 0 to +1, then you hear a click. You will not hear a click when changing among values higher than +1, or among values lower than -1, because of clipping.
On Thu, 8 Jul 2004, Frank Barknecht wrote:
If you send anything whose absolute value is greater than 1.0 to a dac~ it will click because of clipping at the soundcard, which is overdriven then.
The clipping is only a voltage stopper. It will not cause clicking by itself; it does nothing audible. However if a roundy wave enters in contact with one or both clipping lines, it changes the waveform, normally enriching the sound with odd harmonics (resembling a square wave).
On Thu, 8 Jul 2004, Lex Ein wrote:
Luckily, most soundcard outputs are not DC coupled; so the speaker won't stay pushed out there.
It doesn't matter much if, numbers are clipped during a digital-to-digital conversion. Soundcards don't understand floats, and converting to their number format does the clipping at -1 and +1.
it leads to asymmetrical clipping in the signal processing chain, which sounds pretty bad.
At the pdmtl#2 meeting, we had a demo of asymmetrical fuzz done on purpose using a formula involving hyperbolic tangent. Apparently some people DO think it sounds good. But I guess it's always what happens... when we try to imitate an old sound using a new sound, we don't see the new sound for its own qualities, but rather for how close it is to the old one...
On Thu, 8 Jul 2004, Frank Barknecht wrote:
Two questions: Why do they remove the DC? And is this always necessary? Then why not build something like that directly into [dac~]?
The DC is removed because:
float-to-int conversion does hard clipping
if the DC reaches the speaker, then the non-DC sound may sound
distorted, because the speaker has its own (soft) clipping, in the sense that speakers always have the best fidelity when the average voltage is 0V (speaker cone at rest, = not strained)
heat. This will be a complete waste of energy (unless your house needs to be heated), as playing a DC does not result in any acoustic wave at all. I have never seen a speaker overheating but then I don't have experience with big gear. Btw I'm trying to picture a speaker with a heatsink on it and somehow it doesn't fit...
completely vanish. e.g. a sound with range [.4;.6] boosted fourfold is [1.6;2.4], which if hard clipped to [-1;1] (e.g. by [dac~]), will effectively become [1;1], which is silence. if your goal is to make asymmetrical fuzz you have to adjust your settings appropriately so that you actually get a result instead of void.
Removing the DC is not done by [dac~] because it may take some CPU time and slightly change the "equalizing" in low frequencies in a way that the user might not want.
I usually remove the DC just after a [adc~] though, because it's best to design a patch assuming no sound has a DC at all, than even thinking about how DC might skew the effects.
Mathieu Bouchard http://artengine.ca/matju
Hallo,
first: thanks a lot for explaining the DC effects to you and to Lex. I did however ask my question slightly ambivalent. I also would be interested in why and how a [hip~ 5] filter removes a DC offset.
Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:
I usually remove the DC just after a [adc~] though, because it's best to design a patch assuming no sound has a DC at all, than even thinking about how DC might skew the effects.
And related to that: What would be the best way to make sure you get no DC offset? I normally don't use sound input, so are there other possible sources to watch out for in purely algorithmic patches, which might generate a DC offset without intention? I see that a phasor introduces a DC offset, but should I watch out for less obvious offset sources, maby filters and the like?
Thanks again in advance.
Frank Barknecht _ ______footils.org__
Frank Barknecht wrote:
Hallo,
first: thanks a lot for explaining the DC effects to you and to Lex. I did however ask my question slightly ambivalent. I also would be interested in why and how a [hip~ 5] filter removes a DC offset.
It's convenient to look at DSP in the time domain to answer this.
A factory worker (a signal processor) is tasked to:
at the sample rate (as fast as they're delivered),
The worker only thinks about the current number and the last number before it was crossed out.. Numbers range in value from -1 to +1.
In a two-sample crude lowpass: Sout = (Sample1 + Sample0)/2 This sums current (Sample1) and previous (Sample0) input samples and divides by 2 (otherwise this filter would have a gain of 2). This preserves DC because any two adjacent identical samples are output without alteration.
What about: Sout = (Sample1 - Sample0)/2 ( We still divide by 2 because 1 -(-1) gives a peak amplitude of 2.) This subtracts any two adjacent samples. Identical adjacent samples cancel each other out, so only changing signals make it out. The more rapidly the signal changes, the more amplitude it will have. This creates a high pass filter. DC is effectively removed, or more accurately, restored to 0.
Questions for the reader, and MOVING THIS DISCUSSION TO PD-OT, These examples make for weird filters. In the real world, nobody makes filters this simplistically. For example: frequencies at half the sample rate are nulled.
#N canvas 267 156 601 603 12; #X obj 63 182 osc~ 440; #X floatatom 63 155 6 0 0 0 - - -; #X obj 37 403 dac~; #X floatatom 92 404 6 0 0 0 - - -; #X obj 92 261 z~; #X obj 63 130 * 40; #X obj 66 110 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 65 336 *~ 0.25; #X obj 326 337 snapshot~; #X floatatom 326 362 8 0 0 0 - - -; #X obj 326 189 loadbang; #X msg 335 213 ; pd dsp 1; #X obj 326 253 metro 200; #X obj 64 297 -~; #X text 124 252 From zexy , samplewise delay; #X text 396 355 instantaneous sample value; #X text 57 56 Oscillator frequency; #X text 62 91 0; #X text 171 92 127; #X obj 278 137 sig~; #X floatatom 278 108 5 0 1 0 - - -; #X obj 92 375 env~ 2048; #X text 59 77 DC; #X text 275 68 Make your own DC (set oscillator to 0 first); #X text 53 11 Cheap high pass filter.; #X connect 0 0 4 0; #X connect 0 0 13 0; #X connect 1 0 0 0; #X connect 4 0 13 1; #X connect 5 0 1 0; #X connect 6 0 5 0; #X connect 7 0 2 0; #X connect 7 0 2 1; #X connect 7 0 21 0; #X connect 8 0 9 0; #X connect 8 0 9 0; #X connect 10 0 11 0; #X connect 10 0 12 0; #X connect 12 0 8 0; #X connect 13 0 7 0; #X connect 13 0 8 0; #X connect 19 0 13 0; #X connect 19 0 4 0; #X connect 20 0 19 0; #X connect 21 0 3 0;
On Thu, 8 Jul 2004, Frank Barknecht wrote:
first: thanks a lot for explaining the DC effects to you and to Lex. I did however ask my question slightly ambivalent. I also would be interested in why and how a [hip~ 5] filter removes a DC offset.
why: because DC is, in some way, a 0 (zero) Hz wave, and by definition "High Pass Filter" means something that cuts off low frequencies, which would include 0.
how: I don't know how [hip~] works, and that is implementation-dependent, that is, there are many kinds of high-pass filters.
And related to that: What would be the best way to make sure you get no DC offset?
Filter out the DC whereever it is where you don't want it, and don't filter it where you don't care about it. How you do it exactly is your own business.
I normally don't use sound input, so are there other possible sources to watch out for in purely algorithmic patches, which might generate a DC offset without intention? I see that a phasor introduces a DC offset, but should I watch out for less obvious offset sources, maby filters and the like?
Depends what you call "without intention"... squaring a signal (e.g. [expr~ $v1*$v1]) always introduces some DC. It is useful, too. The RMS volume is defined as the square root of the DC of the square of a signal.
For other filters I don't really know. If you want to probe for DC, you can do it, using something like [lop~ 1] -> [snapshot~].
Makes sense?
Mathieu Bouchard http://artengine.ca/matju