Class OcsfmlAudio.sound_recorder

class sound_recorder : SoundRecorder.t -> object .. end
Abstract base class for capturing sound data.

OcsfmlAudio.sound_recorder provides a simple interface to access the audio recording capabilities of the computer (the microphone).

As an abstract base class, it only cares about capturing sound samples, the task of making something useful with them is left to the derived class. Note that SFML provides a built-in specialization for saving the captured data to a sound buffer (see OcsfmlAudio.sound_buffer_recorder).


method destroy : unit
method get_sample_rate : int
Get the sample rate.

The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).
Returns Sample rate, in samples per second

method start : ?sampleRate:int -> unit -> unit
Start the capture.

The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.

sampleRate : Desired capture rate, in number of samples per second
method stop : unit
Stop the capture.