Error using audioread (line 88) The file type is not supported
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm receiving the following error message when trying to use the Matlab audioread function to read .wav files with Matlab 2016a on Windows 7. The same code runs successfully on my Macbook air HighSierra with Matlab 2017b. Error message:
Error using audioread (line 88) The file type is not supported
Error in audioread (line 88) throw(exception);
Error in ch_auditory_protocol (line 129) voices{filenumber,1} = audioread(fullfile(voicesdirectory,voicefiles{filenumber,1}));
Code in question:
%% Set up Audio
%Make sure system volume is set to maximum, as all audio is
%calibrated to this level.
try
%Try to use automatic way of maximizing volume (see function
%below)
SystemVolume(1);
catch
%Otherwise, require user input to make sure this is the case.
input('\nIs system audio volume set to 100%? \n', 's');
end
%Initialize Psychtoolbox's audio presentation system.
InitializePsychSound(0);
% Open real default ("[]") soundcard as master device (+8) for playback
% only (+1), with standard low-latency, high timing precision mode, 2
% channels, 44100Hz sampling:
nrchannels = 2;
freq = 44100;
pamaster = PsychPortAudio('Open', [], 1+8, 0, freq, nrchannels);
% Start master device immediately, wait for it to be used. We won't
% stop the master until the end of the session.
PsychPortAudio('Start', pamaster, 0, 0, 1);
% Set the masterVolume for the master.We will set this at 1 and
% modulate volumes of slave devices separately.
PsychPortAudio('Volume', pamaster, 1);
% Create a slave audio device for sound playback (+1), with same
% frequency, channel count et. as master.This will be for the white
% noise. Attach this to the master.
panoise = PsychPortAudio('OpenSlave', pamaster, 1);
% Create white noise that can be played throughout this experiment,
% regardless of its length.We'll do this by creating a 30-minute-long
% sound sample and plan on stopping playback at the end of the
% experiment.
noise = rand(1,freq*1800,1);
% Make sure we have 2 channels for stereo output.
noise = [noise; noise];
% Scale noise according to the configuration settings.
noise = noise.*noisescale;
% Create an audio buffer pre-filled with the white noise.
noisebufferhandle = PsychPortAudio('CreateBuffer', panoise, noise);
PsychPortAudio('FillBuffer', panoise, noisebufferhandle);
% Because it's a big variable and has already been loaded into the
% buffer, clear it.
clearvars noise;
% Open slave device to play the signal (tone), which is a 1000-Hz tone,
% presented at full volume for 1 second.
pasignal = PsychPortAudio('OpenSlave', pamaster, 1);
base_signal = create_sound(1000, 1, 1);
base_signal = [base_signal; base_signal];
% Load voice tracks in the chosen files directory for presentation
% during catch trials.
rawfiles = dir(fullfile(voicesdirectory,'*.wav'));
voicefiles = {rawfiles.name}';
for filenumber = 1:size(voicefiles,1)
voices{filenumber,1} = audioread(fullfile(voicesdirectory,voicefiles{filenumber,1}));
end
Thanks so much for your help.
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!