Utils
crusade.utils
Functions
download_dataset(name='rfcx/frugalai', streaming=False, token=None, split='train')
Downloads the RFCx FrugalAI dataset using the Hugging Face datasets library. to login:
Returns:
| Name | Type | Description |
|---|---|---|
DatasetDict |
The downloaded dataset containing training, validation, and test splits. |
Source code in crusade/utils.py
low_pass_filter(modulated_signal, window_size=301, gain=4.65415)
Applies a low-pass filter to the modulated signal using a Hann window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modulated_signal
|
float
|
Input modulated signal (e.g., spike train). |
required |
window_size
|
int
|
Size of the Hann window for filtering. |
301
|
gain
|
float
|
Gain factor to scale the filtered signal. |
4.65415
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
The filtered signal. |
Source code in crusade/utils.py
audio_resampling_and_scaling(audio: Float[Array, '#time'], original_frequency: float, target_frequency: float, scaling_factor=1.0) -> Float[Array, '#time']
Resamples and scales the input audio signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
audio
|
Array
|
Input audio signal. |
required |
original_frequency
|
float
|
Original sampling frequency of the audio signal. |
required |
target_frequency
|
float
|
Target sampling frequency for resampling. |
required |
scaling_factor
|
float or str
|
Scaling factor or method ('normalize') for scaling the audio signal. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
Array |
Float[Array, '#time']
|
Resampled and scaled audio signal. |
Source code in crusade/utils.py
mu_encoding(signal, mu=255)
Applies mu-law encoding to the input signal (it should be pronounced mi).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
float
|
Input audio signal. |
required |
mu
|
int
|
Mu parameter for mu-law encoding. |
255
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
Mu-law encoded signal. |