Gerhard Fiedler wrote: > I'm not sure about using PWM for controlling audio volume in general. Most > PWM frequencies are within the audio range, and you'd need to do some good > filtering to get rid of this unwanted artefact in the output. Maybe in the > case of the PC speaker this is less of a problem, but maybe not. The ear is > pretty good in hearing those things over several decades. Yeah, of course I need to have decent filtering so that the signal is not audible (or barely audible, since when the PC speaker is beeping a very weak PWM tone would not be noticeable, and the tone would be off when the speaker is idle). > > What's your overall objective? Does it have to be PWM? If you just want to > manually control it, a simple pot would be enough :) If you want to be able > to do electronic control, some kind of multiplying DAC could do it. That > can be as simple as a bunch of resistors that form a 5 bit divider (which > should be enough steps). Depending on how you want to control it, it may > not even have to be a PIC -- an up/down counter for example could do it. Of course I want to use do electronic control ;) A multiplying DAC is a good solution, but I do not want to add much complexity to the circuit (besides, I'm already running out of PIC pins for other stuff). I think this really should use an easier solution, since the PC speaker sound is binary sound only. It really should be something like using PWM to generate an analog voltage and then modulate it according to the PC speaker input, simpler than a full-blown multiplying DAC. So, really, it boils down to three points: 1. Smoothing out PWM to a decent analog voltage 2. Modulating that voltage on/off according to the PC speaker input 3. Amplifying the whole thing -- Hector Martin (hector@marcansoft.com) Public Key: http://www.marcansoft.com/hector.asc -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist