pySoundToolbox.py
def save24PCM(fileName, data, samplingRate=16000):
    """
    Saves a 24 PCM wav file.

    @param fileName name of the file
    @param data already sampled data as numpy uint32 array. The cols represent the time and the rows
        are the channels.
    @param samplingRate sampling rate in Hz
    """

    # Determine number of channels
    if len(data.shape) == 1:
        data = np.matrix(data)

    with wave.open(fileName, 'w') as wav:
        wav.setframerate(samplingRate)
        wav.setsampwidth(3)
        wav.setnchannels(data.shape[0])
        for i in range(data.shape[1]):
            for k in range(data.shape[0]):
                sample = data[k, i]
                # Revert byte order, because wav is little endian
                frame = bytes([sample & 0xff, (sample >> 8) & 0xff, (sample >> 16) & 0xff])
                wav.writeframes(frame)
        wav.close()

    Saves a 24 PCM wav file.

    @param fileName name of the file
    @param data already sampled data as numpy uint32 array. The cols represent the time and the rows
        are the channels.
    @param samplingRate sampling rate in Hz
    
Saves a 24 PCM wav file.
@param fileName name of the file
@param data already sampled data as numpy uint32 array. The cols represent the time and the rows
are the channels.
@param samplingRate sampling rate in Hz
Saves a 24 PCM wav file . @param fileName name of the file @param data already sampled data as numpy uint32 array . The cols represent the time and the rows are the channels . @param samplingRate sampling rate in Hz
def save24PCM(fileName, data, samplingRate=16000):
    if len(data.shape) == 1:
        data = np.matrix(data)
    with wave.open(fileName, 'w') as wav:
        wav.setframerate(samplingRate)
        wav.setsampwidth(3)
        wav.setnchannels(data.shape[0])
        for i in range(data.shape[1]):
            for k in range(data.shape[0]):
                sample = data[k, i]
                frame = bytes([sample & 0xff, (sample >> 8) & 0xff, (sample >> 16) & 0xff])
                wav.writeframes(frame)
        wav.close()
def save24PCM ( fileName , data , samplingRate = 16000 ) : if len ( data . shape ) == 1 : data = np . matrix ( data ) with wave . open ( fileName , 'w' ) as wav : wav . setframerate ( samplingRate ) wav . setsampwidth ( 3 ) wav . setnchannels ( data . shape [ 0 ] ) for i in range ( data . shape [ 1 ] ) : for k in range ( data . shape [ 0 ] ) : sample = data [ k , i ] frame = bytes ( [ sample & 0xff , ( sample >> 8 ) & 0xff , ( sample >> 16 ) & 0xff ] ) wav . writeframes ( frame ) wav . close ( )
Saves a 24 PCM wav file.
Saves a 24 PCM wav file .
"""
    Saves a 24 PCM wav file.

    @param fileName name of the file
    @param data already sampled data as numpy uint32 array. The cols represent the time and the rows
        are the channels.
    @param samplingRate sampling rate in Hz
    """ # Determine number of channels # Revert byte order, because wav is little endian
fileName
data
samplingRate