Closed m-r-s closed 5 years ago
Dear Marc,
The sound files written by wavrec store the samples in floating point format and allow amplitudes exceeding [-1;1]. You can open these sound files in e.g. octave and scale as desired after the recording without losing information.
We do not plan to extend wavrec with a caliblevel control to avoid making this plugin more complicated to use.
Dear Tobias,
yes. However, Octave (in the current version avaiable in Ubuntu 18.10) seems to clip values to the [-1 1] range when writing them with "audiowrite".
"soxi" tells me that the written file is "Sample Encoding: 32-bit Floating Point PCM" Audacity doesn't handle values outside the [-1 1] well. Which tool would you propose to use for loading, filtering, and saving these special wav files?
Best, Marc
"sox" also does not allow values outside the range [-1 1]. I tried to save a file with octave with an increased reference level and then add the correct gain again with sox. Currently, I really don't know how to write wav-files with values exceeding [-1 1].
If anybody is looking for a solution to process wav files with Octave and store them then with the difficult reference of 1Pa:
audiowrite(['tmp' filename],signal.*10.^(-130./20),fs,'BitsPerSample',32); system(['ffmpeg -i ' ['tmp' filename] ' -af "volume=63.246" -acodec pcmf32le ' filename ]); unlink(['tmp' filename]);
The clipping behavior is actually a mismatch of behavior and documentation: MATLAB documents the bahevior of clipping, but does not implement clipping for floating point values. Octave implements the behaviour of MATLAB documentation (thus the useless clipping). Personally I would see this as a bug of Octave implementation and MATLAB documentation.
For me it is okay, I just wanted to add an argument in favor of a calibration variable which would help to keep things consistent (recording and playback reference level). It took me a few hours to figure things out.
Reading these files with octave works fine in my experience. Both audioread and wavread import |amplitudes| > 1 without clipping into the octave workspace. I was suggesting that you read these files with octave and scale them as you need inside octave before saving them again with |amplitudes| all < 1 if this is what you need.
I need to process the files with Octave (which works fine) but I want to save them back with the same scaling (to be able to play back processed and unprocessed files with addsnd).
wavrec implicitly uses a caliblevel of 93.979 dB SPL. A new variable to optionally change it would be desirable to allow keeping the values in the range between -1 and 1.