info
Characteristic information about audio device writer
Syntax
Description
Examples
Read an MP3 audio file and play it through your default audio output device.
Create a dsp.AudioFileReader
object with default settings. Use the audioinfo
function to return a structure containing information about the audio file.
fileReader = dsp.AudioFileReader('speech_dft.mp3'); fileInfo = audioinfo('speech_dft.mp3')
fileInfo = struct with fields:
Filename: '/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/dsp/dsp/samples/speech_dft.mp3'
CompressionMethod: 'MP3'
NumChannels: 1
SampleRate: 22050
TotalSamples: 110033
Duration: 4.9902
Title: []
Comment: []
Artist: []
BitRate: 64
Create an audioDeviceWriter
object and specify the sample rate.
deviceWriter = audioDeviceWriter('SampleRate',fileInfo.SampleRate);
Call setup
to reduce the computational load of initialization in an audio stream loop.
setup(deviceWriter,zeros(fileReader.SamplesPerFrame,...
fileInfo.NumChannels))
Use the info
function to obtain the characteristic information about the device writer.
info(deviceWriter)
ans = struct with fields:
Driver: 'ALSA'
DeviceName: 'ALSAdefault'
MaximumOutputChannels: 32
In an audio stream loop, read an audio signal frame from the file, and write the frame to your device.
while ~isDone(fileReader) audioData = fileReader(); deviceWriter(audioData); end
Close the input file and release the device.
release(fileReader) release(deviceWriter)
Input Arguments
Audio device writer object, specified as audioDeviceWriter
System object™.
Output Arguments
Characteristic information of the audio device writer object, returned as a structure. The fields of the structure vary depending on the System object.
Version History
Introduced in R2016a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)