I don't want to replace the existing file instead create a new audio file with the trimmed data, how do I achieve that?

4 vues (au cours des 30 derniers jours)
  1. I dont want to replace the exisiting file instead create a new file with the trimmed data, how do i achieve that?
  2. If I want to read the value from the text field instead of command line, what do i need to change or add ?

Réponse acceptée

Cris LaPierre
Cris LaPierre le 29 Déc 2021
Questions 1 and 4 are the same. As I stated previously, you need to use a different filename in your audiowrite code to avoid overwriting the original file.
audiowrite(app.IMPORTEditField_2.Value,y((num_samp*(a-1))+1:num_samp*b,:),fs);
% ^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- define a new/different name here
Question 2: Also answered previously. Get rid of the calls to input in your TRIM callback functions. Have it query the values of your START and END edit fields
a = app.STARTEditField.Value;
b = app.ENDEditField.Value;
Question 3: How do you mix two audio files in MATLAB?
  2 commentaires
Rezaul Reza
Rezaul Reza le 29 Déc 2021
Modifié(e) : Rezaul Reza le 29 Déc 2021
well, i followed that bit however, when i press th button i get this. I downloaded a fresh wave file (don't leave me/road)
is it because of the audio that i chose? or a coding bug?
Also, if i try to import any other songs, i am getting the below error( which i didnt experience previously)
Also, I am finding this.
The "TRIM" button was working fine for the forst time it even showed the msgbox which i added and the audio was trimmed.
But after that I am keep getting this:
Cris LaPierre
Cris LaPierre le 29 Déc 2021
Modifié(e) : Cris LaPierre le 29 Déc 2021
It looks like the issue is you used text Edit Fields for your Start and End inputs. Replace these with numeric Edit Fields. Name them the exact same thing so you don't have to change any other code.
A = 1:5;
% works
A(2)
ans = 2
% Doesn't work
A('2')
Index exceeds the number of array elements. Index must not exceed 5.
With them being numeric, you can now set the Limits property so that the user cannot specify a value greater than the length of your audio signal.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by