sfrecord~/sfinfo~ problem w/multichannel wav files

Lance Ford Jones's icon

I put together this demo patch.
It creates a 6 channel wav file using sfrecord~ and attempts to get info using sfinfo~.
It works fine for aif files but not for wav.

Some clues:
The 6ch wav file plays fine in the quicktime player.
It opens cleanly in Adobe Audition.
If you resave it from Audition sfinfo~ can read it properly.

So there seems to be some incompatibility between the file written by sfrecord~ and reading it with sfinfo~.

Max Patch
Copy patch and select New From Clipboard in Max.

Or I could be doing something wrong. Any thoughts?

Lance Ford Jones's icon

Here's what I get: no channels, no bit depth, no sample rate, crazy numbers for the duration (timecode) - only the filename.

(Edit: the duration in ms is inf)

The normal sfinfo~ output (for the input file) is given for reference.

5321.sfinfotest.jpg
jpg
pdelges's icon

I didn't test wether it finally does work with the latest version of Max...

p

Helmuth's icon

Hi,

Max Patch
Copy patch and select New From Clipboard in Max.

the and the objects causes your problems: outputs control values, its outputs are not in the signal domain.Best

Lance Ford Jones's icon

Thank you both for your help.

Patrick: I read that thread (and several others that were related) before posting. That thread is two years old (some of the other threads are older). The last post is a year ago. I thought perhaps there was some newer information. Has Max really not been able to write the industry-standard wav file format for this long?

Helmuth: No, that's not the problem. The sig~ and snapshot~ are unnecessary (leftovers from stitching together bits and pieces to create this demo patch) they cancel each other out. If you remove them both same results. As I mention in my second post the actual duration reported by sfinfo~ in ms is "inf". This wouldn't account for all of the other missing information anyway.

Here's what I've found:
1) In step 3, when I open the output file with the savedialog object the savedialog requires an uppercase WAVE to force it to output a wav filename. It reports the filename with path out outlet 1 and the filetype out outlet 2. The reported filetype is again uppercase WAVE. I pack the two together and prepend "open" to get: 'open "path/filename" WAVE' and feed that into the sfrecord~ object --- but --- sfrecord requires the filetype argument to be lowercase "wave". My patch was writing AIFF files with a .wav extension. If sfrecord~ doesn't understand the filetype argument it goes to its default filetype. I discovered this by examining the file header.
2) The solution to get it to write wav files was to case convert "WAVE" to "wave".
3) Now it writes wav files that sfinfo~ can understand.
4) Unfortunately ---> they are wav files that nothing else will read.

(Edit: one last note, 1 or 2 channels good, 3 or more channels bad.)

If I think back over all of the things cycling74 has done over the last several years (Max 5 and 6, Max4Live, gen, 64 bit...) it's astounding that something this fundamental (being able to write industry standard audio files) has gone unfixed.

Max Patch
Copy patch and select New From Clipboard in Max.

Am I missing something?

Helmuth's icon

Hi,
everything works fine here with aiff, no problem with filenames etc. I tested up to 6 channels. maybe a problem with wave format?
Best

Helmuth's icon

I changed WAVE in wav (lowercase) , tested up to 6 channels, everything works fine here (MAX 6.08) Mac 10.5.8)

Max Patch
Copy patch and select New From Clipboard in Max.

Best

Lance Ford Jones's icon

Helmuth, thank you, however,

1) as I said in my initial post aif files are correctly formed, wav files are not.

Max Patch
Copy patch and select New From Clipboard in Max.

2) Changing to "wav" does not work. Look at what is coming out of the second outlet. only "AIFF" and "WAVE" work correctly. Other inputs return nothing out the second outlet and therefore sfrecord~ defaults to writing AIFF files (no matter what the file extension is or whether there is an extension at all). My guess is that you are creating AIFF files and that is why they seem to work. They're not WAVE files.

Helmuth's icon

Hi,
here the info of my created wav files. I do not think that they are "disguised" aiff files, but may be I am wrong...
Effectively if you may state this fact, (as you are mentioning also in your second thread), it would be interesting to contact directly cycling support.
Best

5342.Image1.png
png
Lance Ford Jones's icon

Hi Helmuth,

Thanks again, you can use a hex editor (there are plenty of them out there - i like "Hex Fiend" it's open source and free)

but the easiest way to check this is to open your audio file with a text editor (like TextEdit) and look at the first line.

let me know what you find.

5347.WAVE.jpg
jpg
Helmuth's icon

Hi,
when I tryed to play again the presumed wave file of last testing, I got a surprise: error message in max window:
error opening test_04.wav, err -1
sfplay~: can't open wave file test_04.wav.

I opened the file following your advise with a text editor => I got like you the same result : FORMAT AIFFCOMM

Helmuth's icon

So I tryed to record various different sound files to investigate again, nothing worked. Finally I found out why I assumed in my prior tests that records properly wav files: As I was using in my prior testing only one and the same soundfile, the file I was listening to was not the recent created wav file one, but the most recent played aif file hold in memory by a sfplay I used to test the files !! Mind the gap ;>) !!

Actually, no wav file was created!
(Strangely, when I used , and not WAVE, as fileformat, I got a correct file length, but the file created was a textfile)
When I used WAVE, the file lenght output of info~ sent out a , what creats the strange numbers out of the < sprintf> part in your patch.

So, probably you are right. it would be interesting to have a feedback from cycling support. You should contact them.

Best

little ps: in my sense the is redundant in your patch.