Previous Up Next Guide

Using AUDIO Data Sources

The TWAIN API and the python twainmodule provide some support for AUDIO data. This section is about transferring audio data from your data Source. Only file based transfer is supported.

When creating the SourceManager object, you have to indicate that you are interested in Audio Data. Otherwise it will not let you connect to an Audio data source. The command becomes:

   self.SM=twain.SourceManager(0L, SupportedGroups = twain.DG_CONTROL | twain.DG_AUDIO)

The transfer file name is defined using the SetXferFileName() method of the source object. The file type can be set using the TWAF_ constants.

   self.SS.SetXferFileFormat("sound.wav", twain.TWAF_WAV)
The file is transferred using the method XferAudioByFile(). This routine returns the count of outstanding transfers.

   iPending = self.SS.XferAudioByFile()
Note: This functionality has not been tested, because I do not have an AUDIO source. If you do successfully use it, please forward a demonstration script for inclusion in the demo directory.

Previous Up Next Guide