Giter VIP home page Giter VIP logo

porc's Introduction

Python Open Room Correction (PORC)

PORC now includes mixed-phase compensation (see below)!

DSP Loudspeaker-Room correction filter wizard; transfer function modeling and equalization by fixed-pole parallel filters. Algorithm ported to Python by Mason A. Green, based on the work of Dr. Balazs Bank: http://home.mit.bme.hu/~bank/parfilt/

More details about Dr. Bank's parallel filter can be found in the papers:

Balazs Bank, "Perceptually Motivated Audio Equalization Using Fixed-Pole Parallel
Second-Order Filters," IEEE Signal Processing Letters, 2008.

http://www.acoustics.hut.fi/go/spl08-parfilt

Balazs Bank, "Direct Design of Parallel Second-order Filters for
Instrument Body Modeling," International Computer Music Conference,
Copenhagen, Denmark, Aug. 2007.

http://www.acoustics.hut.fi/go/icmc07-parfilt

Mixed-Phase Compensation references:

Alberto Carini, et al, "Mixed Time-Frequency approach for Multipoint
Room Response Equalization," AES 45th International Conference, 2012

Defrance & Polak, "Measuring the mixing time in auditoria," Acoustics
Paris 2008

Required Python dependencies:

1) Python 2.7
2) Scientific Python: SciPy, Numpy, & Matplotlib

The easiest install method on Windows is simply to install the continuum.io Anaconda package.

Measurement

One needs to measure the log-frequency impulse response of your speakers with a calibrated Electret Measurement Microphone, e.g. Dayton Audio EMM-6. Software such as Room EQ Wizard (REQ), Holm Impulse, or Arta may be used for this purpose: http://www.hometheatershack.com/roomeq/

Usage

porc.py [-h] [--mixed] [-t FILE] [-n NTAPS] [-o OPFORMAT] input_file output_file

python porc.py -t tact30f.txt -n 6144 -o bin l48.wav leq48.bin

Use the -h flag for help!

PORC has been tested successfully on both Linux and Windows 7 with Python 2.7. Linux depenency install is fairly straightforward. Windows install packages are available for all dependencies.

Target Response

The default target curve for PORC is flat. Included in the data directory are a number of target curves. Experiment to suit your listening preferences. Use the [-t] flag to load a target file.

One may also target a flat curve, and then use separate parametric equalization for bass boosting and other pschoaccoustic preferences.

For further reference, the B&K House Curve is a good place to start. Read "Relevant loudspeaker tests in studios in Hi-Fi dealers' demo rooms in the home etc.," Figure 5: http://www.bksv.com/doc/17-197.pdf

Mixed-Phase Compensation

To use mixed-phase compensation, one needs to specify the [--mixed] flag. One also needs to modify the Room Impulse Response (RIR) to remove leading silence (zeros) before the main impulse. You can easily do this with Audacity or REQ.

Example:

python porc.py --mixed -t tact30f.txt -n 6144 -o bin l48.wav leq48.wav

Have some patience with this method. The convolution takes a few CPU cycles.

PC Convolution

Suggestions:

Windows (foobar2000 convolver) Linux (jconvolver w/ jcgui & Jack)

You may need to merge left and right channels into a single stereo .wav

sox -M le148.wav req48.wav equalizer.wav

OpenDRC Convolution

Use -o bin flag to set binary 32bit IEEE floating point mono file format output for OpenDRC.

TODO

Implement algo to automatically remove leading silence (zeros) from RIR.
Add a GUI Frontend (pretty interactive graphs, drawing target curve, etc...)
Update this page with better documentation!

Contact

Complaints, suggestions, bugfixes: mason dot green at gmail

porc's People

Contributors

anlin93 avatar baetek avatar cmckeague avatar greenm01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

porc's Issues

Run environment?

Hello,
I'm trying to get this going with Anaconda2 v5.1.0. However, lots of stuff seems incorrect. For example, scipy.stats no longer has the nanstd function (afaik it never has) and nanstd is a numpy replacement. I can make a PR for that. One other thing that prevents me from executing is an issue creating IIR filters, it breaks on calling sig.butter:

Traceback (most recent call last):
  File "porc.py", line 374, in <module>
    main()  
  File "porc.py", line 371, in main
    roomcomp(args.impresp, args.filter, args.target, args.ntaps, args.mixed, args.opformat, args.trim, args.nsthresh, args.noplot)
  File "porc.py", line 152, in roomcomp
    Bf, Af = sig.butter(4, 30/(Fs/2), 'high')
  File "/opt/anaconda2/lib/python2.7/site-packages/scipy/signal/filter_design.py", line 2394, in butter
    output=output, ftype='butter')
  File "/opt/anaconda2/lib/python2.7/site-packages/scipy/signal/filter_design.py", line 1959, in iirfilter
    raise ValueError("Digital filter critical frequencies "
ValueError: Digital filter critical frequencies must be 0 < Wn < 1

I would really love to get mixed-phase filters on my system so if I can help I'd love to do so. I'm going to try to find the exact scipy version with nanstd and work from the Anaconda release that included it.

[REQ] Add a (GH-compliant) license file

Hi there, 1st of all thanks for your awesome (voluntary) work !

Since we've "doxed" it in our HyMPS project (under the AUDIO category \ Treatments page \ DRC subsection), can you please add a (GH-compliant) license file ?

As you certainly know, expliciting licensing terms is extremely important to let other devs (and not only) understand how to reuse/adapt/modify your code in other open projects and vice-versa.

Although it may sounds like a minor aspect, license file omission causes an inconsistent generation of the relative badge too:


(badge-generator URL: https://flat.badgen.net/github/license/greenm01/porc/?label=LICENSE)

Anyway you can easily set a "correct" one through the GH's license wizard tool.

Last but not least, let us know - in your opinion - how we could improve our categorizations and links to resources in order to favor collaboration between developers (and therefore evolution) of listed projects.

Thanks in advance.

Mic calibration file

Hi :)
First of all, thank you for your excellent software.

It seems that, as by now, it does not make use of the microphone's calibration file. Am I wrong ?

Since REW exports impulse responses without mic calibration, it would be nice to support it on the PORC side. Could that be possible ?

If led in the right direction, I would also be happy to help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.