Unlike video, audio is difficult to troubleshoot in a way that once an issue has been noticed it was dynamic and already in past and it may be difficult to repeat, explain, forward as a screenshot etc. So it needs a visualization in order to check certain specific of the media stream.
Here we go with a Audio Oscillogram Filter, a filter which may be inserted into audio part of the graph, it insists on PCM audio (multichannel is OK, 8 or 16 bits per sample), so decoders might be required upstream and will be automatically inserted.
Once the filter is running, it shows a tool window with a visualization of the waveform coming through. Additionally, it shows a discontinuity sample (that is, a sample with AM_SAMPLE_DATADISCONTINUITY flag) with a thick read vertical line, and a mismatch (gap or override) in neighboring sample start and stop times with a thin red line.
Additionally to this, a window provides an option to pop up downstream audio renderer property sheet in order to check/debug rendering statistics, such as buffer fullness and break count (programmatically available via IAMAudioRendererStats interface). Unfortunately Microsoft does not provide a well done proxy/stub pair for this interface and the property page and there is no way to access this property page connecting to graph remotely. Using this filter the property sheet is shown directly from the hosting process and works correctly.
A partial Visual C++ .NET 2008 source code is available from SVN, release binary included.
File and Class Summary
Utility.dll
Utility.dll (download) hosts the following classes:
- DirectShow Filters
- Audio Oscillogram Filter, to visualize/debug audio data
Class Overview
Audio Oscillogram Filter
The filter visualizes PCM audio data going through in a form of oscillogram.
- Filter Executable: Utility.dll
- Filter CLSID: __uuidof(PcmAudioOscillogramFilter) {1450C047-C394-469e-BBB6-A1F949B893FA}
- Filter Property Page CLSID: N/A
- Filter Merit: MERIT_DO_NOT_USE
- Filter Category: CLSID_LegacyAmFilterCategory
- Filter Interfaces: IPersistStreamInit, IPersistStream, IBaseFilter, IMediaFilter, IPersist, IAMovieSetup, IAMFilterMiscFlags, IPcmAudioOscillogramFilter, IDispatch
- Filter Pins: single input pin (Input), single ouput pin (Ouput)
- Input Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM
- Input Pin Interfaces: IPin, IMemInputPin
- Output Pin Media Types: MEDIATYPE_Audio/MEDIASUBTYPE_PCM
- Output Pin Interfaces: IPin
Remarks
The filter will create a tool window with audio visualization when put into paused/running state. The filter graph should be controlled (IMediaControl) from a GUI aware apartment so that window messages could reach internal filter’s window.
Useful tool, nice piece of work Roman, thanks for sharing!