Index: /OniSplit/Program.cs
===================================================================
--- /OniSplit/Program.cs	(revision 1130)
+++ /OniSplit/Program.cs	(revision 1131)
@@ -367,15 +367,16 @@
 
             SoundExporter exporter;
-
+            var noDemo = args.Any(a => a == "-nodemo");
+            Console.WriteLine(noDemo);
             switch (fileType)
             {
                 case "aif":
-                    exporter = new AifExporter(fileManager, outputDirPath);
+                    exporter = new AifExporter(fileManager, outputDirPath, noDemo);
                     break;
                 case "wav":
-                    exporter = new WavExporter(fileManager, outputDirPath);
+                    exporter = new WavExporter(fileManager, outputDirPath, false, noDemo);
                     break;
                 case "pcm":
-                    exporter = new WavExporter(fileManager, outputDirPath, true);
+                    exporter = new WavExporter(fileManager, outputDirPath, true, noDemo);
                     break;
                 default:
Index: /OniSplit/Sound/AifExporter.cs
===================================================================
--- /OniSplit/Sound/AifExporter.cs	(revision 1130)
+++ /OniSplit/Sound/AifExporter.cs	(revision 1131)
@@ -7,4 +7,6 @@
     {
         #region Private data
+        private bool do_pc_demo_test;
+
         private const int fcc_FORM = 0x464f524d;
         private const int fcc_AIFC = 0x41494643;
@@ -20,12 +22,13 @@
         #endregion
 
-        public AifExporter(InstanceFileManager fileManager, string outputDirPath)
+        public AifExporter(InstanceFileManager fileManager, string outputDirPath, bool noDemo = false)
             : base(fileManager, outputDirPath)
         {
+            do_pc_demo_test = !noDemo;
         }
 
         protected override void ExportInstance(InstanceDescriptor descriptor)
         {
-            var sound = SoundData.Read(descriptor);
+            var sound = SoundData.Read(descriptor, do_pc_demo_test);
 
             using (var stream = File.Create(Path.Combine(OutputDirPath, descriptor.FullName + ".aif")))
@@ -34,5 +37,5 @@
                 if (!(sound.IsIMA4))
                 {
-                    throw new NotSupportedException("Transcoding from PC ADPCM to Mac/demo ADPCM not supported!");
+                    throw new NotSupportedException("Transcoding from MS ADPCM (PC) to IMA4 ADPCM (Mac) not supported!");
                 }
                 writer.Write(Utils.ByteSwap(fcc_FORM));
Index: /OniSplit/Sound/SoundData.cs
===================================================================
--- /OniSplit/Sound/SoundData.cs	(revision 1130)
+++ /OniSplit/Sound/SoundData.cs	(revision 1131)
@@ -12,5 +12,5 @@
         public byte[] Data;
 
-        public static SoundData Read(InstanceDescriptor sndd)
+        public static SoundData Read(InstanceDescriptor sndd, bool do_pc_demo_test)
         {
             if (sndd.Template.Tag != TemplateTag.SNDD)
@@ -47,4 +47,26 @@
                 sound.Data = rawReader.ReadBytes(dataSize);
 
+            if (sound.IsIMA4 && do_pc_demo_test) // check if the raw data actually looks like IMA4
+            {
+                int nIMABlocks = sound.Data.Length / 34;
+                int remainder = sound.Data.Length - nIMABlocks * 34;
+                if (remainder == 0 && (nIMABlocks % sound.ChannelCount) == 0)
+                {
+                    bool stepIndexAbove88 = false;
+                    for (int ii = 0; ii < nIMABlocks; ii++)
+                    {
+                        Byte cc = sound.Data[ii * 34 + 1];
+                        if ((cc & 0x7F) > 88)
+                            stepIndexAbove88 = true;
+                    }
+                    if (stepIndexAbove88)
+                        sound.IsIMA4 = false;
+                }
+                else
+                    sound.IsIMA4 = false;
+                if (!(sound.IsIMA4))
+                    Console.WriteLine("PC-demo MS ADPCM detected; use -nodemo flag to treat as IMA4.");
+            }
+
             return sound;
         }
Index: /OniSplit/Sound/WavExporter.cs
===================================================================
--- /OniSplit/Sound/WavExporter.cs	(revision 1130)
+++ /OniSplit/Sound/WavExporter.cs	(revision 1131)
@@ -8,4 +8,5 @@
         #region Private data
         private bool convert_to_PCM;
+        private bool do_pc_demo_test;
 
         private const int fcc_RIFF = 0x46464952;
@@ -86,8 +87,9 @@
         #endregion
 
-        public WavExporter(InstanceFileManager fileManager, string outputDirPath, bool convertToPCM = false)
+        public WavExporter(InstanceFileManager fileManager, string outputDirPath, bool convertToPCM = false, bool noDemo = false)
             : base(fileManager, outputDirPath)
         {
             convert_to_PCM = convertToPCM;
+            do_pc_demo_test = !noDemo;
         }
 
@@ -147,5 +149,5 @@
         protected override void ExportInstance(InstanceDescriptor descriptor)
         {
-            var sound = SoundData.Read(descriptor);
+            var sound = SoundData.Read(descriptor, do_pc_demo_test);
 
             using (var stream = File.Create(Path.Combine(OutputDirPath, descriptor.FullName + ".wav")))
@@ -162,6 +164,6 @@
                 var samplesPerBlock = 2 + (blockSizeADPCM - sound.ChannelCount * 7) * 8 / sound.ChannelCount / 4;
 
-                Int32 sampleCount = sampleCount = wholeBlocks * samplesPerBlock + leftoverSamples; 
-                
+                Int32 sampleCount = sampleCount = wholeBlocks * samplesPerBlock + leftoverSamples;
+
                 if (sound.IsIMA4) // IMA4 ADPCM format
                 {
@@ -170,10 +172,9 @@
                     sampleCount = (sound.Data.Length / blockSizeADPCM) * samplesPerBlock;
                 }
-
                 if (!convert_to_PCM)
                 {
                     if (sound.IsIMA4)
                     {
-                        throw new NotSupportedException("Transcoding from Mac/demo ADPCM to PC ADPCM not supported! Please use -extract:pcm");
+                        throw new NotSupportedException("Transcoding from IMA4 ADPCM (Mac) to MS ADPCM (PC) not supported! Please use -extract:pcm");
                     }
                     var format = (byte[])formatTemplate_ADPCM.Clone();
@@ -271,4 +272,8 @@
                             }
                             stepIndexL = headerLoL & 0x7f;
+                            if (stepIndexL > 88)
+                                Console.WriteLine("Block {0} (L): Initial IMA4 step index is {1}, clamping to 88.", block, stepIndexL);
+                            ClampToRange(ref stepIndexL, 0, 88);
+
                             for (int b = 0; b < 32; b++)
                             {
@@ -291,4 +296,7 @@
                                 }
                                 stepIndexR = headerLoR & 0x7f;
+                                if (stepIndexR > 88)
+                                    Console.WriteLine("Block {0} (R): Initial IMA4 step index is {1}, clamping to 88.", block, stepIndexR);
+                                ClampToRange(ref stepIndexR, 0, 88);
 
                                 for (int b = 0; b < 32; b++)
@@ -360,13 +368,15 @@
                                 }
                             }
-                            // read pair of nibbles
-                            Byte nibbles = sound.Data[pos++];
-                            Byte nibbleHi = (Byte)(nibbles >> 4);
-                            Byte nibbleLo = (Byte)(nibbles & 0xF);
-                            samplesL[iSampleL++] = NibbletoSampleMSADPCM(ref sample1L, ref sample2L, ref deltaL, pred_indexL, nibbleHi);
-                            if (sound.ChannelCount == 2)
-                                samplesR[iSampleR++] = NibbletoSampleMSADPCM(ref sample1R, ref sample2R, ref deltaR, pred_indexR, nibbleLo);
-                            else
-                                samplesL[iSampleL++] = NibbletoSampleMSADPCM(ref sample1L, ref sample2L, ref deltaL, pred_indexL, nibbleLo);
+                            else // read pair of nibbles
+                            {
+                                Byte nibbles = sound.Data[pos++];
+                                Byte nibbleHi = (Byte)(nibbles >> 4);
+                                Byte nibbleLo = (Byte)(nibbles & 0xF);
+                                samplesL[iSampleL++] = NibbletoSampleMSADPCM(ref sample1L, ref sample2L, ref deltaL, pred_indexL, nibbleHi);
+                                if (sound.ChannelCount == 2)
+                                    samplesR[iSampleR++] = NibbletoSampleMSADPCM(ref sample1R, ref sample2R, ref deltaR, pred_indexR, nibbleLo);
+                                else
+                                    samplesL[iSampleL++] = NibbletoSampleMSADPCM(ref sample1L, ref sample2L, ref deltaL, pred_indexL, nibbleLo);
+                            }
                         }
                     }
