{"id":859,"date":"2009-02-28T11:40:19","date_gmt":"2009-02-28T09:40:19","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=859"},"modified":"2009-03-10T08:37:50","modified_gmt":"2009-03-10T06:37:50","slug":"mediatools-tone-source-filter-to-generate-reference-audio-feed","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/859","title":{"rendered":"MediaTools: Tone Source Filter to generate reference audio feed, dual Audio Source Filter and Virtual Audio Capture Device"},"content":{"rendered":"<p>In order to obtain a reference audio source and especially useful for debugging purposes, including:<\/p>\n<ul>\n<li>audio input device unrelated to physical device, to avoid conditions when device is already in use by someone else<\/li>\n<li>non-zero audio signal which is independent of certain speaker or broadcasting service, including one that makes capture, transmission or rendering issues easily perceptible by human<\/li>\n<li>configurable to provide different audio media types, including through well known DirectShow interfaces, such as <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd319784(VS.85).aspx\">IAMStreamConfig<\/a><\/li>\n<li>configurable to present in system as both regular <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd375464(VS.85).aspx\">DirectShow Filter<\/a>, and as an <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd375655(VS.85).aspx\">Audio Capture Source<\/a> which can be enumerated by applications<\/li>\n<li>to be able to check how exactly other applications are accessing and configuring audio capture source<\/li>\n<\/ul>\n<p>I added a new filter to the Media Tools library, a Tone Source Filter. The filter generates <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pulse-code_modulation\">PCM Audio<\/a> data, either infinite sine waveform, or interrupted signal\u00a0 of requested parameters:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-863\" title=\"Tone Source Filter General Property Page\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image011.png\" alt=\"Tone Source Filter General Property Page\" width=\"370\" height=\"428\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image011.png 370w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image011-259x300.png 259w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p>The filter accepts connection on <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pulse-code_modulation\">PCM<\/a> media types with flexible sampling rates in range 8 KHz through 200 KHz, 8-bit audio and 1 channel. Media type is also configurable through or, if not configured this way, the first enumerated media type off the Output pin is also configurable through property page and\/or persistent setting accessible via private IDispatch derived interface property.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-864\" title=\"Tone Source Filter Prefered Format Property Page\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image012.png\" alt=\"Tone Source Filter Prefered Format Property Page\" width=\"370\" height=\"427\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image012.png 370w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image012-259x300.png 259w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<p>Additionally, the filter may configured as a system-wide available <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783347(VS.85).aspx\">audio input device<\/a>, such as for example available to <a href=\"http:\/\/videolan.org\">VLC Media Player<\/a> or <a href=\"http:\/\/sourceforge.net\/projects\/guliverkli\/\">Media Player Classic<\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-865\" title=\"VLC Media Player's Option to use Tone Source Filter based device\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image013.png\" alt=\"VLC Media Player's Option to use Tone Source Filter based device\" width=\"528\" height=\"352\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image013.png 528w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image013-300x200.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/p>\n<p>In order to configure the filter as such device, the library exports function <em>DoToneSourceFilterDevicePropertySheetModal<\/em>, which can be called using <em>rundll32<\/em> utility (<em>&#8220;rundll32 Acquisition.dll,DoToneSourceFilterDevicePropertySheetModal&#8221;<\/em> from command line):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-866\" title=\"Devices Property Page\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image014.png\" alt=\"Devices Property Page\" width=\"367\" height=\"426\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image014.png 367w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2009\/02\/27-image014-258x300.png 258w\" sizes=\"auto, (max-width: 367px) 100vw, 367px\" \/><\/p>\n<p>A partial Visual C++ .NET 2008 source code is <a href=\"http:\/\/code.assembla.com\/roatl-utilities\/subversion\/nodes\/trunk\/Extended7zShell\">available from SVN<\/a>, release binary <a href=\"http:\/\/code.assembla.com\/roatl-utilities\/subversion\/nodes\/trunk\/MediaTools\/_Bin\/Release%20Trace\/Acquisition.dll?format=raw\">included<\/a>.<\/p>\n<h2>File and Class Summary<\/h2>\n<h3>Acqusition.dll<\/h3>\n<p>Acqusition.dll (<a href=\"http:\/\/code.assembla.com\/roatl-utilities\/subversion\/nodes\/trunk\/MediaTools\/_Bin\/Release%20Trace\/Acquisition.dll?format=raw\">download<\/a>) hosts the following classes:<\/p>\n<ul>\n<li>DirectShow Filters\n<ul>\n<li><span style=\"text-decoration: underline;\">Tone Source Filter<\/span>, to generate reference\/debug audio data<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Class Overview<\/h2>\n<h3>Tone Source Filter<\/h3>\n<p>The filter generates uninterrupted or interrupted reference sine waveform in form of PCM audio data.<\/p>\n<ul>\n<li>Filter Executable: Acquisition.dll<\/li>\n<li>Filter CLSID: __uuidof(ToneSourceFilter) {8002935A-B2EC-40ef-968C-E0358E5DED10}<\/li>\n<li>Filter Property Page CLSID: __uuidof(ToneSourceFilterGeneralPropertyPage), {EBD8ABB2-6DD3-4c54-A7F1-9FE4DA283EDF}, ToneSourceFilterPreferedFormatPropertyPage, {EE224187-4FA3-4c3f-9D5D-492694CCFEB7}<\/li>\n<li>Filter Merit: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms787275%28VS.85%29.aspx\">MERIT_DO_NOT_USE<\/a><\/li>\n<li>Filter Category: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783347%28VS.85%29.aspx\">CLSID_LegacyAmFilterCategory<\/a> (also configurable as <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783347(VS.85).aspx\">CLSID_AudioInputDeviceCategory<\/a>)<\/li>\n<li>Filter Interfaces: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms682273%28VS.85%29.aspx\">IPersistStreamInit<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms690091%28VS.85%29.aspx\">IPersistStream<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms695217%28VS.85%29.aspx\">ISpecifyPropertyPages<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa768205(VS.85).aspx\">IPersistPropertyBag<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms784601%28VS.85%29.aspx\">IBaseFilter<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms785914%28VS.85%29.aspx\">IMediaFilter<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms688695%28VS.85%29.aspx\">IPersist<\/a>,\u00a0<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms784083%28VS.85%29.aspx\">IAMovieSetup<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms783950%28VS.85%29.aspx\">IAMFilterMiscFlags<\/a>, IToneSourceFilter, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms221608.aspx\">IDispatch<\/a><\/li>\n<li>Filter Pins: single ouput pin (Ouput)<\/li>\n<li>Output Pin Media Types: MEDIATYPE_Audio\/MEDIASUBTYPE_PCM<\/li>\n<li>Output Pin Interfaces:\u00a0<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms786565%28VS.85%29.aspx\">IPin<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms786054%28VS.85%29.aspx\">IMemInputPin<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd319764(VS.85).aspx\">IAMPushSource<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd389383(VS.85).aspx\">IAMLatency<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd389142(VS.85).aspx\">IAMBufferNegotiation<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb174586(VS.85).aspx\">IKsPropertySet<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd319784(VS.85).aspx\">IAMStreamConfig<\/a><\/li>\n<\/ul>\n<h4>Remarks<\/h4>\n<p>The hosting library (DLL) exposes <em>DoToneSourceFilterDevicePropertySheetModal<\/em> function which provides GUI to configure the filter as one or more audio capture source device, which can be enumerated by <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd407180(VS.85).aspx\">System Device Enumerator<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to obtain a reference audio source and especially useful for debugging purposes, including: audio input device unrelated to physical device, to avoid conditions when device is already in use by someone else non-zero audio signal which is independent of certain speaker or broadcasting service, including one that makes capture, transmission or rendering issues&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/859\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6,159,13,20],"tags":[487,38,162,191,78,119,151,192,193,489],"class_list":["post-859","post","type-post","status-publish","format-standard","hentry","category-atl","category-audio","category-media-tools","category-source","category-wtl","tag-atl","tag-c","tag-capture","tag-device","tag-directshow","tag-filter","tag-pcm","tag-tone","tag-virtual","tag-wtl"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=859"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/859\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}