Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Speex Echo Canceller Python Library

NotificationsYou must be signed in to change notification settings

xiongyihui/speexdsp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Requirements

  • swig
  • compile toolchain
  • python
  • libspeexdsp-dev

Build

There are two ways to build the package.

  1. using setup.py

    sudo apt install libspeexdsp-devgit clone https://github.com/xiongyihui/speexdsp-python.gitcd speexdsp-pythonpython setup.py install
  2. using Makefile

    git clone https://github.com/xiongyihui/speexdsp-python.gitcd speexdsp-python/srcmake

Get started

"""Acoustic Echo Cancellation for wav files."""importwaveimportsysfromspeexdspimportEchoCancelleriflen(sys.argv)<4:print('Usage: {} near.wav far.wav out.wav'.format(sys.argv[0]))sys.exit(1)frame_size=256near=wave.open(sys.argv[1],'rb')far=wave.open(sys.argv[2],'rb')ifnear.getnchannels()>1orfar.getnchannels()>1:print('Only support mono channel')sys.exit(2)out=wave.open(sys.argv[3],'wb')out.setnchannels(near.getnchannels())out.setsampwidth(near.getsampwidth())out.setframerate(near.getframerate())print('near - rate: {}, channels: {}, length: {}'.format(near.getframerate(),near.getnchannels(),near.getnframes()/near.getframerate()))print('far - rate: {}, channels: {}'.format(far.getframerate(),far.getnchannels()))echo_canceller=EchoCanceller.create(frame_size,2048,near.getframerate())in_data_len=frame_sizein_data_bytes=frame_size*2out_data_len=frame_sizeout_data_bytes=frame_size*2whileTrue:in_data=near.readframes(in_data_len)out_data=far.readframes(out_data_len)iflen(in_data)!=in_data_bytesorlen(out_data)!=out_data_bytes:breakin_data=echo_canceller.process(in_data,out_data)out.writeframes(in_data)near.close()far.close()out.close()

About

Speex Echo Canceller Python Library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp