Trouble syncing multiple audio channels

    Aug 16 2010 | 11:41 am
    I'm doing an installation in which I need to play 4 channels of audio in sync with a qt movie file. When I run the 4 channels as separate mono channels using sfplay~ I end up with the precedence effect whereby the sound appears to be coming from the channel that is triggered first.
    If I just save the audio with the qt file then it doesn't separate it out into 4 channels. When I saved my audio file as a 4-channel file and tried to run it using 'sfplay~ 4' I couldn't get anything to happen.
    What would be the best way to go about doing this so that I ensure that all channels are triggered at the same time?

    • Aug 16 2010 | 12:11 pm
      sfplay~ 4 does work (it works for me since many many years), but you may need to adjust the buffer size (although I though I wasn't necessary with Max5 anymore...). Check [p "More features"] in sfplay~'s help file.
      Syncing the audio with the video is another story! Isn't it possible to have 4 audio channels in a QT movie?
    • Aug 16 2010 | 2:03 pm
      Thanks for the advice. Maybe i'm missing something really obvious but I'm just not getting any output from the 'sfplay~ 4'. I'm simply loading a 4-channel wav file into it and then sending a '1' to trigger it. Is there something else I should be doing? (obviously the output of this is going to 'dac~ 1 2 3 4' and it does work with stereo/mono files)
    • Aug 16 2010 | 9:04 pm
    • Aug 17 2010 | 8:34 am
      No need for a bump!
      Well, I never tried with a 4 channel WAV file (I always use AIFF files), and you're right: it doesn't work! Try to convert your file to AIFF...
      Interestingly, sfinfo~ doesn't return any sampletype information for my file. As it doesn't work with Max 4 neither, I first suspected my conversion to WAV to be wrong, but other softwares, like QT7, do work with my file.
      I tried only briefly on X.6.4, Max5.1.4 & Max4.6.3.
      Maybe time for a bug report...
    • Aug 17 2010 | 11:19 pm
      sfplay~ 4 channel .wav playback works for me on 5.1.4, OS10.6.4
    • Aug 18 2010 | 8:12 am
      Dave, thanks for your answer. But I still think something is wrong with 4 channels WAV.
      I created a short 4 tracks WAV in Max with sfrecord~. The file can't be read by audio softwares (like Snapper, QT or Audacity) except by Max itself. But even with Max, the preview in a File Browser doesn't work (error -208, i.e. badFileFormat).
      So I checked the header of the WAVE file. I think there is something wrong in the 'fmt ' chunk: Max creates a WAVEFORMATEXEXTENSIBLE structure, where the cbSize and samp/bits fields should be 2 bytes, but it looks like 4 bytes are used. On the attached picture, the green selection (bits per samples) should be 10 00 but is 00 00
      But I may be totally wrong, it's probably too early for me to watch hex codes...
    • Aug 18 2010 | 8:13 am
      Oopps, I forgot the picture. Here it is
    • Aug 18 2010 | 3:16 pm
      Thanks Patrick. You definitely seem to be on to something there. I tried it with an AIFF file and it worked perfectly. Seems to be a problem with WAVs.
    • Aug 18 2010 | 11:33 pm
      Yes Patrick you're right about sfrecord~. There's something about the way it writes the header of a 4+ channel .wav that makes other programs, e.g. Audacity, reject the file.
      sfplay~ seems to have no problem playing back .wav files generated by sfrecord~ or other apps.
    • Aug 19 2010 | 8:25 am
      sfplay~ does have problems playing some 4 tracks .WAV, that's the reason why this topic started (I attached one that works in QT, DP, Audacity but not with Max).
      I continued to check the bytes of .wav files. It seems to me that sfplay~ plays correctly .WAV files created with a WAVEFORMATEX structure (i.e. wFormatTag = 00 01) but not those with a WAVEFORMATEXTENSIBLE structure (i.e. wFormatTag = FF FE).
      The .WAV file format is a nightmare...
    • Jan 18 2012 | 9:16 am
      I'm afraid nothing changed in Max6...
      A 4 track .wav file saved in Max 6 with sfrecord~ still can't be opened in other softwares. And the small file I uploaded in my previous post still can't be read by sfplay~.
      Even the error messages (-208) from the File Browser are still there when trying to preview 4 tracks wave file made in Max.
      Test with Max6.0.3 under OSX.6.8.