generated from mscheltienne/template-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add I/O tests on mono sound and fix typos
- Loading branch information
1 parent
871a4eb
commit 8a52a4b
Showing
3 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from numpy.testing import assert_allclose | ||
|
||
from stimuli.audio import Noise, Sound | ||
|
||
|
||
def test_sound_io_mono(tmp_path): | ||
"""Test sound saving/loading.""" | ||
sound = Noise("pink", volume=100, duration=0.5) | ||
sound.save(tmp_path / "test.wav") | ||
sound_loaded = Sound(tmp_path / "test.wav") | ||
assert_allclose(sound.signal, sound_loaded.signal) | ||
|
||
sound = Noise("pink", volume=50, duration=0.5) | ||
sound.save(tmp_path / "test.wav", overwrite=True) | ||
sound_loaded = Sound(tmp_path / "test.wav") | ||
sound_loaded.volume = 50 | ||
assert_allclose(sound.signal, sound_loaded.signal) |