KBB MMN Tone - LeoLedesma237/LeoWebsite GitHub Wiki

Below is the MATLAB code used to create the standard and deviant tones used for a version of the MMN. I think this code was mostly created either from ChatGPT or using a template in a website I found.

% Set the sampling frequency
fs = 44100;

% Set the duration of the tone in seconds
duration = .075; % 75 ms

% Create two time vector
t = 0:1/fs:duration-1/fs;

% Create the tone at 1000 Hz
f = 1000;
tone = sin(2*pi*f*t);

% Play the tone
sound(tone, fs);

% Create the tone at 1200 Hz
f2 = 1200;
tone2 = sin(2*pi*f2*t);

% Play the tone
sound(tone2, fs);

% Set working directory
cd("C:\Users\lledesma.TIMES\Documents\Zambia\MMN")

% Set the filename for the 1000 Hz and 1200 Hz tone
filename_1000 = '1000Hz.standard.75ms.wav';
filename_1200 = '1200Hz.deviant.75ms.wav';

% Write the 1000 Hz and 1200 Hz tone to a WAV file
audiowrite(filename_1000, tone, fs);
audiowrite(filename_1200, tone2, fs);