AudioTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : What's New and Release Notes : updates/Maple2020/AudioTools

AudioTools

Maple 2020 updates AudioTools with features that help you work with high precision audio, PCM WAV files, and more.

restart:

withAudioTools:

 

Read Part of an Audio File

Fast Convolution of Audio and Convolution of Multi-Channel Audio

Floating-Point WAV Files

High Sample Rates

Efficient White Noise Generator

Asymmetric Mapping from Internal Signal Values to External File

Read Part of an Audio File

You can now read part of an audio file with the new samples option for Read.

audFile  FileTools:-JoinPathkerneloptsdatadir, audio, ViolinThreePosVibrato.wav:

violinNote_sub  ReadaudFile, samples = 103..60103

violinNote_subSample Rate44100File FormatPCM File Bit Depth16Channels2Samples/Channel59001Duration1.33789s

(1.1)

Fast Convolution of Audio and Convolution of Multi-Channel Audio

You can create many audio effects with convolution. For example, you can add reverb, or simulate how audio would sound in a specific room with its convolution with an impulse response.

 

For Maple 2020, AudioTools:-Convolution is significantly faster (for the default case) for those CPUs where the Intel IPP libraries can run optimized code.

 

Consider this violin note (to interact with the audio playback buttons below, open this page as a worksheet)

violinNote_full  ReadaudFile..,1:

PreviewviolinNote_full,output = embed

   

Read the kernel for the convolutiona "ding" sound.

kernel  ReadFileTools:-JoinPathkerneloptsdatadir, audio, ding.wav:

Previewkernel, output = embed

   

Convolution of the violin note with the ding sound (on an i7-8650U processor, Maple 2019 takes 2.6 s, while Maple 2020 takes 0.02 s)

tt  timereal:violinNote_conv  Convolution violinNote_full, kernel:timerealtt;

0.079

(2.1)

PreviewviolinNote_conv,output=embed

   

Moreover, AudioTools:-Convolution now supports multi-channel audio. For audio with M channels, the kernel can be specified as an M-column Matrix or Array. Each channel of the kernel is applied to the corresponding channel of the audio.

Floating-Point WAV Files

You can now create 32-bit and 64-bit WAV files.

aud_float  Createrate = 11025,  duration = 5,float=true,bits=32;

aud_floatSample Rate11025File FormatIEEE_FLOAT File Bit Depth32Channels1Samples/Channel55125Duration5.00000s

(3.1)

#Writeaud_float.wav,aud_float

High Sample Rates

You can now write audio files with sample rates of up to 232 - 1 Hz = 4.29 GHz.

aud_high_sample_rate  Create rate = 221

aud_high_sample_rateSample Rate2097152File FormatPCM File Bit Depth16Channels1Samples/Channel2097152Duration1.00000s

(4.1)

#Writeaud_high_sample_rate.wav,aud_high_sample_rate

Efficient White Noise Generator

You can now quickly generate audio filled with white noise.

aud_noise  Createnoise = true, duration = 1;

aud_noiseSample Rate44100File FormatPCM File Bit Depth16Channels1Samples/Channel44100Duration1.00000s

(5.1)

Previewaud_noise,output=embed

   

Asymmetric Mapping from Internal Signal Values to External File

PCM audio is asymmetricthe highest possible value is not equal in magnitude to the lowest possible value. For example, 16-bit audio ranges in value from -32768 to +32767. This means that positive half-cycles of a waveform are compressed compared to negative ones.

AudioTools:-Write and AudioTools:-Read now offer new options to change the mapping of minimum and maximum values in the internal representation of an audio file to external values when written to a PCM WAV file. This now reflects the reality of working with PCM audio.

data  LinearAlgebra:-RandomVector1000, generator = 0..1:for i from 1 to 1000 do if datai = 0 then datai1 end if end do:aud_sym  Createdata;

aud_symSample Rate44100File FormatPCM File Bit Depth16Channels1Samples/Channel1000Duration0.02268s

(6.1)

minaud_sym;maxaud_sym

1.

(6.2)

aud_pathFileTools:-JoinPathFileTools:-TemporaryDirectory,foo.wav

aud_pathC:\Users\skhan\AppData\Local\Temp\foo.wav

(6.3)

Warning, one or more samples could not be represented in the range -32768..32767 and were clipped

aud_asymReadaud_path, mapping = min: minaud_asym;maxaud_asym

0.999969482421875

(6.4)