Liking cljdoc? Tell your friends :D

dynne.sampled-sound

Functions for manipulating a sound whose amplitude representation is arrays of doubles.

Functions for manipulating a sound whose amplitude representation
is arrays of doubles.
raw docstring

->stereoclj

(->stereo s)
(->stereo l r)

Creates a stereo sound. If given one single-channel sound, duplicates channel zero on two channels. If given a single stereo sound, returns it. If given two single-channel sounds, returns a sound with the first sound on channel 0 and the second sound on channel 1.

Creates a stereo sound. If given one single-channel sound,
duplicates channel zero on two channels. If given a single stereo
sound, returns it. If given two single-channel sounds, returns a
sound with the first sound on channel 0 and the second sound on
channel 1.
raw docstring

appendclj

(append s1 s2)

Concatenates two sounds together

Concatenates two sounds together
raw docstring

constantclj

(constant duration chans x)

Returns a sound of duration that has chans channels, each of which is constant at x.

Returns a sound of `duration` that has `chans` channels, each of
which is constant at `x`.
raw docstring

defsoundclj/smacro

(defsound name
          duration-param
          channels-param
          docstring
          args
          [sample-rate num-samples index c]
          expr)

Expands to define a function name that accepts arguments args returns a sound with duration, channels whose samples are determined by expr. Inside expr, the sample rate, the total number of samples, the current sample index, and the current channel number will be bound to the four symbols in bindings.

Expands to define a function `name` that accepts arguments `args`
returns a sound with `duration`, `channels` whose samples are
determined by `expr`. Inside expr, the sample rate, the total number
of samples, the current sample index, and the current channel number
will be bound to the four symbols in `bindings`.
raw docstring

envelopeclj

(envelope s1 s2)

Multiplies the amplitudes of s1 and s2, trimming the sound to the shorter of the two.

Multiplies the amplitudes of `s1` and `s2`, trimming the sound to
the shorter of the two.
raw docstring

fade-inclj

(fade-in s fade-duration)

Fades s linearly from zero at the beginning to full volume at duration.

Fades `s` linearly from zero at the beginning to full volume at
`duration`.
raw docstring

fade-outclj

(fade-out s fade-duration)

Fades the s to zero for the last duration.

Fades the s to zero for the last `duration`.
raw docstring

fn-soundclj

(fn-sound duration chans f)

Creates a SampledSound duration seconds long where the amplitudes are produced by f, a function of a channel number and a time in seconds.

Creates a SampledSound `duration` seconds long where the amplitudes
are produced by `f`, a function of a channel number and a time in
seconds.
raw docstring

gainclj

(gain s g)

Changes the amplitude of s by g.

Changes the amplitude of `s` by `g`.
raw docstring

linearclj

(linear duration chans start end)

Returns a sound of duration that has chans channels, each of which changes linearly from start to end.

Returns a sound of `duration` that has `chans` channels, each of
which changes linearly from `start` to `end`.
raw docstring

mixclj

(mix s1 s2)

Mixes sounds s1 and s2 together.

Mixes sounds `s1` and `s2` together.
raw docstring

multiplexclj

(multiplex s n)

Takes a single-channel sound s and returns an n-channel sound whose channels are all identical to channel 0 of s.

Takes a single-channel sound `s` and returns an `n`-channel sound
whose channels are all identical to channel 0 of `s`.
raw docstring

panclj

(pan s amount)

Takes a two-channel sound and mixes the channels together by amount, a float on the range [0.0, 1.0]. The ususal use is to take a sound with separate left and right channels and combine them so each appears closer to stereo center. An amount of 0.0 would leave both channels unchanged, 0.5 would result in both channels being the same (i.e. appearing to be mixed to stereo center), and 1.0 would switch the channels.

Takes a two-channel sound and mixes the channels together by
`amount`, a float on the range [0.0, 1.0]. The ususal use is to take
a sound with separate left and right channels and combine them so
each appears closer to stereo center. An `amount` of 0.0 would leave
both channels unchanged, 0.5 would result in both channels being the
same (i.e. appearing to be mixed to stereo center), and 1.0 would
switch the channels.
raw docstring

peakclj

(peak s sample-rate)
(peak s sample-rate limit)

