pySoundToolbox.py
def read24PCM(fileName):
    """
    Reads a 24 PCM wav file.

    @param fileName name of the file
    @return tupel (data, samplingRate):
        data is a numpy int32 array with the read data. A row represents one channel.
        samplingRate is the provided sampling rate.
    """

    with wave.open(fileName, 'r') as wav:
        samplingRate = wav.getframerate()
        data = np.zeros((wav.getnchannels(), wav.getnframes()), dtype=np.int32)
        for i in range(data.shape[1]):
            frame = wav.readframes(1)
            for k in range(data.shape[0]):
                # Seems pretty ugly and only works in python, but I don't know a better way to keep the Two's complement
                data[k, i] = struct.unpack('<i', bytes([0]) + frame[k*3:k*3+3])[0] >> 8
        wav.close()

    return (data, samplingRate)

    Reads a 24 PCM wav file.

    @param fileName name of the file
    @return tupel (data, samplingRate):
        data is a numpy int32 array with the read data. A row represents one channel.
        samplingRate is the provided sampling rate.
    
Reads a 24 PCM wav file.
@param fileName name of the file
@return tupel (data, samplingRate):
data is a numpy int32 array with the read data. A row represents one channel.
samplingRate is the provided sampling rate.
Reads a 24 PCM wav file . @param fileName name of the file @return tupel ( data samplingRate ) : data is a numpy int32 array with the read data . A row represents one channel . samplingRate is the provided sampling rate .
def read24PCM(fileName):
    with wave.open(fileName, 'r') as wav:
        samplingRate = wav.getframerate()
        data = np.zeros((wav.getnchannels(), wav.getnframes()), dtype=np.int32)
        for i in range(data.shape[1]):
            frame = wav.readframes(1)
            for k in range(data.shape[0]):
                data[k, i] = struct.unpack('<i', bytes([0]) + frame[k*3:k*3+3])[0] >> 8
        wav.close()
    return (data, samplingRate)
def read24PCM ( fileName ) : with wave . open ( fileName , 'r' ) as wav : samplingRate = wav . getframerate ( ) data = np . zeros ( ( wav . getnchannels ( ) , wav . getnframes ( ) ) , dtype = np . int32 ) for i in range ( data . shape [ 1 ] ) : frame = wav . readframes ( 1 ) for k in range ( data . shape [ 0 ] ) : data [ k , i ] = struct . unpack ( '<i' , bytes ( [ 0 ] ) + frame [ k * 3 : k * 3 + 3 ] ) [ 0 ] >> 8 wav . close ( ) return ( data , samplingRate )
Reads a 24 PCM wav file.
Reads a 24 PCM wav file .
"""
    Reads a 24 PCM wav file.

    @param fileName name of the file
    @return tupel (data, samplingRate):
        data is a numpy int32 array with the read data. A row represents one channel.
        samplingRate is the provided sampling rate.
    """ # Seems pretty ugly and only works in python, but I don't know a better way to keep the Two's complement
fileName