Here is a simple example (also see Chris's answer from last year):
| samplesFilename samplesFile writeBuffer |
"Ask for the file name."
putFileWithPrompt: 'Save as samples file named:'
initially: 'untitled.aif' asFilename
fileTypes: (Array with: HostDriverInterface aiffFileType)
ifCancel: [^ self abortForKyma].
"Create a SamplesFile and set up its header."
samplesFile := SamplesFile fromNewFilename: samplesFilename.
sampleRate: SignalProcessor sampleRate;
"Get a stream to write samples."
writeBuffer := samplesFile writeBuffer.
"Output the sample values."
0 to: 4095 do: [ :i | writeBuffer writeSample: i / 4095.0].
"Close the stream."