insert a microphone in worksheet or document
Component Palette Image
The microphone component is used to capture sound from a recording device.
The microphone component is customized by setting options in the Microphone context panel. To display the Microphone context panel, click the embedded component. Actions are associated with components using routines in the DocumentTools package.
The Name property is used to reference the component when using routines from the DocumentTools package.
The microphone component must be assigned to a microphone on your system. To do this, open the context panel and then select a microphone from Microphone Device.
Each microphone component must be assigned its own Microphone Device. That is, if you have two microphone components on your worksheet, you cannot assign the same microphone to both components.
The following table describes the control and use of the microphone component options:
An x in the Get column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.
An x in the Set column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.
true or false
The microphone device to use for recording sound.
Whether the component is enabled. If enabled is set to false, the component is dimmed and any action associated with it cannot be initiated. By default, the value is true.
Whether the microphone is recording. Set this property to true to start capturing sound.
The sample rate for recording sound in Hz. 44100Hz is CD quality.
Whether audio is captured using one channel (mono) or two channels (stereo).
The text that appears when the user hovers the mouse over the microphone component.
The type of the component. This returns "Microphone".
A buffer that stores input from the microphone. When this is programmatically queried, the values for the buffer are returned, and the current buffer is emptied.
Specifies if the microphone component is visible. By default, the value is true.
The Maple code in the "Recording Start Action" is called when a recording is started, either by clicking on the microphone icon or by setting the record property to true.
The Maple code in the "Recording End Action" is called when a recording is stopped, either by clicking on the microphone icon or by setting the record property to false.
The microphone can start recording using either a programmatic command, or by just clicking on the component.
SetProperty("Microphone0", record, true);
Once the microphone is recording, its "value" is a storage buffer that holds up to the microphone's sample rate divided by 2 values. In order to record a sound, this buffer needs to be continually emptied into another storage table.
R := GetProperty("Microphone0", value);
The microphone can be turned off either programmatically or by clicking on the microphone component again.
SetProperty("Microphone0", record, false);
Certain properties of the microphone can be set or retrieved from the microphone:
rate := GetProperty("Microphone0", samplerate);
The AudioTools:-Record command can be used to capture a sample of a given duration:
Recording := AudioTools:-Record(2*Unit('s'), "Microphone0");
If a speaker component is present, this rtable can be played back, otherwise the AudioTools:-Preview command can display the dynamics of this sound.
AudioTools:-Preview(Recording, output = embed);
Application: Interaural Time Delay
Download Help Document
What kind of issue would you like to report? (Optional)