---
title: "AviAudioManager Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviAudioManager.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# AviAudioManager Class
 
This class encapsulates audio-related features of the AVI Processor.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill.Codecs.AviProcessor (in Aurigma.GraphicsMill.Codecs.AviProcessor.dll)
 
## Syntax
  
```
Public NotInheritable Class AviAudioManager _Inherits LockableObject
```
 
```csharp
public sealed class AviAudioManager : LockableObject
```
 
## Remarks
  
AVI files can contain not only video data, but also audio data as well. One file can contain several audio tracks (or *streams*) synchronized with video. When the AVI movie is played, one of audio streams is used. Advanced video players enables the user to select which audio stream to play, simpler players always play only the first stream. This way you can create AVI files which contains audio tracks in different languages, etc.
 
AVI Processor can both read and write audio data from/to AVI files. To provide this functionality both [AviReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviReader.htm.md) and [AviWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWriter.htm.md) have the property named **AudioManager** which returns an instance of this class.
 
This class implements two kinds of methods and properties: one works only when the audio manager object is returned from the [AviReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviReader.htm.md) and another - when it is returned from [AviWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWriter.htm.md). If you try to extract audio data from the writer or add it to reader, an appropriate method will fail. Let's examine both these groups of members.
 
**Reader-related Members**
 
- [ExportAudioStream(Int32, String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_ExportAudioStream_2_92264430.htm.md) method - extracts audio data and saves it to a WAV file or [Stream](http://msdn2.microsoft.com/en-us/8f86tw9e) object.
- [GetDuration(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_GetDuration_1_e1836fc4.htm.md) method - gets audio data length (in 1/100 of seconds).
- [GetChannelCount(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_GetChannelCount_1_e1836fc4.htm.md) method - gets a number of channels in the audio stream. This way you can detect whether it is mono, stereo, quadro, or Dolby sound.
- [GetBitsPerSample(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_GetBitsPerSample_1_e1836fc4.htm.md) method - gets a number of bits per sample in the audio data.
- [GetAverageBytesPerSecond(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_GetAverageBytesPerSecond_1_e1836fc4.htm.md) method - gets an averate bytes per second rate of the audio stream.
- [AudioStreamCount](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_AviAudioManager_AudioStreamCount.htm.md) property - returns a number of audio streams in the AVI file.

**Writer-related Members**
 
- [AddAudioStream(String, Int32, Int32, Boolean)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_AddAudioStream_4_9cf9dea2.htm.md) method - adds new audio stream to the AVI file. You can add either empty stream, or load audio data from the WAV file, [Stream](http://msdn2.microsoft.com/en-us/8f86tw9e) object, or another audio manager.
- [AppendAudioStream(Int32, String, Int32, Int32, Boolean)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_AppendAudioStream_5_485e1cd1.htm.md) method - appends audio data to the end of the existing audio stream.

**Note** 
There is a caveat when you add audio data to the writer. When adding or appending audio, you can specify what to do if the audio stream become longer than video stream. You can either truncate it to fit video stream or have the player to play audio data even if the video sequence stops. If you truncate the audio data, you should keep in mind that it takes into account only that video data which is already added to the writer before you add audio. That's why you should do it **after** you add all necessary video frames.
 
In addition to this, you can get duration of WAV files using the [GetAudioDuration(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_AviAudioManager_GetAudioDuration_1_bb3a7a4f.htm.md) static method.
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.LockableObject](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_LockableObject.htm.md)
        - Aurigma.GraphicsMill.Codecs.AviAudioManager
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
   
## See Also

### Reference

- [AviAudioManager Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Codecs_AviAudioManager.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
