Next Article in Journal
Estimating the Dynamic Behavior of Highway Steel Plate Girder Bridges Using Real-Time Strain Measurements
Previous Article in Journal
Person Independent Recognition of Head Gestures from Parametrised and Raw Signals Recorded from Inertial Measurement Unit
Open AccessTutorial

Programming Real-Time Sound in Python

by and *,†
HCI Lab, Department of Mathematics, Computer Science and Physics, University of Udine, 33100 Udine, Italy
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Appl. Sci. 2020, 10(12), 4214; https://doi.org/10.3390/app10124214
Received: 24 April 2020 / Revised: 6 June 2020 / Accepted: 16 June 2020 / Published: 19 June 2020
(This article belongs to the Section Acoustics and Vibrations)
For its versatility, Python has become one of the most popular programming languages. In spite of its possibility to straightforwardly link native code with powerful libraries for scientific computing, the use of Python for real-time sound applications development is often neglected in favor of alternative programming languages, which are tailored to the digital music domain. This article introduces Python as a real-time software programming tool to interested readers, including Python developers who are new to the real time or, conversely, sound programmers who have not yet taken this language into consideration. Cython and Numba are proposed as libraries supporting agile development of efficient software running at machine level. Moreover, it is shown that refactoring few critical parts of the program under these libraries can dramatically improve the performances of a sound algorithm. Such improvements can be directly benchmarked within Python, thanks to the existence of appropriate code parsing resources. After introducing a simple sound processing example, two algorithms that are known from the literature are coded to show how Python can be effectively employed to program sound software. Finally, issues of efficiency are mainly discussed in terms of latency of the resulting applications. Overall, such issues suggest that the use of real-time Python should be limited to the prototyping phase, where the benefits of language flexibility prevail on low latency requirements, for instance, needed during computer music live performances. View Full-Text
Keywords: real time; sound processing; Python; Cython; Numba; code refactoring real time; sound processing; Python; Cython; Numba; code refactoring
Show Figures

Figure 1

MDPI and ACS Style

De Pra, Y.; Fontana, F. Programming Real-Time Sound in Python. Appl. Sci. 2020, 10, 4214. https://doi.org/10.3390/app10124214

AMA Style

De Pra Y, Fontana F. Programming Real-Time Sound in Python. Applied Sciences. 2020; 10(12):4214. https://doi.org/10.3390/app10124214

Chicago/Turabian Style

De Pra, Yuri; Fontana, Federico. 2020. "Programming Real-Time Sound in Python" Appl. Sci. 10, no. 12: 4214. https://doi.org/10.3390/app10124214

Find Other Styles
Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Article Access Map by Country/Region

1
Search more from Scilit
 
Search
Back to TopTop