Clear Filters
Clear Filters

About error"The function 'analoginput' is no longer supported. Use the session-based interface."

3 views (last 30 days)
function [signal,Fs,Nbits,time,nfft]=Record(refreshRate)
%%This function records audio from the microphone and writes the audio into
%%a wav file in Record Mode.
% Developed by Gabriel Brais Martinez Silvosa
% September, 2013
%%Acquisition settings
sampleRate = 48000; % Hz
N=24; %N-bit/ sample
ai = analoginput('winsound');
addchannel(ai,1);
sampleRate = setverify(ai, 'SampleRate', sampleRate);
ai.TimerPeriod = refreshRate;
spt = ceil(sampleRate * refreshRate);
ai.SamplesPerTrigger = spt;
nfft=spt;
set(ai,'SamplesPerTrigger',nfft);
%%
% Start Acquisition %%
start(ai);
[data time] = getdata(ai);
%
%Record Acquisition
audiowrite(data,sampleRate,N,'16amship.wav');
%
[signal,Fs,Nbits]=audioread('16amship.wav');
delete(ai);
clear ai
hi all~
When I run matlab I get the error "The function 'analoginput' is no longer supported. Use the session-based interface"(line 13)
Does anyone know how to correct this code?
thanks a lot !

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!