help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MatLab Port - 'fullfile' issues


From: FuzE
Subject: MatLab Port - 'fullfile' issues
Date: Thu, 4 Dec 2014 13:13:48 -0800 (PST)

Hey All,Quite new to Octave and trying to port a lot of MatLab code.  This is
just the first file in the project, and I appear to be having trouble with
"fullfile".  Here's the command window input/error, followed by the full
file code. I'd appreciate any thoughts on how this can be approached.  Thank
you!Fuz>> Prototype_01_ServerWaiting...rm: cannot lstat
`../../bridge/\\tmpMsgFromBridge.m': No such file or directoryerror:
wavread: No such file or directoryerror: called from:error:  
C:\Octave\Octave-3.8.2\share\octave\3.8.2\m\audio\wavread.m at line 74,
column 7error:  
C:\Users\Fuz\Desktop\GiderosStuff\projects\App1\MATLAB\prototype_01\Prototype_01_Server.m
at line 32, column 27and the code:function Prototype_01_Server()        %
Configure user options    bridgeDir = '../../bridge/';    demoAudio = 3;   
saveDir =
'/Users/Fuz/Desktop/GiderosStuff/projects/App1/MATLAB/prototype_01/data/server';
       
while (true)        fprintf('Waiting...\n');        fName =
fullfile(bridgeDir, 'tmpMsgFromBridge.m');        while ~exist(fName,
'file')            pause(.1);        end        clear tmpMsgFromBridge;       
run(fName);             system(sprintf('rm %s', fName));        tStamp = clock; 
      
filename = sprintf('%d', tStamp(1:5));                    % determine what
message we received        switch msg.id            case demoAudio              
 
[fName, path] = uigetfile({'*.wav', 'WAV Files'}, 'Pick a file');               
[audio, fs] = wavread(fullfile(path, fName));                fName =
fullfile(bridgeDir, 'tmpAudio.wav');                wavwrite(audio, fs,
fName);                fName = fullfile(bridgeDir, 'tmpMsgToBridge');           
    
fid = fopen(sprintf('%s.tmp', fName), 'w');                fprintf(fid,
'msg={}\n');                fprintf(fid, 'msg.id=1\n');               
fprintf(fid, 'msg.fName="tmpAudio.wav"\n');                fclose(fid);         
      
system(sprintf('mv %s.tmp %s.lua', fName, fName));               
fprintf('Sent DemoAudioMsg...\n');                            case
MsgAudio.MID_AUDIO_SAMPLES                fprintf('Received audio
message...\n');                fName = fullfile(bridgeDir, msg.fName);          
     
audioStruct = struct();                [audioStruct.audio, audioStruct.Fs] =
wavread(fName);                wavpath_rcvd = fullfile(saveDir, [filename,
'_rcvd.wav']);                AudioHandler.writeAudioFile(audioStruct,
wavpath_rcvd);                    fprintf('Processing Audio...\n');             
  
% Analyze input wav file, store results in JavaDb                javaDbPath
= fullfile(saveDir, filename);                SimpleAnalysis(wavpath_rcvd,
javaDbPath);                                % Extract prosody data from
Analysis db                prosodyStruct =
ProsodyHandler.extractJavaDb(javaDbPath);                                %
Write prosody data to csv file (only for debug)                csvpath_send
= fullfile(saveDir, [filename, '_send.csv']);               
ProsodyHandler.writeCsvFile(prosodyStruct, csvpath_send);                       
        
% Send analyzed prosody message to client                fName =
fullfile(bridgeDir, 'tmpMsgToBridge');                fid =
fopen(sprintf('%s.tmp', fName), 'w');                fprintf(fid,
'msg={}\n');                fprintf(fid, 'msg.id=2\n');               
fprintf(fid, 'msg.filtIDs={');                if
~isempty(prosodyStruct.filtId)                    fprintf(fid, '%d,',
prosodyStruct.filtId);                end                fprintf(fid,
'}\n');                fprintf(fid, 'msg.tStartVec={');                if
~isempty(prosodyStruct.tStart)                    fprintf(fid, '%f,',
prosodyStruct.tStart);                end                fprintf(fid,
'}\n');                fprintf(fid, 'msg.pitchTrack={');                if
~isempty(prosodyStruct.pitch)                    fprintf(fid, '%f,',
prosodyStruct.pitch);                end                fprintf(fid, '}\n');    
           
fprintf(fid, 'msg.powerTrack={');                if
~isempty(prosodyStruct.power)                    fprintf(fid, '%f,',
prosodyStruct.power);                end                fprintf(fid, '}\n');    
           
fclose(fid);                system(sprintf('mv %s.tmp %s.lua', fName,
fName));                fprintf('Sent ProsodyMsg...\n');                        
   
case MsgProsody.MID_PROSODY_DATA                fprintf('Received
ProsodyMsg...\n');                prosodyStruct = struct();               
prosodyStruct.filtId = msg.filtId';                prosodyStruct.tStart =
msg.tStart';                if isfield(msg, 'pitchEnvTime') &&
length(msg.pitchEnvTime) > 1                    tmp =
interp1(msg.pitchEnvTime, msg.pitchEnvVal, msg.tStart, 'linear');               
    
tmp(isnan(tmp)) = msg.pitch(isnan(tmp));                    tmp(msg.pitch <
60) = 0;                    prosodyStruct.pitch = tmp';                else     
              
prosodyStruct.pitch = msg.pitch';                end                if
isfield(msg, 'powerEnvTime') && length(msg.powerEnvTime) > 1                   
tmp = interp1(msg.powerEnvTime, msg.powerEnvVal, msg.tStart, 'linear');         
          
tmp(isnan(tmp)) = msg.power(isnan(tmp));                   
prosodyStruct.power = tmp';                else                   
prosodyStruct.power = msg.power';                end                            
       
% Parse prosody message and save as csv file                csvpath_rcvd =
fullfile(saveDir, [filename, '_rcvd.csv']);               
ProsodyHandler.writeCsvFile(prosodyStruct, csvpath_rcvd);                       
        
% Update Java Db with new prosody data                dbFilts =
ProsodyHandler.loadJavaDb(prosodyStruct, javaDbPath);                           
    
% Fix tDur field to be frame length                dbSynth = dbFilts;           
    
tStart = [dbSynth.tStart];                tDur = [diff(tStart), 5e-3];          
     
tmp = num2cell(tDur);                [dbSynth.tDur] = deal(tmp{:});             
                  
% Convert dbSynth to serialized synthesis job                serJob =
AettsLoader.dbSynthToJava(dbSynth);                                %
Synthesize job and save to wav file                wavpath_send =
fullfile(saveDir, [filename, '_send.wav']);               
AettsLoader.synthesizeJob(serJob, wavpath_send);                               
% Send synthesized audio message to client                audioStruct =
AudioHandler.readAudioFile(wavpath_send);                audioStruct.audio =
int16(round(audioStruct.audio * 32768));                fName =
fullfile(bridgeDir, 'tmpAudio.wav');               
wavwrite(audioStruct.audio, audioStruct.Fs, fName);                fName =
fullfile(bridgeDir, 'tmpMsgToBridge');                fid =
fopen(sprintf('%s.tmp', fName), 'w');                fprintf(fid,
'msg={}\n');                fprintf(fid, 'msg.id=1\n');               
fprintf(fid, 'msg.fName="tmpAudio.wav"\n');                fclose(fid);         
      
system(sprintf('mv %s.tmp %s.lua', fName, fName));               
fprintf('Sent AudioMsg...\n');        end    endend



--
View this message in context: 
http://octave.1599824.n4.nabble.com/MatLab-Port-fullfile-issues-tp4667690.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]