changeset 1085:178e8d9b4873 octave-forge

Accept aiff or aif as valid AIFF file extensions. Accept row oriented or column oriented data (assumes number of channels is less than the number of samples, which in almost all cases will not be a problem but there will be corner cases where this fails).
author pkienzle
date Mon, 27 Oct 2003 15:44:10 +0000
parents ca91a4bf7e88
children 36d0b29b0f73
files main/audio/auload.m main/audio/ausave.m
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/main/audio/auload.m	Mon Oct 27 15:24:13 2003 +0000
+++ b/main/audio/auload.m	Mon Oct 27 15:44:10 2003 +0000
@@ -231,7 +231,7 @@
     end
       
   ## Apple/SGI .aiff format
-  elseif strcmp(ext,'aiff')
+  elseif strcmp(ext,'aiff') || strcmp(ext,'aif')
 
     ## Header format obtained from sox/aiff.c
     ## September 25, 1991
--- a/main/audio/ausave.m	Mon Oct 27 15:24:13 2003 +0000
+++ b/main/audio/ausave.m	Mon Oct 27 15:44:10 2003 +0000
@@ -52,7 +52,12 @@
   end
   ext = tolower(substr(path, ext+1, length(path)-ext));
 
+  # determine data size and orientation
   [samples, channels] = size(data);
+  if (samples < channels)
+    data = data.';
+    [samples, channels] = size(data);
+  endif
 
   ## Microsoft .wav format
   if strcmp(ext,'wav') 
@@ -165,7 +170,7 @@
     fwrite(file, channels, 'long', 0, arch);
 
   ## Apple/SGI .aiff format
-  elseif strcmp(ext,'aiff')
+  elseif strcmp(ext,'aiff') || strcmp(ext,'aif')
 
     ## Header format obtained from sox/aiff.c
     ## September 25, 1991