object AudioFile extends ReaderFactory with AudioFilePlatform
The AudioFile
allows reading and writing
of sound files. It can operate both on a RandomAccessFile
created from a File
instance, or on
an kind of InputStream
(not every codec will
support this though, and functionality might be limited, for example
seeking is not possible with a plain InputStream
).
The codecs are registered with AudioFileType
.
The codecs that come with AudioFile are found in the impl
package.
Reading and writing data requires a user-buffer which holds de-interleaved
floating point data, that is a two dimensional Array
which
holds Double
data. A type alias Frames
is provided
for this, and two helper methods buffer
: one static to
construct an arbitrary user-buffer, one in class AudioFile
which creates a buffer with the appropriate channel number.
- To do
the copyTo method uses a user-buffer. it should check for the possibility to directly transfer data if input and output are compatible.
- See also
AudioFileType
- Alphabetic
- By Inheritance
- AudioFile
- AudioFilePlatform
- ReaderFactory
- ReaderFactoryPlatform
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Frames = Array[Array[Double]]
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val KEY_DIRECT_MEMORY: String
System property key.
System property key. The boolean property can be set to
true
orfalse
. It will only be read once, the first time a buffer is allocated. The default isfalse
. Whentrue
,ByteBuffer.allocateDirect
is used instead ofallocate
, possibly using faster direct memory. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def buffer(numChannels: Int, bufFrames: Int = 8192): Frames
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def identify(dis: DataInputStream): Option[CanIdentify]
- Annotations
- @throws(classOf[IOException])
- def identify(path: String): Option[AudioFileType]
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- def identify(f: File): Option[CanIdentify]
Determines the type of audio file.
Determines the type of audio file.
- f
the pathname of the file
- returns
the type code as defined in
AudioFileInfo
, e.g.TYPE_AIFF
. ReturnsTYPE_UNKNOWN
if the file could not be identified.
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- Exceptions thrown
java.io.IOException
if the file could not be reader
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val log: Logger
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def openRead(is: InputStream): AudioFile
- Definition Classes
- AudioFile → ReaderFactory
- Annotations
- @throws(classOf[IOException])
- def openRead(f: File): AudioFile
Opens an audio file for reading.
Opens an audio file for reading.
- f
the path name of the file
- returns
a new
AudioFile
object whose header is already parsed and can be obtained through thespec
method.
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- Exceptions thrown
java.io.IOException
if the file was not found, could not be reader or has an unknown or unsupported format
- final def openRead(path: String): AudioFile
- Definition Classes
- ReaderFactoryPlatform
- Annotations
- @throws(classOf[IOException])
- def openReadAsync(ch: AsyncReadableByteChannel)(implicit ec: ExecutionContext): Future[AsyncAudioFile]
- Annotations
- @throws(classOf[IOException])
- def openReadAsync(uri: URI)(implicit executionContext: ExecutionContext): Future[AsyncAudioFile]
Opens an audio file for asynchronous reading.
Opens an audio file for asynchronous reading.
- uri
the path name of the file
- returns
a future
AsyncAudioFile
object whose header is already parsed when the future completes, and that can be obtained through thespec
method.
- Annotations
- @throws(classOf[IOException])
- Exceptions thrown
java.io.IOException
if the file was not found, could not be reader or has an unknown or unsupported format
- def openWrite(os: OutputStream, spec: AudioFileSpec): AudioFile
- Annotations
- @throws(classOf[IOException])
- def openWrite(path: String, spec: AudioFileSpec): AudioFile
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- def openWrite(f: File, spec: AudioFileSpec): AudioFile
Opens an audio file for reading/writing.
Opens an audio file for reading/writing. The pathname is determined by the
file
field of the providedAudioFileInfo
. If a file denoted by this path already exists, it will be deleted before opening.Note that the initial audio file header is written immediately. Special tags for the header thus need to be set in the
AudioFileInfo
before calling this method, including markers and regions. It is not possible to writer markers and regions after the file has been opened (since the header size has to be constant).- f
the path name of the file.
- spec
format and resolution of the new audio file. the header is immediately written to the hard-disc
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- Exceptions thrown
java.io.IOException
if the file could not be created or the format is unsupported
- def openWriteAsync(ch: AsyncWritableByteChannel, spec: AudioFileSpec)(implicit ec: ExecutionContext): Future[AsyncAudioFile]
- Annotations
- @throws(classOf[IOException])
- def openWriteAsync(uri: URI, spec: AudioFileSpec)(implicit executionContext: ExecutionContext): Future[AsyncAudioFile]
- Annotations
- @throws(classOf[IOException])
- def readSpec(dis: DataInputStream): AudioFileSpec
Note that this method advances in the provided input stream, its previous position is not reset.
Note that this method advances in the provided input stream, its previous position is not reset.
- Annotations
- @throws(classOf[IOException])
- def readSpec(path: String): AudioFileSpec
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- def readSpec(f: File): AudioFileSpec
- Definition Classes
- AudioFilePlatform
- Annotations
- @throws(classOf[IOException])
- def readSpecAsync(uri: URI)(implicit executionContext: ExecutionContext): Future[AudioFileSpec]
- Annotations
- @throws(classOf[IOException])
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated