Squeak Class Documentation category index | class index  
 
SunAudioFileWriter
  category: Sound-Synthesis
  superclass: Object
  subclasses:

I encode monophonic sampled sounds in Sun audio (.au) file format. Sun audio files have a very simple format but can store both compressed and uncompressed sample data. I can write this format either directly into a file or onto any writable binary stream.

instance methods
  initialization
  setStream:

  other
  appendBytes:
appendSamples:
closeFile
ensureOpen
updateHeaderDataSize
writeHeaderSamplingRate:
writeHeaderSamplingRate:format:

class methods
  instance creation
  onFileNamed:
onStream:

  sound storing
  codecForFormatCode:
formatCodeForCompressionType:
storeSound:onFileNamed:compressionType:

instance methods
  initialization top  
 

setStream:

Initialize myself for writing on the given stream.


  other top  
 

appendBytes:

Append the given sample data to my stream.


 

appendSamples:

Append the given SoundBuffer to my stream.


 

closeFile

Update the Sun audio file header to reflect the final size of the sound data. If my stream is a file stream, close it and, on a Macintosh, set the file type and creator to that used by SoundApp for Sun Audio files. (This does nothing on other platforms.)


 

ensureOpen

Ensure that my stream is open.


 

updateHeaderDataSize

Update the Sun audio file header to reflect the final size of the sound data.


 

writeHeaderSamplingRate:

Write a Sun audio file header for 16-bit linear format.


 

writeHeaderSamplingRate:format:

Write a Sun audio file header for the given sampling rate and format. Currently, only monophonic files are supported.


class methods
  instance creation top  
 

onFileNamed:

Answer an instance of me on a newly created file with the given name.


 

onStream:

Answer an instance of me on the given binary stream.


  sound storing top  
 

codecForFormatCode:

Answer the codec for the given Sun audio file format number.


 

formatCodeForCompressionType:

Answer the Sun audio file format number for the given compression type name.


 

storeSound:onFileNamed:compressionType:

Store the samples of the given sampled sound on a file with the given name using the given type of compression. See formatCodeForCompressionType: for the list of compression types.