Converts the sample rate of an audio file at sample rate Rin to a sample rate of Rout. Optionally the ratio (Rin / Rout) may be linearly time-varying according to a set of (time, ratio) pairs in an auxiliary file.
Flags:
-P num = pitch transposition ratio (srate / r) [don't specify both P and r]
-Q num =quality factor (1, 2, 3, 4 or 5: default = 3)
-i filnam = auxiliary breakpoints file (no breakpoint by default. i.e. No ratio change)
-r num = output sample rate (must be specified if no P)
-o fnam = sound output filename (default: test.wav)
-A = create an AIFF format output soundfile
-J = create an IRCAM format output soundfile
-W = create a WAV format output soundfile (default after Csound version 6.15)
-h = no header on output soundfile
-c = 8-bit signed_char sound samples
-a = alaw sound samples
-8 = 8-bit unsigned_char sound samples
-u = ulaw sound samples
-s = short_int (16 bit) sound samples (default)
-3 = 24-bit sound samples
-l = long_int sound samples
-f = float sound samples
-r N = orchestra srate override
-K = Do not generate PEAK chunks
-R = continually rewrite header while writing soundfile (WAV/AIFF)
-H# = print a heartbeat style 1, 2 or 3 at each soundfile write
-N = notify (ring the bell) when done
This program performs arbitrary sample-rate conversion with high fidelity using the libsamplerate library.
The five levels of accuracy are:
Here is an example of src_conv. Play src_conv.csd
Example 1359. Example of src_conv.
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 src_conv.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>