# Programming Real-Time Sound in Python
## Appendix A Code Listings
defprocess(c_data,m_data,FRAMES_PER_BUFFERER,T,ovr_f,a,b,zi): cdefunsignedint i resampleoftwobufferstooversamplingrateusing0-padding movedatafrompythonnp.arraytocmemorylocated
#calltheCfunction compute_c(cdata,mdata,FRAMES_PER_BUFFERER*ovr_f,T) readmodifieddataintop.array LPFonreturneddata returnc_data[::ovr_f]#takeonesampleeachovr_fsamples
```
Listing A10: Ring modulator-Cython (binding)
``` =================================== c_diode.c =================================== //declareglobalvariables doubleu1=0;... voidring(double*carr_in,double*mod_in,intsamples,floatT){ inti=0; for(i=0;i<samples;i++){ equation1... equation9  carr_in[i]=equation2_result } return;```
=================== test_diode.py =================== import diode... ovr_f = 30 #oversampling factor T = 1./(s_rate*ovr_f) b,a = butt_low(sample_rate/ovr_f, s_rate, 5) zi = signal.lfilter_zi(b,a) defprocess(c_in, m_in): globalzi return diode.process(c_in, m_in, CHUNK_SIZE,T, ovr_f, a, b, zi)
```

Listing 11: Ring modulator-Cython (main)

## References

* (1) [PERSON] Rethinking the Computer Music Language: SuperCollider. _Comput. Music J._**2002**, _26_, 61-68. [CrossRef]
* (2) [PERSON]; [PERSON] Survey of Audio Programming Tools. In _CHI '13 Extended Abstracts on Human Factors in Computing Systems_; CHI EA '13; ACM: New York, NY, USA, 2013; pp. 781-786. [CrossRef]
* (3) [PERSON]; [PERSON] Design for longevity: Ongoing use of instruments from NIME 2010-14. In Proceedings of the International Conference on New Interfaces for Musical Expression (NIME'17), Copenhagen, Denmark, 15-19 May 2017; pp. 192-197. * (4) [PERSON] Programming Languages: A Survey. _Int. J. Recent Innov. Trends Comput. Commun._**2017**, \(5\), 307-313. * (5) [PERSON] Python is Now the Most Popular Introductory Teaching Language at Top U.S. Universities. 2014. Available online: [[https://cacm.acm.org/blogs/blog-cacm/176450](https://cacm.acm.org/blogs/blog-cacm/176450)]([https://cacm.acm.org/blogs/blog-cacm/176450](https://cacm.acm.org/blogs/blog-cacm/176450)) (accessed on 18 June 2020). * (6) [PERSON]; [PERSON]; [PERSON] Trends in Introductory Programming Courses in Australian Universities Languages, Environments and Pedagogy. In Proceedings of the Australasian Computing Education Conference (ACE2012), Melbourne, Australia, 31 January-3 February 2012; CRPIT; [PERSON], [PERSON], Eds. ; ACS: Melbourne, Australia; Volume 123, pp. 33-42. * (7) [PERSON] _Think DSP: Digital Signal Processing in Python_, 1 st ed. ; O'Reilly Media, Inc.: Newton, MA, USA, 2016. * (8) [PERSON]; [PERSON]; [PERSON] Visualizing physiological signals in real-time. In Proceedings of the 14 th Python in Science Conference (SciFy 2015), Austin, TX, USA, 6-12 July 2015; pp. 190-194. [CrossRef]
* (9) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] Cython: The Best of Both Worlds. _Comput. Sci. Eng._**2011**, _13_, 31-39. [CrossRef]
* (10) [PERSON]; [PERSON]; [PERSON]; [PERSON] Real-Time Guitar Amplifier Emulation with Deep Learning. _Appl. Sci._**2020**, _10_, 766. [CrossRef]
* (11) [PERSON] [PERSON]; [PERSON]; [PERSON] Deep Learning for Black-Box Modeling of Audio Effects. _Appl. Sci._**2020**, _10_, 638. [CrossRef]
* (12) [PERSON] [PERSON]; [PERSON]; [PERSON] Development of real-time audio applications using Python. In Proceedings of the XXII Colloquium of Musical Informatics, Udine, Italy, 22-23 February 2018; pp. 226-231. * (13) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] _The Technology of Computer Music_; MIT Press: Cambridge, MA, USA, 1969; Volume 5. * (14) [PERSON]; [PERSON] Real-time CSound: Software Synthesis with Sensing and Control. In Proceedings of the International Computer Music Conference, Glasgow, Scotland, 10-15 September 1990; pp. 209-211. * (15) [PERSON] Pure Data: another integrated computer music environment. In Proceedings of the International Computer Music Conference, Hong Kong, China, 19-24 August 1996; pp. 37-41. * (16) Cycling 74. Max/MSP Website. 2020.