Returns the maximum absolute amplitude of s when sampled at sample-rate. If provided, will return immediately on finding a value above limit.

Returns the maximum absolute amplitude of `s` when sampled at
`sample-rate`. If provided, will return immediately on finding a
value above `limit`.
raw docstring

playclj

(play s sample-rate)

Plays s asynchronously. Returns a value that can be passed to stop.

Plays `s` asynchronously. Returns a value that can be passed to `stop`.
raw docstring

read-soundclj

(read-sound path)

Given a path to a .wav or .mp3 file, return a SampledSound instance over it.

Given a path to a .wav or .mp3 file, return a SampledSound instance
over it.
raw docstring

SampledSoundcljprotocol

Represents a sound as a sequence of vectors of Java double arrays.

Represents a sound as a sequence of vectors of Java double arrays.

channelsclj

(channels this)

Returns the number of channels in the sound.

Returns the number of channels in the sound.

chunksclj

(chunks this sample-rate)

Returns a sequence of sequences each containing a sequence of double arrays - one per channel - populated with the data for this sound. The total number of samples per channel will be (* duration sample-rate)

Returns a sequence of sequences each
containing a sequence of double arrays - one per channel - populated
with the data for this sound. The total number of samples per
channel will be (* duration sample-rate)

durationclj

(duration this)

Returns the duration of the sound in seconds.

Returns the duration of the sound in seconds.
raw docstring

saveclj

(save s path sample-rate)

Save sound s to path as a 16-bit WAV at sample-rate.

Save sound `s` to `path` as a 16-bit WAV at `sample-rate`.
raw docstring

save-to-streamclj

(save-to-stream s output-stream sample-rate)

Save sound s to output-stream as a 16-bit WAV at sample-rate.

Save sound `s` to `output-stream` as a 16-bit WAV at `sample-rate`.
raw docstring

segmented-linearclj

(segmented-linear chans & spec)

Produces a sound with chans channels whose amplitudes change linearly as described by spec. Spec is a sequence of interleaved amplitudes and durations. For example the spec

1.0 30 0 10 0 0.5 1.0

(written that way on purpose - durations and amplitudes are in columns) would produce a sound whose amplitude starts at 1.0, linearly changes to 0.0 at time 30, stays at 0 for 10 seconds, then ramps up to its final value of 1.0 over 0.5 seconds

Produces a sound with `chans` channels whose amplitudes change
linearly as described by `spec`. Spec is a sequence of interleaved
amplitudes and durations. For example the spec

1.0 30
0   10
0   0.5
1.0

(written that way on purpose - durations and amplitudes are in columns)
would produce a sound whose amplitude starts at 1.0, linearly
changes to 0.0 at time 30, stays at 0 for 10 seconds, then ramps up
to its final value of 1.0 over 0.5 seconds
raw docstring

shortifyclj/smacro

(shortify f)

Takes a floating-point number f in the range [-1.0, 1.0] and scales it to the range of a 16-bit integer. Clamps any overflows.

Takes a floating-point number f in the range [-1.0, 1.0] and scales
it to the range of a 16-bit integer. Clamps any overflows.
raw docstring

silenceclj

(silence dur chans)

Returns a sound of duration with chans channels of silence.

Returns a sound of `duration` with `chans` channels of silence.
raw docstring

sinusoidclj

(sinusoid duration frequency)

Returns a single-channel sound of duration and frequency

Returns a single-channel sound of `duration` and `frequency`
raw docstring

square-waveclj

(square-wave duration frequency)

Produces a single-channel sound that toggles between 1.0 and -1.0 at frequency freq.

Produces a single-channel sound that toggles between 1.0 and -1.0
at frequency `freq`.
raw docstring

stopclj

(stop player)

Stops playing the sound represented by player (returned from play).

Stops playing the sound represented by `player` (returned from `play`).
raw docstring

timeshiftclj

(timeshift s dur)

Inserts dur seconds of silence at the beginning of s

Inserts `dur` seconds of silence at the beginning of `s`
raw docstring

trimclj

(trim s start end)

Truncates s to the region between start and end. If end is beyond the end of the sound, just trim to the end.

Truncates `s` to the region between `start` and `end`. If `end` is
beyond the end of the sound, just trim to the end.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close