audioreadTL
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Video/Audio/PDF
Introduced first in SolidGeometry 4.9, Creation date: 2020-03-27, Last change: 2025-09-14
similar to audioread but with sound output after readin
Description
similar to audioread but allows interactive use and returns information during plays
See Also: soundTL
, audiorecorderTL
, audiotrim
, audiovocoder
, audiowriteTL
Example Illustration
Syntax
[y,FS]=audioreadTL([AName,nFS])
Input Parameter
AName: | | Filename; User interaction required if empty |
nFS: | | desired sample frequency |
Output Parameter
y: | | Signal |
FS: | | Sample Frequency |
Examples
audioreadTL('/Users/lueth/Desktop/IMG_9776.mp4');
audioreadTL;
Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, audioreadTL, is designed to read audio files and optionally play them back, providing interactive use and feedback on the sample frequency. It is similar to the standard audioread function but includes additional features for user interaction and sound output.
Input Parameters
- AName: The filename of the audio file to be read. If this parameter is empty, user interaction is required to select a file.
- nFS: The desired sample frequency for the audio file. If provided, the audio will be resampled to this frequency.
Output Results
- y: The audio signal data read from the file.
- FS: The sample frequency of the audio signal.
Algorithm Steps
- Retrieve the filename (
AName) and desired sample frequency (nFS) from the input parameters using the getfuncparams function.
- If
AName is empty, prompt the user to select a file using tryuigetfile, which filters for *.mp4, *.mp3, and *.wav formats.
- If no filename was initially provided, output a debug message with the selected filename.
- Read the audio file using
audioread, obtaining the audio data (y) and its sample frequency (FS).
- If a desired sample frequency (
nFS) is specified, resample the audio data to this frequency using audioresample.
- If no output arguments are specified, print the sample frequency in kHz and play the audio using
soundTL.
Algorithm explaination created using ChatGPT on 2025-08-19 06:50. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21