|
From: Jan S. <ha...@st...> - 2015-12-11 20:05:12
|
On Dec 11 17:57:21, pf...@fa... wrote: > I have a high sample rate (250 khz) USB microphone. May I ask what kind of microphone this is exactly, and what ultrasounds you plan to record with it? > I've tried to record from it using matlab, audacity and the command tool > arecord. However, to no avail. All these tools return the same error: > the sample rate is wrong. I'm afraid this has nothing to do with SoX. Ask on _their_ mailing lists. But I wouldn't be surprised if a recording tool refused to record at 250 kHz. It is also possible that it's SoX doing the resampling for you - on my old MacBook (which surely cannot record at 250000 Hz), I get $ rec -r 250000 file.wav fCoreAudioDriverUID AppleHDAEngineInput:1 rec WARN formats: can't set sample rate 250000; using 44100 Input File : 'default' (coreaudio) Channels : 2 Sample Rate : 44100 Precision : 32-bit Sample Encoding: 32-bit Signed Integer PCM In:0.00% 00:00:01.70 [00:00:00.00] Out:413kk [ | ] Clip:0 ^C Aborted. $ soxi file.wav Input File : 'file.wav' Channels : 2 Sample Rate : 250000 Precision : 32-bit Duration : 00:00:01.65 = 412896 samples ~ 123.869 CDDA sectors File Size : 3.30M Bit Rate : 16.0M Sample Encoding: 32-bit Signed Integer PCM > However, using sox, I can record without problems. Generating a > spectrogram from sound with a known frequency confirms that the sample > rate is indeed 250khz - also the files contain (give or take some > samples) the correct number of samples. You don't a spectrogram for that, plain old soxi(1) will tell you. Also, the sample rate has nothing to do with the "known frequency" of the sound you are recording. > So, my question is, why can i record using sox > but not any of the other tools. Ask _them_. > In case it helps, I have attached the sox output below. You also need to attach the command line you used. > ---------------- > rec: SoX v14.4.1 > > Input File : 'hw:2,0' (alsa) > Channels : 1 > Sample Rate : 250000 Hm, this looks like the device _is_ actually set to 250000. In the example above, the devie is actually set to 44100, and it's SoX resampling for me (to 250000). Jan > Precision : 16-bit > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > > rec INFO sox: Overwriting `test.wav' > > Output File : 'test.wav' > Channels : 1 > Sample Rate : 250000 > Precision : 16-bit > Sample Encoding: 16-bit Signed Integer PCM > Endian Type : little > Reverse Nibbles: no > Reverse Bits : no > Comment : 'Processed by SoX' > > rec INFO channels: has no effect in this configuration > rec INFO sox: effects chain: input 250000Hz 1 channels > rec INFO sox: effects chain: highpass 250000Hz 1 channels > rec INFO sox: effects chain: vol 250000Hz 1 channels > rec INFO sox: effects chain: spectrogram 250000Hz 1 channels > rec INFO sox: effects chain: dither 250000Hz 1 channels > rec INFO sox: effects chain: output 250000Hz 1 channels > In:0.00% 00:00:04.33 [00:00:00.00] Out:1.07M [ | ] > Clip:0 ^C > Aborted. |