Coder Social home page Coder Social logo

pyrirtool's Introduction

pyrirtool

Measuring room impulse responses with python and sounddevice

The code is based on the exponential sine sweep method and its modifications, proposed by A. Farina [1, 2]. The python package sounddevice is used for recording and playback.

Getting started

Required packages

First steps

The main file used to record a room impulse response is measure.py. When running it for the first time from the terminal, a file with default parameters is created in _data/defaults.npy (recording doesn't take place when running the script for the first time.)

=> python measure.py
Default settings not detected. Creating a defaults file in _data

After default settings have been generated, they can be checked by typing

python measure.py --defaults

The output should be (the different parameters will be explained later)

amplitude => 0.2
duration => 10
startsilence => 1
endsilence => 1
reps => 1
fs => 44100
inputChannelMap => [1]
outputChannelMap => [1]
inputdevice => 0
outputdevice => 1
sweeprange => [0, 0]

Configuration from the command line

Some of the measurement settings can be passed as command line parameters. To see available options type

python measure.py --help

Selecting the audio device

To see a list of available input and output devices, with the corresponding number of input and output channels type python measure.py --listdev in the terminal. The output looks something like this:

=> python measure.py --listdev
> 0 MacBook Pro Microphone, Core Audio (1 in, 0 out)
< 1 MacBook Pro Speakers, Core Audio (0 in, 2 out)
Default input and output device:  [0, 1]

If there are other devices available they should appear in the list as well. Then, desired input/output devices can be selected using their corresponding number in the list, and the keywords -indev (for input device) and -outdev (for output device). For example:

python measure.py --setdev -indev 0 -outdev 1

Measuring a room impulse response

To start a recording from the command line with custom parameters, type:

python measure.py -dur 2 -r 2 -a 0.5 -ss 2 -es 1 -chin 1  -chou 2
  • Setting the sine sweep duration to 2 seconds: -dur 2

  • Choosing the number of sweep repetitions-r 2

  • Setting the sweep amplitude: -a 0.5

  • Setting the silence at the start and at the end of a sweep (e.g., 2 seconds and 1 second, respectively): -ss 2 -es 1

  • Setting the input and output channels (for example to channel 1 and channel 2, respectively) -chin 1 -chou 2

  • One can also record multiple channels simultaneously, for instance by setting -chin 1 2 3 (if the channels are available). The number of available channels can be seen by typing measure.py --listdev

References

[1] A. Farina, Simultaneous Measurement of Impulse Response and Distortion with a Swept-Sine Technique, 108th Audio Engineering Society Convention, 2000

[2] A. Farina, Advancements in impulse response measurements by sine sweeps, 122nd Audio Engineering Society Convention, 2007

Authors

pyrirtool developed by Maja Taseska at KU Leuven, ESAT-STADIUS.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

pyrirtool's People

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.