rsc3/doc-schelp/HelpSource/Classes/BufSampleRate.schelp

45 lines
861 B
Text
Raw Normal View History

2022-08-24 13:53:18 +00:00
class:: BufSampleRate
summary:: Buffer sample rate.
related:: Classes/BufChannels, Classes/BufDur, Classes/BufFrames, Classes/BufRateScale, Classes/BufSamples
categories:: UGens>Buffer>Info
Description::
Returns the buffer's current sample rate.
classmethods::
method::kr, ir
argument::bufnum
Buffer index.
returns::
the buffer's current sample rate.
discussion::
warning::
The code::.ir:: method is not the safest choice.
Since a buffer can be reallocated at any time, using
code::.ir:: will not track the changes.
::
Examples::
code::
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
// compares a 1102.5 Hz sine tone (11025 * 0.1, left) with a 1100 Hz tone (right)
// the apollo sample has a sample rate of 11.025 kHz
(
{
var freq;
freq = [ BufSampleRate.kr(b) * 0.1, 1100];
SinOsc.ar(freq, 0, 0.1)
}.play;
)
b.free;
::