How can I remove the file path from an audio file name?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm writing a function that will convolve an audio file with an impulse response, and then write this audio data to a new audio file. Ideally, I'd like to use audioinfo to extract the file names from the input audio files, and then use this info to produce a file name for the output audio file; this would create a file name that illustrates which two files have been convolved together, without adding an extra argument to my function for the output file name.
However, when testing out the audioinfo function, I've found that it includes the file path in the file name (eg. INFO.Filename = 'C:\Users\Robert\Documents\MATLAB\Acoustics\BWH Assignment\Audio\speech.wav'). Using this verbatim would obviously produce an unnecessarily long output file name - is there any way I can remove just the file name itself (ie. 'speech.wav' in this case), or would it just be easier to add an output file name argument to my function?
The code I used to investigate audioinfo was:
INFO = audioinfo('Audio/speech.wav');
INFO.Filename
0 Commenti
Risposta accettata
Image Analyst
il 12 Apr 2021
Try using fileparts():
[folder, baseFileNameNoExt, ext] = fileparts(fullFileName);
baseFileName = [baseFileNameNoExt, ext];
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!