Soundcards
speaker_calibration.soundcards
HarpSoundCard
Bases: SoundCard
This class is an implementation of the SoundCard class for the Harp SoundCard.
Attributes:
| Name | Type | Description |
|---|---|---|
device |
Device
|
The Harp device object responsible for the serial communication with the device. |
load_sound(filename, index=2)
Loads the sound to the Harp SoundCard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The path to the file containing the sound to be uploaded to the Harp SoundCard. |
required |
index
|
int
|
The index in which the sound will be stored. |
2
|
play(index=2, start_event=None)
Plays a sound from the Harp SoundCard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
The index in which the sound is stored. |
2
|
start_event
|
Event
|
A thread event used to synchronize the start of the sound with the start of the recording. If |
None
|
SoundCard
Bases: ABC
The class representing an abstract soundcard from which to implement specific ones.
Attributes:
| Name | Type | Description |
|---|---|---|
fs |
float | int
|
The sampling frequency of the soundcard. |
play()
abstractmethod
Plays a sound. This is the abstract method to be implemented for the specific soundcards that derive from this abstract class.
create_sound_file(signal_left, signal_right, filename)
Creates the .bin sound file to be loaded to the Harp Sound Card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal_left
|
Sound
|
The signal to be written to the .bin file that is going to be played by the left speaker. |
required |
signal_right
|
Sound
|
The signal to be written to the .bin file that is going to be played by the right speaker. |
required |
filename
|
str
|
The name of the .bin file. |
required |