Hello @Josh ,
I am facing an issue with load() push() and play() of sounds with the BpodHiFi object.
The playback of simple loaded sounds is not corresponding to the sine waves loaded.
I experienced many weird HiFi module behaviors like sounds repeated, cut, overlayed with other sounds, pop even if long enveloppe is added ... all of this with simple code similar to the following one :
`%% Sounds Vectors
sr = 192000; % sampling rate
freqA = 4000; % Frequency of the sine wave A in Hz
freqB = 8000; % Frequency of the sine wave B in Hz
duration = 1; % Duration of the sine waves in seconds
t = 0:1/sr:duration-1/sr; % Time vector
waveformA = sin(2pifreqAt);
waveformB = sin(2pifreqBt);
%% Start Bpod
global BpodSystem
if isempty(BpodSystem)
Bpod
end
BpodSystem.ModuleUSB.HiFi1='COM6';
BpodSystem.assertModule('HiFi', 1);
%% Generate HiFi object
clear H
H = BpodHiFi(BpodSystem.ModuleUSB.HiFi1);
H.SamplingRate = sr;
H.DigitalAttenuation_dB = -30;
%% Load & Play sound A
H.load(1,waveformA)
H.push()
H.play(1)
pause(3)
%% Load & Play sound B
H.load(2,waveformB)
H.push()
H.play(2)
pause(3)
%% Sounds are not corresponding to the waveform and loading of a new one affect other sounds
H.play(1)
`
The strange HiFi module behavior is also happening when running a SMA (it mimicks what happened with BpodHiFi object functions).
I am suspecting issue in sounds overwriting, is there a matlab command flushing for sure the previously loaded sounds ?
Could it be related to firmware version or known bugs (SD card being dead ...) ?
Cheers,
Vlad
config: r2plus firmware version 23 ; HiFi firmware version v5 ; Windows 10 64 / i7-1355U 1.70 GHz / RAM 32,0 Go