audiovocoder
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
changes the pitch of the signal without changing the length
Description
Uses stretchAudio (2019b)
Acc Values > 1 make the voices deeper and slower in same time period
See Also: soundTL
, audiorecorderTL
, audiotrim
Example Illustration
Syntax
[NSig,NSR]=audiovocoder(OSig,[acc])
Input Parameter
OSig: | | Original signal |
acc: | | pitch; default is 1.03 |
Output Parameter
NSig: | | New Signal |
NSR: | | New Sample rate; not used yet |
Examples
Compare 3% voice vocoder
y=audiorecorderTL('PRO X',16000,5); % record 5 seconds
soundTL(audiovocoder(y,1),16000,'PRO X'); pause(5); soundTL(audiovocoder(y,1.03),16000,'PRO X')
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 algorithm is designed to change the pitch of an audio signal without altering its length. It is implemented in a MATLAB function called audiovocoder.
Input Parameters
- OSig: The original audio signal that you want to process.
- acc: The pitch adjustment factor. The default value is 1.03. Values greater than 1 will make the voice deeper and slower.
Output Results
- NSig: The new audio signal after pitch adjustment.
- NSR: The new sample rate, which is not used in this implementation.
Algorithm Steps
- The function
getfuncparams is used to retrieve the pitch adjustment factor acc from the input parameters, with a default value of 1.03.
- The original sample rate
OSR and the new sample rate NSR are both set to 44100 Hz.
- If the pitch adjustment factor
acc is not equal to 1, the function stretchAudio is called to adjust the pitch of the original signal OSig. The method used is "wsola" with a phase lock and a delta of 512.
- The stretch factor
stch is calculated as the ratio of NSR to OSR.
- The inverse of the pitch adjustment factor
acc is calculated.
- An empty array
NSig is initialized to store the new signal. Its size is determined by the adjusted length of the original signal.
- A loop iterates over each sample of the new signal
NSig:
- The index
k is calculated to map the new signal to the original signal, adjusted by the stretch factor and pitch adjustment.
- If
k exceeds the length of the original signal, it is set to the last sample of the original signal.
- The corresponding sample from the original signal is assigned to the new signal.
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