AudioGraph DesiredSamplesPerQuantum property is ignored
I'm developping a UWP audio application. Latest Windows 10 SDK version 1803.
I would like to increase the SamplesPerQuantum used on the AudioGraph of my application.
According to the docs, I should specify the properties DesiredSamplesPerQuantum and QuantumSizeSelectionMode before creating the AudioGraph.
I'm creating the AudioGraph like this :
AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media);
settings.DesiredSamplesPerQuantum = 960; // 20ms
settings.QuantumSizeSelectionMode = QuantumSizeSelectionMode.ClosestToDesired;
CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings);
Debug.WriteLine("SamplesPerQuantum=" + result.Graph.SamplesPerQuantum);
I tried everything, the SamplesPerQuantum property is always 480...
It's a problem because I get clicks in the audio output at each garbage collection. I think the default quantum of 10ms is too short...
c# audio uwp
add a comment |
I'm developping a UWP audio application. Latest Windows 10 SDK version 1803.
I would like to increase the SamplesPerQuantum used on the AudioGraph of my application.
According to the docs, I should specify the properties DesiredSamplesPerQuantum and QuantumSizeSelectionMode before creating the AudioGraph.
I'm creating the AudioGraph like this :
AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media);
settings.DesiredSamplesPerQuantum = 960; // 20ms
settings.QuantumSizeSelectionMode = QuantumSizeSelectionMode.ClosestToDesired;
CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings);
Debug.WriteLine("SamplesPerQuantum=" + result.Graph.SamplesPerQuantum);
I tried everything, the SamplesPerQuantum property is always 480...
It's a problem because I get clicks in the audio output at each garbage collection. I think the default quantum of 10ms is too short...
c# audio uwp
add a comment |
I'm developping a UWP audio application. Latest Windows 10 SDK version 1803.
I would like to increase the SamplesPerQuantum used on the AudioGraph of my application.
According to the docs, I should specify the properties DesiredSamplesPerQuantum and QuantumSizeSelectionMode before creating the AudioGraph.
I'm creating the AudioGraph like this :
AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media);
settings.DesiredSamplesPerQuantum = 960; // 20ms
settings.QuantumSizeSelectionMode = QuantumSizeSelectionMode.ClosestToDesired;
CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings);
Debug.WriteLine("SamplesPerQuantum=" + result.Graph.SamplesPerQuantum);
I tried everything, the SamplesPerQuantum property is always 480...
It's a problem because I get clicks in the audio output at each garbage collection. I think the default quantum of 10ms is too short...
c# audio uwp
I'm developping a UWP audio application. Latest Windows 10 SDK version 1803.
I would like to increase the SamplesPerQuantum used on the AudioGraph of my application.
According to the docs, I should specify the properties DesiredSamplesPerQuantum and QuantumSizeSelectionMode before creating the AudioGraph.
I'm creating the AudioGraph like this :
AudioGraphSettings settings = new AudioGraphSettings(AudioRenderCategory.Media);
settings.DesiredSamplesPerQuantum = 960; // 20ms
settings.QuantumSizeSelectionMode = QuantumSizeSelectionMode.ClosestToDesired;
CreateAudioGraphResult result = await AudioGraph.CreateAsync(settings);
Debug.WriteLine("SamplesPerQuantum=" + result.Graph.SamplesPerQuantum);
I tried everything, the SamplesPerQuantum property is always 480...
It's a problem because I get clicks in the audio output at each garbage collection. I think the default quantum of 10ms is too short...
c# audio uwp
c# audio uwp
asked Nov 15 '18 at 20:55
Nicolas SévenoNicolas Séveno
1258
1258
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I tried everything, the SamplesPerQuantum property is always 480...
By default, the quantum size is 10 ms based at the default sample rate. The system will choose a quantum size as close as possible to the one you specify. if your the sample rate of speak device is limited to 48000hz, the SamplesPerQuantum
will be limited to 480. For your requirement, you could set sample rate to 96000hz. Then your setting could be available.
I have discussed with media team, and they give the following reply. The general idea is DesiredSamplesPerQuantum
related with your hardware.
Update
The behavior the customer is seeing is dependent on the underlying audio hardware. The DesiredSamplesPerQuantum
property is only a suggestion to the underlying hardware. If the hardware / driver does not support the requested quantum then it will not be set.
When the GC runs there may be clicks or pops in the audio. This is because managed languages are nondeterministic.
And this is James Dailey's blog that you could refer.
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modifyEncodingProperties
property.
– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327765%2faudiograph-desiredsamplesperquantum-property-is-ignored%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I tried everything, the SamplesPerQuantum property is always 480...
By default, the quantum size is 10 ms based at the default sample rate. The system will choose a quantum size as close as possible to the one you specify. if your the sample rate of speak device is limited to 48000hz, the SamplesPerQuantum
will be limited to 480. For your requirement, you could set sample rate to 96000hz. Then your setting could be available.
I have discussed with media team, and they give the following reply. The general idea is DesiredSamplesPerQuantum
related with your hardware.
Update
The behavior the customer is seeing is dependent on the underlying audio hardware. The DesiredSamplesPerQuantum
property is only a suggestion to the underlying hardware. If the hardware / driver does not support the requested quantum then it will not be set.
When the GC runs there may be clicks or pops in the audio. This is because managed languages are nondeterministic.
And this is James Dailey's blog that you could refer.
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modifyEncodingProperties
property.
– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
|
show 4 more comments
I tried everything, the SamplesPerQuantum property is always 480...
By default, the quantum size is 10 ms based at the default sample rate. The system will choose a quantum size as close as possible to the one you specify. if your the sample rate of speak device is limited to 48000hz, the SamplesPerQuantum
will be limited to 480. For your requirement, you could set sample rate to 96000hz. Then your setting could be available.
I have discussed with media team, and they give the following reply. The general idea is DesiredSamplesPerQuantum
related with your hardware.
Update
The behavior the customer is seeing is dependent on the underlying audio hardware. The DesiredSamplesPerQuantum
property is only a suggestion to the underlying hardware. If the hardware / driver does not support the requested quantum then it will not be set.
When the GC runs there may be clicks or pops in the audio. This is because managed languages are nondeterministic.
And this is James Dailey's blog that you could refer.
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modifyEncodingProperties
property.
– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
|
show 4 more comments
I tried everything, the SamplesPerQuantum property is always 480...
By default, the quantum size is 10 ms based at the default sample rate. The system will choose a quantum size as close as possible to the one you specify. if your the sample rate of speak device is limited to 48000hz, the SamplesPerQuantum
will be limited to 480. For your requirement, you could set sample rate to 96000hz. Then your setting could be available.
I have discussed with media team, and they give the following reply. The general idea is DesiredSamplesPerQuantum
related with your hardware.
Update
The behavior the customer is seeing is dependent on the underlying audio hardware. The DesiredSamplesPerQuantum
property is only a suggestion to the underlying hardware. If the hardware / driver does not support the requested quantum then it will not be set.
When the GC runs there may be clicks or pops in the audio. This is because managed languages are nondeterministic.
And this is James Dailey's blog that you could refer.
I tried everything, the SamplesPerQuantum property is always 480...
By default, the quantum size is 10 ms based at the default sample rate. The system will choose a quantum size as close as possible to the one you specify. if your the sample rate of speak device is limited to 48000hz, the SamplesPerQuantum
will be limited to 480. For your requirement, you could set sample rate to 96000hz. Then your setting could be available.
I have discussed with media team, and they give the following reply. The general idea is DesiredSamplesPerQuantum
related with your hardware.
Update
The behavior the customer is seeing is dependent on the underlying audio hardware. The DesiredSamplesPerQuantum
property is only a suggestion to the underlying hardware. If the hardware / driver does not support the requested quantum then it will not be set.
When the GC runs there may be clicks or pops in the audio. This is because managed languages are nondeterministic.
And this is James Dailey's blog that you could refer.
edited Nov 21 '18 at 3:10
answered Nov 16 '18 at 7:44
Nico Zhu - MSFTNico Zhu - MSFT
10.1k1522
10.1k1522
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modifyEncodingProperties
property.
– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
|
show 4 more comments
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modifyEncodingProperties
property.
– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Yes, but a 960 SamplesPerQuantum at 96000 hz would still be 10ms. I would like to have 20 ms or more...
– Nicolas Séveno
Nov 16 '18 at 8:30
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
Can you tell me how 10ms is derived?
– Nico Zhu - MSFT
Nov 16 '18 at 8:44
If it is related with sample rate, you could modify
EncodingProperties
property.– Nico Zhu - MSFT
Nov 16 '18 at 8:51
If it is related with sample rate, you could modify
EncodingProperties
property.– Nico Zhu - MSFT
Nov 16 '18 at 8:51
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
The doc says : "By default, the quantum size is 10 ms based at the default sample rate". I guess 480 is for 10 ms...
– Nicolas Séveno
Nov 16 '18 at 8:52
1
1
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
OK, thank you @NicoZhuMSFT for taking time to answer ! About the 10ms limit, I will try with an external soundcard to see if it changes something. About the GC clicks, I will optimize my code as much as possible to reduce the blocking GC collections. After some optimizations, it is already better...
– Nicolas Séveno
Nov 22 '18 at 9:46
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327765%2faudiograph-desiredsamplesperquantum-property-is-ignored%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown