sndinfo will attempt to find each named file, open it for reading, read in the soundfile header, then print a report on the basic information it finds. The order of search across soundfile directories is as described above. If the file is of type AIFF, some further details are listed first.
There are two option types:
-i or -i1 will print instrument information, which includes looping. The option continues until a -i0 option.
The other option is -b which prints the broadcast information for WAV files. It can similarly be negated with -b0.
csound -U sndinfo test Bosendorfer/"BOSEN mf A0 st" foo foo2
where the environment variables SFDIR = /u/bv/sound, and SSDIR = /so/bv/Samples, might produce the following:
util SNDINFO: /u/bv/sound/test: srate 22050, monaural, 16 bit shorts, 1.10 seconds headersiz 1024, datasiz 48500 (24250 sample frames) /so/bv/Samples/Bosendorfer/BOSEN mf A0 st: AIFF, 197586 stereo samples, base Frq 261.6 (MIDI 60), sustnLp: mode 1, 121642 to 197454, relesLp: mode 0 AIFF soundfile, looping with modes 1, 0 srate 44100, stereo, 16 bit shorts, 4.48 seconds headersiz 402, datasiz 790344 (197586 sample frames) /u/bv/sound/foo: no recognizable soundfile header /u/bv/sound/foo2: couldn't find
Here is an example of the sndinfo utility. It uses the file sndinfo.csd.
Example 1347. Example of the sndinfo utility.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform -odac ; For Non-realtime ouput leave only the line below: ; -o sndinfo.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> sr = 48000 ; sample rate of beats.wav = 44100 ksmps = 32 ; and will be resampled to 48000 nchnls = 2 0dbfs = 1 ; by Menno Knevel 2021 ; resample in the highest qualty, name the new sample 'beats48.wav' gires system_i 1,{{ src_conv -r48000 -Q5 beats.wav -o beats48.wav }} instr 1 ires system_i 1,{{ sndinfo -i beats48.wav }} ; check sample rate aout diskin2 "beats48.wav", 1 outs aout, aout endin </CsInstruments> <CsScore> i1 0 2 e </CsScore> </CsoundSynthesizer>