-1

I have two raw audio file generated through sip packets. one contains raw audio file of conversation of between two persons. If I add a new person there will be a hold music which will be added to the file and it will be stored as new raw audio file. I need to remove the hold music which is added between the raw audio file.

Is there any way?

I need to merge both this raw audio file. but because of the hold music which comes in between there is conflict in the merged audio file.

Please kindly help. (note i m using python for merging raw audio file)

def merge_binary_files(input_files, output_file, chunk_size=1024 * 16):
    try:
        # Open all input files in binary read mode
        files = [open(file, 'rb') for file in input_files]

        with open(output_file, 'wb') as out:
            while True:
                all_chunks_empty = True

                for f in files:
                    chunk = f.read(chunk_size)

                    # If a chunk is not empty, write it to the output file
                    if chunk:
                        out.write(chunk)
                        all_chunks_empty = False

                # Break if all chunks are empty, meaning we've reached the end of all files
                if all_chunks_empty:
                    break

        # Close all input files
        for f in files:
            f.close()

        print(f"Binary files merged successfully into {output_file}")

    except Exception as e:
        print(f"An error occurred: {e}")


# Example usage:
input_files = [
    'audio10002.raw',
    'audio10000.raw',
]
merge_binary_files(input_files, '570-1.raw')
2

0

Browse other questions tagged or ask your own question.