Thank you for your reply, David. If I just forward incoming samples without any processing then yes, I see clipping issue. So yeah, no issue with my code. But still I want to handle this myself as there is nothing I can ask vendor to change or do.
As far as my knowledge, I don't think they have hardware gain control or anything out of band. I think dynamic processing could be happening in vendor binary. Maybe I'll start with compressor. I'll google and study more about it. I just wanted some help to go in right direction, I'm a newbie to DSP :) Thanks a lot for your kind help and patience. Regards, Mahantesh On Tue, Mar 15, 2016 at 2:25 PM, David Olofson <da...@olofson.net> wrote: > Well, we can only make wild guesses, as there isn't all that much > that's likely to go wrong with the actual DSP code. Just to rule that > part out entirely, what happens if you just forward the incoming > samples unchanged, with no volume scaling? If that still gives you > distortion, there's probably nothing wrong with your code. > > As to wild guesses; > > Are you sure there are no hardware gain controls or anything else "out > of band" that the vendor's binary might be using? > > Maybe the vendor binary isn't just scaling, but also applying some > form of dynamic compression? You can significantly increase the > *perceived* amplitude (and actual energy) of the signal using a > compressor, waveshaper, "soft limiter" or similar dynamics processor, > without pushing the peak signal levels beyond the clipping level. > > > On Tue, Mar 15, 2016 at 7:51 AM, Mahantesh Belakhindi > <girishe...@gmail.com> wrote: > > Hello again, > > > > Sorry if my emails do not have sufficient info for you all to help me > with > > my query. Please let me know if you need more details. Any remotely > related > > pointers to help me fix this, is also welcome. > > > > Thanks & Regards, > > Mahantesh > > > > On Fri, Mar 11, 2016 at 10:53 PM, Mahantesh Belakhindi > > <girishe...@gmail.com> wrote: > >> > >> Thanks a lot, Daniel and David for your replies. > >> > >> Sorry for the confusion about -ve sign. Actually volume controller > >> receives +ve values of volume steps in 8-bits and it is expected to > assume > >> it as -ve value. > >> > >> I'm not quite sure about the design of amplifier/speaker as I cannot get > >> specs from vendor. So yeah, it could be amplifier/speaker distortion > >> kicking-in after some amplitude. In a nutshell, I can't change anything > else > >> in the system but my volume controller. > >> > >> I have original binary from vendor which plays a sine tone of 0.5PP at > >> 117dB SPL at max volume level without any distortion. But with my > binary I > >> could go upto 107db SPL at max volume step of -17dB without any > distortion. > >> Which leaves me to think that I can do a bit more volume without > distortion > >> but if I increase max volume in a small step to -16.9dB, I see > saturation. > >> > >> Thanks again for your time and help. > >> > >> Regards, > >> Mahantesh > >> > >> On Fri, Mar 11, 2016 at 5:03 PM, David Olofson <da...@olofson.net> > wrote: > >>> > >>> On Fri, Mar 11, 2016 at 11:41 AM, Daniel Hams <daniel.h...@gmail.com> > >>> wrote: > >>> [...] > >>> >> -45 dB, -29 dB, -21dB, -16dB, -12dB, -9dB, -7dB, -5dB, -3dB, -1dB, > 0dB > >>> [...] > >>> >> sampleScale = pow(10, (-dBValue / 20)) > >>> >> sampleValue = sampleScale * sampleValue; > >>> >> > >>> > > >>> > Your scale computation seems to be incorrect - as you appear to be > >>> > amplifying for all your values except 0dB (sign typo?). > >>> [...] > >>> > >>> That would certainly explain it! I was just assuming that it would > >>> have been rather obvious to OP if the volume control responded > >>> backwards. :-) > >>> > >>> > >>> -- > >>> //David Olofson - Consultant, Developer, Artist, Open Source Advocate > >>> > >>> .--- Games, examples, libraries, scripting, sound, music, graphics ---. > >>> | http://consulting.olofson.net http://olofsonarcade.com > | > >>> '---------------------------------------------------------------------' > >>> _______________________________________________ > >>> dupswapdrop: music-dsp mailing list > >>> music-dsp@music.columbia.edu > >>> https://lists.columbia.edu/mailman/listinfo/music-dsp > >>> > >> > > > > > > _______________________________________________ > > dupswapdrop: music-dsp mailing list > > music-dsp@music.columbia.edu > > https://lists.columbia.edu/mailman/listinfo/music-dsp > > > > -- > //David Olofson - Consultant, Developer, Artist, Open Source Advocate > > .--- Games, examples, libraries, scripting, sound, music, graphics ---. > | http://consulting.olofson.net http://olofsonarcade.com | > '---------------------------------------------------------------------' > _______________________________________________ > dupswapdrop: music-dsp mailing list > music-dsp@music.columbia.edu > https://lists.columbia.edu/mailman/listinfo/music-dsp > >
_______________________________________________ dupswapdrop: music-dsp mailing list music-dsp@music.columbia.edu https://lists.columbia.edu/mailman/listinfo/music-dsp