Volume Control?

New to XMOS and XCore? Get started here.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Volume Control?

Post by Wavelength »

All,

Output Volume Control for a DAC:

So I see in the manual about setting the volume control and I know from previous experience that this a software volume control handled at the sample level (i.e. sample*vol = sample').

Is there a way to enable the enumeration of the volume control through endpoint0 and then have a hardware control instead of software control?

Source code modules?

Thanks,
Gordon


Wavelength Audio, ltd.
tilde
Member++
Posts: 22
Joined: Fri Nov 07, 2014 9:03 am

Post by tilde »

Hello,

In tutorial for xCore-200 MC AUDIO you can simply enable HID device, when USB AudioClass 2 is used. With buttons on development board you can control speaker volume, mute.

If you not have dev boards, it is a good example for start.
With kind regards
Tilde
AlexAdvice
XCore Addict
Posts: 138
Joined: Sun Feb 23, 2014 11:30 am

Post by AlexAdvice »

[quote="tilde"] In tutorial for xCore-200 MC AUDIO you can simply enable HID device, when USB AudioClass 2 is used. With buttons on development board you can control speaker volume, mute.
[/quote]

This is software volume control, but as I understood, Wavelenths asks about hardware.
It can be PGA2311 or similar, or relays, or motorized potentiometer after the DAC (in analogue domain), and the question was - how to control it from PC?
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

Guys,

Maybe I am not posing the question correctly. So the dac chip I have has an internal volume control that can be set by I2C. So I can enable this in the enumeration under a feature set so the host computer understands that all volume related commands go through endpoint 0, instead of in software.

So my question is how do I tap into the endpoint0 code and send that to my i2c code to control the volume and or mute.

Thanks,
Gordon
Wavelength Audio, ltd.
AlexAdvice
XCore Addict
Posts: 138
Joined: Sun Feb 23, 2014 11:30 am

Post by AlexAdvice »

I cannot answer exactly on you question, but I not understand what the point to use DAC's internal volume control, if you can do exactly the same in PC?
DAC's internal volume control may be useful if there is no USB/PC (i/e/ - spdif input).
But with USB connections and streaming from PC - both, DACs internal or Windows volume controls makes the same thing - calculate Dout=Din/K, reducing the number of bits, used for D/A conversion, of course.
That's why many people prefer hardware volume control in analog after the DAC, but it is reasonable only in Hi-End systms.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

AlexAdvice,

Simple who wants diminished samples? Dout = Din/K means your loosing information. If I have an analog volume control that I can control via I2C then I don't loose any of the sample. Using the internal volume control in the XMOS is defeating the quality of your product. Last week we had the RMAF audio show in Denver. We showed a standard hi end system at close to $80K. On our floor that was the cheapest system. Sure we maybe crazy but then again the AudioQuest Cobalt I designed is only $299 and it uses the DAC volume control instead of the system. It won an award at the show.

Thanks,
Gordon
Wavelength Audio, ltd.
tilde
Member++
Posts: 22
Joined: Fri Nov 07, 2014 9:03 am

Post by tilde »

If I understand you well, than you want to control own DAC chip over i2c from computer, by computer volume control.

In that case check the function AudioClassRequests_2 (for audio class 2.0) in file audiorequests.xc. Where FU_VOLUME_CONTROL and FU_MUTE_CONTROL are handled the function updateVol is called.

Function updateVol() is a little bit overcomplicated, but this is the place where volumes are setted up.
With kind regards
Tilde
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

Sure. I think what AlexAdvice was getting at is -- and as you know -- so long as you use a supremely quiet and linear analog volume control you will get theoretically better performance. But it would have to be quieter and more linear than the DAC IC to be better than digital volume control.
User avatar
Wavelength
Experienced Member
Posts: 76
Joined: Mon Sep 24, 2018 9:56 pm

Post by Wavelength »

Akp,

That's not true... First remember every DAC is fixed bits. But most standard audio applications use Float32. So ok then you have Dout = Din/K that's a reasonable number under Float32 but when you go from that to PCM and fixed points your just dropping bits on the floor. I have two products with DAC based volume controls, one ESS ES9038 and that uses the ES9038 volume control which is 64 bits internal and bit true they state to pretty low levels. The other uses a digitally controlled volume control. The second does everything in the analog domain so the samples are not diminished at all, only the volume.

Tilde, thanks that was what I have been looking for! If only I could get the XMOS tools to work again I could implement that.

Thanks,
Gordon
Wavelength Audio, ltd.
User avatar
akp
XCore Expert
Posts: 578
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

OK. We disagree but I won't argue. This isn't a hifi forum. But in defense of the processors, I will say that XMOS processors can easily handle 64 bit intermediates and the effective bits from your DAC is only about 20. So you have plenty of bits you can freely drop.
Post Reply