help can work out why it not working

4 visualizzazioni (ultimi 30 giorni)
Rebbecca
Rebbecca il 16 Apr 2024
Risposto: Karanjot il 22 Apr 2024
Acappella = miraudio ('Acappella1.mp3');
Error in kitcherrebbeccas2323356 (line 11)
Acappella = miraudio ('Acappella1.mp3');
%the code is this
% Kitcher.rebbecca.s2323356 genre analysis into
clc;
clear
close all;
mirverbose(0);
%----load audio--------------
[input_file, cilps] = audioread("ROCK cilps\ROCK24.mp3");("Acappella cilps\Acappella25.mp3");
myobject = audioread('Acappella1.mp3');('ROCK1.mp3');
Acappella = miraudio ('Acappella1.mp3');
ROCK = miraudio ('ROCK1.mp3');

Risposte (1)

Karanjot
Karanjot il 22 Apr 2024
Hi Rebbeca,
The code given by you suggests that you are trying to load and analyze audio files. There are some syntax errors and the code also references the MIRtoolbox, a toolbox for audio analysis in MATLAB.
Let's address the issues and correct the code:
  1. Syntax Issues: The way you're attempting to read multiple files with 'audioread' in a single line is incorrect. Each call to 'audioread' should be on its own line and assigned to a unique variable if you intend to use the data later.
  2. MIRtoolbox Usage: When you're using 'miraudio' to load an audio file, ensure that the MIRtoolbox is correctly installed and added to your MATLAB path. The miraudio function is part of the MIRtoolbox, and the error you're encountering might be due to MATLAB not recognizing this function, possibly because the toolbox is not installed or not correctly set up.
  3. File Paths: Ensure that the file paths you are using in your code accurately reflect the location of the files on your system. If the files are not in the current working directory, you'll need to provide the full path or the correct relative path to the files.
Here's the code with correct syntax:
clc;
clear;
close all;
mirverbose(0);
% Ensure MIRtoolbox is installed and correctly set up
Acappella = miraudio('Acappella1.mp3'); % Correct syntax to load an audio file
ROCK = miraudio('ROCK1.mp3'); % Correct syntax to load another audio file
% Ensure the file paths are correct. The following examples assume the files
% are located in folders named "ROCK clips" and "Acappella clips" respectively.
% The correct MATLAB syntax requires separate lines and variables for each file.
[input_file_rock, fs_rock] = audioread("ROCK clips/ROCK24.mp3");
[input_file_acappella, fs_acappella] = audioread("Acappella clips/Acappella25.mp3");
% If 'myobject' is intended to hold audio data, ensure to load files separately like:
myobject_acappella = audioread('Acappella1.mp3');
myobject_rock = audioread('ROCK1.mp3');

Community Treasure Hunt

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

Start Hunting!

Translated by