Siren DLLCC External Interfaces

Siren includes several interfaces between Smalltalk and C to access sound and MIDI I/O in a cross-platform manner. These use the DLLCC package to generate Smalltalk classes whose methods are references to C functions in a dynamic library.

To compile and load these, you should either down-load the CSL library binaries package from the CSL home page (http://fastlabinc.com/CSL) or else you need to be able to use your platform's C compiler and linker (a Makefile is provided), and to capture the standard output from a VisualWorks virtual machine (normally routed to a console window).

Load and test the DLLCC External Interfaces
   LibSndFile - sound file IO in many formats
      [LibSndFileInterface example1: 'unbelichtet.aiff']
   PortMIDI - cross-platform MIDI API
      [PortMidiInterface testMIDI]
   PortAudio - cross-platform audio API
      [PortAudioInterface example0]
   FFTW - Fast Fourier Transform
      [FFTWInterface example] (try this twice)

Look at each of the interface class defs in MusicIO-External and plug in the directory names for your dynamic libraries. Each of these tests dumps output to the transcript and to the VM's stdout/console.

Flush all
   [SirenExternalInterface unload]

LibSndFile - see the class def for Siren.LibSndFileInterface in category MusicIO-External; tune the lines

      #(#libraryFiles #('libsndfile.dylib' 'sndfile_lite.dylib'))
      #(#libraryDirectories #('Siren7.5/DLLCC' '/usr/local/lib'))

This test dumps the first few 100 samples of the test file to the transcript.
   [LibSndFileInterface example1: 'unbelichtet.aiff']
   "LibSndFileInterface unloadLibraries"

PortMIDI - see the class def for Siren.LibSndFileInterface in category MusicIO-External; tune the lines

      #(#libraryFiles #('portmidi_lite.dylib' 'portmidi.dylib' 'CoreMIDI'))
      #(#libraryDirectories #('/usr/local/lib' 'Siren7.5/DLLCC'
               '/System/Library/Frameworks/CoreMIDI.framework/Versions/Current'))

This test prints the return values of a few simple MIDI operations to the transcript.
Look in the standard output of the VM (on the Mac, this means open a console tool) to see the device list that is dumped by the initialize method.
   [MIDIPort testOpenClose]
   [PortMidiInterface testMIDI]
   [MIDIPort testANote]
   "PortMidiInterface unloadLibraries"

PortAudio - see the class def for Siren.PortAudioInterface in category MusicIO-External; tune the lines

      #(#libraryFiles #('portaudio_lite.dylib' 'libportaudio.dylib'))
      #(#libraryDirectories #('Siren7.5/DLLCC' '/usr/local/lib'))

These tests are progressive, first open/close only, then simple call-backs, then actual data transfer
Look in the standard output of the VM (on the Mac, this means open a console tool) to see the device list that is dumped by the initialize method.
   [PortAudioInterface example0]
   [PortAudioInterface example1]
   [PortAudioPort playSweep]
   "PortAudioInterface unloadLibraries"

FFTW - see the class def for Siren.FFTWInterface in category MusicIO-External; tune the lines

      #(#libraryFiles #('fftw_lite.dylib' 'libfftw3f.a'))
      #(#libraryDirectories #('/usr/local/lib'))

The basic test creates a sawtooth wave and takes its FFT, displaying the result in a function view. The view also displays the original signal if you hold down while executing the expression.

   [FFTWInterface example]
   [Spectrum sweepExample display]
   [Spectrum fileExample display]

There are more examples of the use of FFTW in the Spectrum class.

See also the sections below on the SWIG interfaces to CSL and Loris.