user: What is Basic Sound Playback and how is it used in Blender Python scripting?

assistant: (#aud.aud.SequenceEntry.cone_volume_outer "aud.aud.SequenceEntry.cone_volume_outer") and in the area between the volume will be interpolated linearly.

    cone_angle_outer
    :   The opening angle of the outer cone of the source.

    cone_volume_outer
    :   The volume outside the outer cone of the source.

    distance_maximum
    :   The maximum distance of the source.
        If the listener is further away the source volume will be 0.

    distance_reference
    :   The reference distance of the source.
        At this distance the volume will be exactly `volume`.

    muted
    :   Whether the entry is muted.

    relative
    :   Whether the source’s location, velocity and orientation is relative or absolute to the listener.

    sound
    :   The sound the entry is representing and will be played in the sequence.

    volume_maximum
    :   The maximum volume of the source.

    volume_minimum
    :   The minimum volume of the source.

*class* aud.Sound
:   Sound objects are immutable and represent a sound that can be played simultaneously multiple times. They are called factories because they create reader objects internally that are used for playback.

    *classmethod* buffer(*data*, *rate*)
    :   Creates a sound from a data buffer.

        Parameters:
        :   - **data** (`numpy.ndarray`) – The data as two dimensional numpy array.
            - **rate** (*double*) – The sample rate.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* file(*filename*)
    :   Creates a sound object of a sound file.

        Parameters:
        :   **filename** (*string*) – Path of the file.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* list()
    :   Creates an empty sound list that can contain several sounds.

        Parameters:
        :   **random** (*int*) – whether the playback will be random or not.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* sawtooth(*frequency*, *rate=48000*)
    :   Creates a sawtooth sound which plays a sawtooth wave.

        Parameters:
        :   - **frequency** (*float*) – The frequency of the sawtooth wave in Hz.
            - **rate** (*int*) – The sampling rate in Hz. It’s recommended to set this
              value to the playback device’s sampling rate to avoid resampling.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* silence(*rate=48000*)
    :   Creates a silence sound which plays simple silence.

        Parameters:
        :   **rate** (*int*) – The sampling rate in Hz. It’s recommended to set this
            value to the playback device’s sampling rate to avoid resampling.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* sine(*frequency*, *rate=48000*)
    :   Creates a sine sound which plays a sine wave.

        Parameters:
        :   - **frequency** (*float*) – The frequency of the sine wave in Hz.
            - **rate** (*int*) – The sampling rate in Hz. It’s recommended to set this
              value to the playback device’s sampling rate to avoid resampling.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* square(*frequency*, *rate=48000*)
    :   Creates a square sound which plays a square wave.

        Parameters:
        :   - **frequency** (*float*) – The frequency of the square wave in Hz.
            - **rate** (*int*) – The sampling rate in Hz. It’s recommended to set this
              value to the playback device’s sampling rate to avoid resampling.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    *classmethod* triangle(*frequency*, *rate=48000*)
    :   Creates a triangle sound which plays a triangle wave.

        Parameters:
        :   - **frequency** (*float*) – The frequency of the triangle wave in Hz.
            - **rate** (*int*) – The sampling rate in Hz. It’s recommended to set this
              value to the playback device’s sampling rate to avoid resampling.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    ADSR(*attack*, *decay*, *sustain*, *release*)
    :   Attack-Decay-Sustain-Release envelopes the volume of a sound.
        Note: there is currently no way to trigger the release with this API.

        Parameters:
        :   - **attack** (*float*) – The attack time in seconds.
            - **decay** (*float*) – The decay time in seconds.
            - **sustain** (*float*) – The sustain level.
            - **release** (*float*) – The release level.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    accumulate(*additive=False*)
    :   Accumulates a sound by summing over positive input
        differences thus generating a monotonic sigal.
        If additivity is set to true negative input differences get added too,
        but positive ones with a factor of two.

        Note that with additivity the signal is not monotonic anymore.

        Parameters:
        :   **additive** – Whether the accumulation should be additive or not.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    addSound(*sound*)
    :   Adds a new sound to a sound list.

        Parameters:
        :   **sound** (`Sound`) – The sound that will be added to the list.

    animateableTimeStretchPitchScale(*fps*[, *time_stretch*, *pitch_scale*, *quality*, *preserve_formant*])
    :   Applies time-stretching and pitch-scaling to the sound.

        Parameters:
        :   - **fps** (*float*) – The FPS of the animation system.
            - **time_stretch** (float or `AnimateablePropertyP`) – The factor by which to stretch or compress time.
            - **pitch_scale** (float or `AnimateablePropertyP`
              :arg quality: Rubberband stretcher quality (STRETCHER_QUALITY_\*).) – The factor by which to adjust the pitch.
            - **preserve_formant** (*bool*) – Whether to preserve the vocal formants during pitch-shifting.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    binaural()
    :   Creates a binaural sound using another sound as source. The original sound must be mono

        Parameters:
        :   - **hrtfs** – An HRTF set.
            - **source** (`Source`) – An object representing the source position of the sound.
            - **threadPool** (`ThreadPool`) – A thread pool used to parallelize convolution.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    cache()
    :   Caches a sound into RAM.

        This saves CPU usage needed for decoding and file access if the
        underlying sound reads from a file on the harddisk,
        but it consumes a lot of memory.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    convolver()
    :   Creates a sound that will apply convolution to another sound.

        Parameters:
        :   - **impulseResponse** (`ImpulseResponse`) – The filter with which convolve the sound.
            - **threadPool** (`ThreadPool`) – A thread pool used to parallelize convolution.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    data()
    :   Retrieves the data of the sound as numpy array.

        Returns:
        :   A two dimensional numpy float array.

        Return type:
        :   `numpy.ndarray`

    delay(*time*)
    :   Delays by playing adding silence in front of the other sound’s data.

        Parameters:
        :   **time** (*float*) – How many seconds of silence should be added before the sound.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    envelope(*attack*, *release*, *threshold*, *arthreshold*)
    :   Delays by playing adding silence in front of the other sound’s data.

        Parameters:
        :   - **attack** (*float*) – The attack factor.
            - **release** (*float*) – The release factor.
            - **threshold** (*float*) – The general threshold value.
            - **arthreshold** (*float*) – The attack/release threshold value.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    fadein(*start*, *length*)
    :   Fades a sound in by raising the volume linearly in the given
        time interval.

        Parameters:
        :   - **start** (*float*) – Time in seconds when the fading should start.
            - **length** (*float*) – Time in seconds how long the fading should last.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    fadeout(*start*, *length*)
    :   Fades a sound in by lowering the volume linearly in the given
        time interval.

        Parameters:
        :   - **start** (*float*) – Time in seconds when the fading should start.
            - **length** (*float*) – Time in seconds how long the fading should last.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    filter(*b*, *a=(1,)*)
    :   Filters a sound with the supplied IIR filter coefficients.
        Without the second parameter you’ll get a FIR filter.

        If the first value of the a sequence is 0,
        it will be set to 1 automatically.
        If the first value of the a sequence is neither 0 nor 1, all
        filter coefficients will be scaled by this value so that it is 1
        in the end, you don’t have to scale yourself.

        Parameters:
        :   - **b** (*sequence* *of* *float*) – The nominator filter coefficients.
            - **a** (*sequence* *of* *float*) – The denominator filter coefficients.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    highpass(*frequency*, *Q=0.5*)
    :   Creates a second order highpass filter based on the transfer
        function \(H(s) = s^2 / (s^2 + s/Q + 1)\)

        Parameters:
        :   - **frequency** (*float*) – The cut off trequency of the highpass.
            - **Q** (*float*) – Q factor of the lowpass.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    join(*sound*)
    :   Plays two factories in sequence.

        Parameters:
        :   **sound** (`Sound`) – The sound to play second.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    limit(*start*, *end*)
    :   Limits a sound within a specific start and end time.

        Parameters:
        :   - **start** (*float*) – Start time in seconds.
            - **end** (*float*) – End time in seconds.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    loop(*count*)
    :   Loops a sound.

        Parameters:
        :   **count** (*integer*) – How often the sound should be looped.
            Negative values mean endlessly.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    lowpass(*frequency*, *Q=0.5*)
    :   Creates a second order lowpass filter based on the transfer function \(H(s) = 1 / (s^2 + s/Q + 1)\)

        Parameters:
        :   - **frequency** (*float*) – The cut off trequency of the lowpass.
            - **Q** (*float*) – Q factor of the lowpass.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    mix(*sound*)
    :   Mixes two factories.

        Parameters:
        :   **sound** (`Sound`) – The sound to mix over the other.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    modulate(*sound*)
    :   Modulates two factories.

        Parameters:
        :   **sound** (`Sound`) – The sound to modulate over the other.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    mutable()
    :   Creates a sound that will be restarted when sought backwards.
        If the original sound is a sound list, the playing sound can change.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    pingpong()
    :   Plays a sound forward and then backward.
        This is like joining a sound with its reverse.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    pitch(*factor*)
    :   Changes the pitch of a sound with a specific factor.

        Parameters:
        :   **factor** (*float*) – The factor to change the pitch with.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    rechannel(*channels*)
    :   Rechannels the sound.

        Parameters:
        :   **channels** (*int*) – The new channel configuration.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    resample(*rate*, *quality*)
    :   Resamples the sound.

        Parameters:
        :   - **rate** (*double*) – The new sample rate.
            - **quality** (*int*) – Resampler performance vs quality choice (0=fastest, 3=slowest).

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    reverse()
    :   Plays a sound reversed.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    sum()
    :   Sums the samples of a sound.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    threshold(*threshold=0*)
    :   Makes a threshold wave out of an audio wave by setting all samples
        with a amplitude >= threshold to 1, all <= -threshold to -1 and
        all between to 0.

        Parameters:
        :   **threshold** (*float*) – Threshold value over which an amplitude counts
            non-zero.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    timeStretchPitchScale(*time_stretch*, *pitch_scale*, *quality*, *preserve_formant*)
    :   Applies time-stretching and pitch-scaling to the sound.

        Parameters:
        :   - **time_stretch** (*float*) – The factor by which to stretch or compress time.
            - **pitch_scale** (*float*) – The factor by which to adjust the pitch.
            - **quality** (*int*) – Rubberband stretcher quality (STRETCHER_QUALITY_\*).
            - **preserve_formant** (*bool*) – Whether to preserve the vocal formants during pitch-shifting.

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    volume(*volume*)
    :   Changes the volume of a sound.

        Parameters:
        :   **volume** (*float*) – The new volume..

        Returns:
        :   The created `Sound` object.

        Return type:
        :   `Sound`

    write(*filename*, *rate*, *channels*, *format*, *container*, *codec*, *bitrate*, *buffersize*)
    :   Writes the sound to a file.

        Parameters:
        :   - **filename** (*string*) – The path to write to.
            - **rate** (*int*) – The sample rate to write with.
            - **channels** (*int*) – The number of channels to write with.
            - **format** (*int*) – The sample format to write with.
            - **container** (*int*) – The container format for the file.
            - **codec** (*int*) – The codec to use in the file.
            - **bitrate** (*int*) – The bitrate to write with.
            - **buffersize** (*int*) – The size of the writing buffer.

    length
    :   The sample specification of the sound as a tuple with rate and channel count.

    specs
    :   The sample specification of the sound as a tuple with rate and channel count.

*class* aud.Source
:   The source object represents the source position of a binaural sound.

    azimuth
    :   The azimuth angle.

    distance
    :   The distance value. 0 is min, 1 is max.

    elevation
    :   The elevation angle.

*class* aud.ThreadPool
:   A ThreadPool is used to parallelize convolution efficiently.

*class* aud.error