-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_smt.m
53 lines (36 loc) · 1.55 KB
/
run_smt.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% RUN SOUND MORPHING TOOLBOX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ADD FOLDER FROM CURRENTLY RUNNING SCRIPT TO MATLAB PATH
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Get full path & name of executing file
exeFile = mfilename('fullpath');
% Get full path of executing directory
exeDir = fileparts(exeFile);
% If EXEDIR is not on the path
if ~tools.iofun.isdironpath(exeDir)
% Add EXEDIR (and all subfolders) to Matlab path
tools.iofun.add2path(exeDir);
end
% Create environment variable SM with the absolute path to the base folder
setenv('SMT',exeDir)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT PARAMETERS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Absolute path of audio file (using EXEDIR)
sourcePath = fullfile(exeDir,'audio','Accordion_C#3_f.wav');
% Absolute path of audio file (using EXEDIR)
targetPath = fullfile(exeDir,'audio','Tuba_oV_hA_2-120_ff_C3.wav');
% Morphing factor
morphFactor = 0.5;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RUN SMT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
morph = smt(sourcePath,targetPath,morphFactor);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LISTEN TO SOUNDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sampling rate
fs = 44100;
audiowrite(fullfile(exeDir,'audio','morph.wav'),morph,fs)
% Play MORPH
sound(morph,fs)