From: Jeremy N. - ml s. u. <jn....@wi...> - 2019-10-30 19:19:03
|
On 2019-10-30 14:42, Nils Wallgren wrote: > I downloaded it from sourceforge. Originally choose the sox > 14.4.2-win32.exe which is an installer. > I tried the the sox-14-4-2-win32.zip but this I hade to drag to my > program files (x86) myself. I also had to a path so that my command > prompt recognises the sox. So... you added to PATH the folder in which you placed sox.exe and (later) play.exe, rec.exe and soxi.exe ? > When I evalutate sox I get: > SoX v14.4.2 > Sox FAIL sox: Not enough input filenames specified > Usage summary: [gopts] ... > And bunch of other things that looks lika a manual That's the expected reply if you have no parameters (or maybe the wrong ones). > I tried sox -t waveaudio -d "C:\Users\xx\Documents\bla.wav" > And at least it created a file. And did the file contain any audio - if eg you double-click it did it play? I'd expect a wav file just to play on Windows, - you don't need sox for that. Here, the default player for wav files is Windows Media Player. > I also tried(after I created a copy of the sox.exe and named it > rec.exe, another copy play.exe and another soxi.exe): > > rec new-file.wav ( an example taken from page 3 from the manual) > > But this doesn’t create any file. The manual says that: rec new-file.wav is equivalent to: sox −d new-file.wav ie to copy audio from -d which is the default device, to the named file. Are you sure it didn't create a file, but maybe put it somewhere that you haven't looked? Why didn't you use eg rec "C:\Users\xx\Documents\another.wav" Also, you'll note that that command doesn't have: -t waveaudio which the working one did have. Why did you miss it out? I've never used sox to record audio from the same PC (I use it to manipulate files made on a solid-state audio recorder), but reading the soxformat manual suggests that this is maybe used to tell sox which device to use. It looks as if you might need to use -t waveaudio "the device name" or -t waveaudio n where n is a device number. (But later, trying to specify an output device this way, I couldn't get anything to work, with either n values 0,1,2,3,4... or names like "Speakers" or "USB Audio CODEC" which are what Windows sound configuration shows me. (I've got W8.1.) Then again, you say that the earlier command did create a bla.wav file. But was there anything in it? You can get useful info from an audio file's headers (if it has any headers) by eg: soxi "C:\this\that\sounds.wav" and also two of the "effects" that sox can run will provide info about the audio itself inside the file. For exaample: C:\>soxi "C:\Dropbox\JN_Recordings\20150615 SCC - Flickering Light\Raw files\3 SV3900 - Concert.wav" Input File : 'C:\Dropbox\JN_Recordings\20150615 SCC - Flickering Light\Raw files\3 SV3900 - Concert.wav' Channels : 2 Sample Rate : 44100 Precision : 16-bit Duration : 00:42:10.84 = 111609856 samples = 189813 CDDA sectors File Size : 446M Bit Rate : 1.41M Sample Encoding: 16-bit Signed Integer PCM C:\> The useful info effects are named "stat" and "stats". For them I get: C:\>sox "C:\Dropbox\JN_Recordings\20150615 SCC - Flickering Light\Raw files\3 SV3900 - Concert.wav" -n stat Samples read: 223219712 Length (seconds): 2530.835737 Scaled by: 2147483647.0 Maximum amplitude: 0.418976 Minimum amplitude: -0.426361 Midline amplitude: -0.003693 Mean norm: 0.008174 Mean amplitude: 0.000096 RMS amplitude: 0.015213 Maximum delta: 0.362122 Minimum delta: 0.000000 Mean delta: 0.007552 RMS delta: 0.013745 Rough frequency: 6341 Volume adjustment: 2.345 C:\>sox "C:\Dropbox\JN_Recordings\20150615 SCC - Flickering Light\Raw files\3 SV3900 - Concert.wav" -n stats Overall Left Right DC offset 0.000162 0.000162 0.000030 Min level -0.426361 -0.426361 -0.355652 Max level 0.418976 0.418976 0.331818 Pk lev dB -7.40 -7.40 -8.98 RMS lev dB -36.36 -35.29 -37.78 RMS Pk dB -16.18 -16.18 -16.96 RMS Tr dB -85.48 -77.99 -85.48 Crest factor - 24.78 27.54 Flat factor 0.00 0.00 0.00 Pk count 2 2 2 Bit-depth 15/16 15/16 15/16 Num samples 112M Length s 2530.836 Scale max 1.000000 Window s 0.050 C:\> Note that here sox reads audio from the named file, and copies it to "-n" which is a null device (ie it is copied to nowhere). However as the data is seen it is processed by the effect. You can do that command as: sox "inputfile.wav" -n stat stats torun both "effects" one after the other if you prefer. > Also tried this : play -n -c1 synth sin %-12 sin %-9 sin %-5 sin %-2 > fade h 0.1 1 0.1 from from the manual but no luck No luck... meaning what? An error message? Silence? Presumably it plays to the default output device? But on Windows there will be some sort of audio mixer that allows you to choose which sounds from which programs are actually audible. Just because an error sound, or a beep works doesn't mean that sound from every other program will automatically be audible. Hmm. If I try that I get: FAIL sox: Sorry, there is no default audio device configured and - depite trying this & that, and googling I've not been able to make it work. A few posts suggest that it might work on the earlier version of sox, v14-4-1. I've not tried. Running all sorts of commands, with -V4 (verbose output) I just see things like: sox.exe DBUG sox: Looking for a default device: trying format `waveaudio' sox.exe DBUG waveaudio: waveOutOpen(QUERY: Dev -1 0Hz 0Ch 8Prec 8Wide) returned 32 sox.exe FAIL sox: Sorry, there is no default audio device configured I'm just a user; I have no idea how to fix this. Other programs on my machine happily produce sound. Generating a synthesised tone and putting in a file (and later playing that by double-clicking the .wav file) does work. I'm not a fan of the 'play' & 'rec' command forms though and prefer to build up a standard sox command so that all the parameters used are those I specified. Because of the way a command has global options then for each file that's named file-options followed by the file name/id, then effect names and options my view is that one needs to know which is which. So for example in play -n -c1 synth sin %-12 sin %-9 sin %-5 sin %-2 fade h 0.1 1 0.1 the -n is the input file, which means there's no 'global options' or first file options... because if there had been they'd have had to come before "-n". Then we have "-c1" (which means "one channel") and refers (because it is a file format option) to the following file. But there's no file explicitly named after that "-c1". But it's there because "play" implies an output file. Then "synth .... fade..." are effects and their parameters. I prefer to use eg sox -n -c1 "%temp%\mono1.wav" synth sin %-12 sin %-9 sin %-5 sin %-2 fade h 0.1 1 0.1 or (for much more info as it runs) sox -V4 -n -c1 "%temp%\mono2.wav" synth sin %-12 sin %-9 sin %-5 sin %-2 fade h 0.1 1 0.1 Both those generate a file in your Temporary files folder. [Normally I use scripts to generate sox commands, and I consider global options, each file's options etc separately in the script so that I can keep track of which part is which, then finally build the command out of each section. That way I can make sure that certain options, eg "--no-clobber", are specified every time. That one is useful as it prevents accidental overwriting of any output file, if one gets the overall command wrong... which is easy to do. -- Jeremy Nicoll - my opinions are my own |