Protocol
speaker_calibration.protocol
Calibration
The calibration class which performs and stores the results from the type of calibration specified in the settings object.
Attributes:
| Name | Type | Description |
|---|---|---|
settings |
Settings
|
the object containing the settings to be used in the calibration protocol |
soundcard |
SoundCard
|
the object that allows the calibration code to interface with the soundcard used in the calibration |
adc |
RecordingDevice
|
the object the allows the calibration code to interface with the ADC used in the calibration |
path |
Path
|
the path to the output file of the current calibration |
callback |
Optional[Callable]
|
a callback function that allows the calibration code to periodically send data to the user interface with some data based on a keyword |
noise_calibration()
Performs the white noise speaker calibration.
noise_sweep(amp_array, duration, type='Calibration')
Plays sounds with different amplitudes and calculates the correspondent intensities in dB SPL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amp_array
|
ndarray
|
The array containing the amplitude levels to be used in the different sounds. |
required |
duration
|
float
|
The duration of the sounds (s). |
required |
type
|
Literal['Calibration', 'Test']
|
Indicates whether this function is being run in the calibration or in the test of a calibration |
'Calibration'
|
Returns:
| Name | Type | Description |
|---|---|---|
db_spl |
ndarray
|
The array containing the measured dB SPL values for each amplification value. |
sounds |
ndarray
|
The array containing both the original and acquired signals for each amplification value. |
record_sound(signal, filename, duration, filter=False)
Records the sounds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
Sound
|
The signal to be played and recorded. |
required |
filename
|
str
|
The path to the file to which the sound will be saved to and from which the sound is upload from (in case a Harp SoundCard is used). |
required |
duration
|
float
|
The duration of the sound (s). |
required |
filter
|
bool
|
Indicates whether the acquired signal should be filtered or not. |
False
|
use_mic_response
|
bool
|
Indicates whether the microphone frequency response should be used as a compensation method. It's useful when calculating the speaker EQ filter. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
sound |
Sound
|
The recorded sound. |