This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
computers-sound-music-portf.../code/clipped/README.md
2024-10-17 14:40:10 -07:00

2.2 KiB

Background

Included here is a simple python script used to generate and play some sine waves, specified by the assignment. This script will play a tone, so please ensure your default audio output is properly configured (and not too loud) for your listening enviornment

Setup

Potential libraries needed for debian-based gnu+linux

sudo apt-get install libportaudio2

Install python libraries

pip install -r requirnments.txt

Run

python3 main.py

View Source

main.py

Access outputs

sine.wav

clipped.wav

Reflections, Results, Analysis

Overall this portfolio assignment went well. Though I have worked with audio analysis and editing in the past (in a limited capacity), this was my first opportunity to create computer audio at the bit level, and in that regard it was rather exciting and interesting.

In retrospect, my decision to implement this assignment as a python script seems to have been a good choice. The provided libraries were helpful in providing the raw trigonmetric math and unit casting, without abstracting away the discrete transformation steps needed to get to the result. The calls to scipy.io.wavfile.write and sounddevice.play were easy and succinct, which allowed me to focus on usage of numpy to generate the proper signals with the requested parameters. I did consider implementing this assignment in Rust; this likely would have been fun at the risk of getting caught up in using algorithms from a less-mature library and a more hand-on approach to managing data structures.

The most challenging part of this assignment was understanding the relationship between time, the wave angle and amplitude to generate the wave. This took some tinkering and iterations to lead to my result.

My primary technical resources for this assignment were viewing the API documentation for the various libraries

I consider this portfolio assignment complete