tags:

views:

47

answers:

1
A: 

Its probably not the best solution, but im sure it will work. Maybe you find existing libs or so for some steps, i dont know for python. The steps I suggest are:

  1. Load the wave file.
  2. Create the sample values (amplitude) for each frame (depending on frame size, litte/big endian, signed/unsigned).
  3. Divide the resulting array of int values into windows, e.g. sample 0-511, 512-1023, ...
  4. Perform the window function, for the windows that you want to join.
  5. Do your joining.
  6. Store the windows back in a byte array, the inverse operation of the first stepp.

Old Post: You have to calculate the sample value, in java a function for a 2byte/frame soundfile would look like this:

public static int createIntFrom16( byte _8Bit1, byte _8Bit2 ) {
    return ( 8Bit1<<8 ) | ( 8Bit2 &0x00FF );
}

Normaly you will have to care about weather or not the file uses little endian, I don't know if the phython lib will take this into account.

Once you have created all sample values, you have to divide your file into windows, e.g. of size 512 samples. Then you can window the values, and create back the byte values. For 16bit it would look like this:

public static byte[] createBytesFromInt(int i) {
    byte[] bytes = new byte[2];
    bytes[0]=(byte)(i>>8);
    bytes[1]=(byte)i;
    return bytes;
}
InsertNickHere
how to implement this is pythoni am not used to java
kaki
Im not used to python sorry, but maybe someone elso who reads this can translate the functions.
InsertNickHere
if not translate can u just explain what are step and how is it done.i wil code it myself please
kaki