nussl/core/mixing.py
def pan_audio_signal(audio_signal, angle_in_degrees):
    """
    Pans an audio signal left or right by the desired number of degrees. This
    returns a copy of the input audio signal.

    Use negative numbers to pan left, positive to pan right. Angles outside of the
    range [-45, 45] raise an error.
    
    Args:
        audio_signal (AudioSignal): Audio signal to be panned.
        angle_in_degrees (float): Angle in degrees to pan by, between -45 and 45.
    
    Raises:
        ValueError: Angles outside of the range [-45, 45] raise an error.
    
    Returns:
        AudioSignal: Audio signal panned by `angle_in_degrees`.
    """
    if angle_in_degrees < -45 or angle_in_degrees > 45:
        raise ValueError(
            "Angle must be between -45 and 45! -45 means "
            "all the way to the left, 45 means all the way "
            "to the right, and 0 is center.")
    panned_signal = copy.deepcopy(audio_signal)
    panned_signal.to_mono()

    panned_signal.audio_data = np.concatenate([
        panned_signal.audio_data, panned_signal.audio_data
    ], axis=0)

    angle = np.deg2rad(angle_in_degrees)
    left_scale = (
        np.sqrt(2)/2 * (np.cos(angle) - np.sin(angle)))
    right_scale = (
        np.sqrt(2)/2 * (np.cos(angle) + np.sin(angle)))
    
    panned_signal.audio_data[0] *= left_scale
    panned_signal.audio_data[1] *= right_scale

    return panned_signal

    Pans an audio signal left or right by the desired number of degrees. This
    returns a copy of the input audio signal.

    Use negative numbers to pan left, positive to pan right. Angles outside of the
    range [-45, 45] raise an error.
    
    Args:
        audio_signal (AudioSignal): Audio signal to be panned.
        angle_in_degrees (float): Angle in degrees to pan by, between -45 and 45.
    
    Raises:
        ValueError: Angles outside of the range [-45, 45] raise an error.
    
    Returns:
        AudioSignal: Audio signal panned by `angle_in_degrees`.
    
Pans an audio signal left or right by the desired number of degrees. This
returns a copy of the input audio signal.

Use negative numbers to pan left, positive to pan right. Angles outside of the
range [-45, 45] raise an error.
Pans an audio signal left or right by the desired number of degrees . This returns a copy of the input audio signal . Use negative numbers to pan left positive to pan right . Angles outside of the range [ - 45 45 ] raise an error .
def pan_audio_signal(audio_signal, angle_in_degrees):
    if angle_in_degrees < -45 or angle_in_degrees > 45:
        raise ValueError(
            "Angle must be between -45 and 45! -45 means "
            "all the way to the left, 45 means all the way "
            "to the right, and 0 is center.")
    panned_signal = copy.deepcopy(audio_signal)
    panned_signal.to_mono()
    panned_signal.audio_data = np.concatenate([
        panned_signal.audio_data, panned_signal.audio_data
    ], axis=0)
    angle = np.deg2rad(angle_in_degrees)
    left_scale = (
        np.sqrt(2)/2 * (np.cos(angle) - np.sin(angle)))
    right_scale = (
        np.sqrt(2)/2 * (np.cos(angle) + np.sin(angle)))
    panned_signal.audio_data[0] *= left_scale
    panned_signal.audio_data[1] *= right_scale
    return panned_signal
def pan_audio_signal ( audio_signal , angle_in_degrees ) : if angle_in_degrees < - 45 or angle_in_degrees > 45 : raise ValueError ( "Angle must be between -45 and 45! -45 means " "all the way to the left, 45 means all the way " "to the right, and 0 is center." ) panned_signal = copy . deepcopy ( audio_signal ) panned_signal . to_mono ( ) panned_signal . audio_data = np . concatenate ( [ panned_signal . audio_data , panned_signal . audio_data ] , axis = 0 ) angle = np . deg2rad ( angle_in_degrees ) left_scale = ( np . sqrt ( 2 ) / 2 * ( np . cos ( angle ) - np . sin ( angle ) ) ) right_scale = ( np . sqrt ( 2 ) / 2 * ( np . cos ( angle ) + np . sin ( angle ) ) ) panned_signal . audio_data [ 0 ] *= left_scale panned_signal . audio_data [ 1 ] *= right_scale return panned_signal
Pans an audio signal left or right by the desired number of degrees.
Pans an audio signal left or right by the desired number of degrees .
"""
    Pans an audio signal left or right by the desired number of degrees. This
    returns a copy of the input audio signal.

    Use negative numbers to pan left, positive to pan right. Angles outside of the
    range [-45, 45] raise an error.
    
    Args:
        audio_signal (AudioSignal): Audio signal to be panned.
        angle_in_degrees (float): Angle in degrees to pan by, between -45 and 45.
    
    Raises:
        ValueError: Angles outside of the range [-45, 45] raise an error.
    
    Returns:
        AudioSignal: Audio signal panned by `angle_in_degrees`.
    """
Audio signal panned by `angle_in_degrees`.
Audio signal panned by ` angle_in_degrees ` .
AudioSignal
Angles outside of the range [-45, 45] raise an error.
Angles outside of the range [ - 45 45 ] raise an error .
ValueError
audio_signal
Audio signal to be panned.
Audio signal to be panned .
angle_in_degrees
Angle in degrees to pan by, between -45 and 45.
Angle in degrees to pan by between - 45 and 45 .