Package ca.phon.media

Class LongSound

java.lang.Object
ca.phon.media.LongSound
All Implemented Interfaces:
IExtendable
Direct Known Subclasses:
AudioFileLongSound

public abstract class LongSound extends Object implements IExtendable
LongSound objects allow for access to audio stream information without loading the entire audio file into memory. Segments may be extracted from the LongSound for analysis.
  • Field Details

    • PREFERRED_LONGSOUND_LOADER_PROP

      public static final String PREFERRED_LONGSOUND_LOADER_PROP
  • Constructor Details

    • LongSound

      protected LongSound(File file)
  • Method Details

    • fromFile

      public static LongSound fromFile(File file, VolumeModel volumeModel) throws IOException
      Throws:
      IOException
    • getFile

      public File getFile()
    • close

      public abstract void close() throws IOException
      Throws:
      IOException
    • numberOfChannels

      public abstract int numberOfChannels()
      Number of channels in audio file.
      Returns:
      number of channels
    • length

      public abstract float length()
      Length of audio in seconds
      Returns:
    • getSampled

      public abstract Sampled getSampled()
      As sampled
      Returns:
      return long sound data as a sampled object
    • extractPart

      public abstract Sound extractPart(float startTime, float endTime)
      Extract portion of sound for analysis.
      Parameters:
      startTime -
      endTime -
      Returns:
      sound segment
    • getExtensions

      public Set<Class<?>> getExtensions()
      Description copied from interface: IExtendable
      Return all extension types supported
      Specified by:
      getExtensions in interface IExtendable
    • getExtension

      public <T> T getExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Get the requested extension if available.
      Specified by:
      getExtension in interface IExtendable
      Returns:
      the capability object or null if the cability is not available
    • putExtension

      public <T> T putExtension(Class<T> cap, T impl)
      Description copied from interface: IExtendable
      Add a new extension.
      Specified by:
      putExtension in interface IExtendable
      Parameters:
      cap - the extension to add
      Returns:
      the added extension implementation
    • removeExtension

      public <T> T removeExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Remove a capability.
      Specified by:
      removeExtension in interface IExtendable
      Parameters:
      cap - the capability to remove