tuner entry
This commit is contained in:
parent
839411b1fd
commit
baa909c79d
44
code/tuner/README.md
Normal file
44
code/tuner/README.md
Normal file
@ -0,0 +1,44 @@
|
||||
## Background
|
||||
Here is a simple python instrument tuner. The idea is that you connect your instrument to your computers audio input, and the python script will tell you what note is being played (the note associated with the dominant frequency).
|
||||
|
||||
I decided to build this application because my bass tuner has gone missing. I believe someone has taken it from me and a mild sense of pride has kept me from acknowledging it is gone, so I am therefor reluctant to buy a new one. However, this program I have written is free and I hope it will do the job.
|
||||
|
||||
## Setup
|
||||
Potential libraries needed for debian-based gnu+linux
|
||||
```
|
||||
sudo apt-get install libportaudio2
|
||||
```
|
||||
Install python libraries
|
||||
```
|
||||
pip install -r requirnments.txt
|
||||
```
|
||||
|
||||
You will need to tweak the code to choose the correct device number. Of course, this could be abstracted to a python argument with a default value.
|
||||
|
||||
## Run
|
||||
```
|
||||
python3 main.py
|
||||
```
|
||||
|
||||
## View Source
|
||||
[main.py](./main.py)
|
||||
|
||||
## Demo
|
||||
|
||||
[Keyboard](./key-demo.mkv)
|
||||
|
||||
[Bass](./bass-demo.mkv)
|
||||
|
||||
[Trumpet](./trumpet-demo.mkv)
|
||||
|
||||
## Reflection
|
||||
This app works ok in some circumstances. Specifically, it seems to do well with mid range and high range frequencies, but was not very helpful for bass tuning. This could be for a variety of reasons including improper use of my bass amplifier, or sub-standard instrument, but I also suspect I could re-work my calculation of dominant frequenceies to better accomodate low ranges.
|
||||
|
||||
Getting the results I have took some work. I did understand I would need to use an FFT to recover the frequencies from the signal, but understanding how to properly apply a window (hanning) and the chunk size took more work. In addition to reviewing the course notes, ChatGPT was consulted to help debug and refine the function `dominant_frequency`. Deriving the note and octave values from the frequencies was rather straightforward algebra from the [notes](https://github.com/pdx-cs-sound/course-notes/blob/main/03-freq/04-notes.md) lecture.
|
||||
|
||||
## Consultation
|
||||
|
||||
[Python Sounddevice documentation](https://python-sounddevice.readthedocs.io/en/0.5.1/examples.html#plot-microphone-signal-s-in-real-time). This was my first time capturing audio from a PC audio input, rather than a wav file
|
||||
|
||||
|
||||
[Tuner example](https://github.com/mzucker/python-tuner/blob/master/tuner.py). This is a similar application, but using pyaudio rather than sounddevice. Some inspiration was taken from this.
|
BIN
code/tuner/bass-demo.mkv
Normal file
BIN
code/tuner/bass-demo.mkv
Normal file
Binary file not shown.
BIN
code/tuner/key-demo.mkv
Normal file
BIN
code/tuner/key-demo.mkv
Normal file
Binary file not shown.
3
code/tuner/requirements.txt
Normal file
3
code/tuner/requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
numpy==1.24.4
|
||||
scipy==1.8.0
|
||||
sounddevice==0.4.6
|
BIN
code/tuner/trumpet-demo.mkv
Normal file
BIN
code/tuner/trumpet-demo.mkv
Normal file
Binary file not shown.
@ -1,3 +1,9 @@
|
||||
### Friday 15-Nov-2024
|
||||
📝 [Tuner](./code/tuner/README.md) - A simply python instrument tuner
|
||||
|
||||
🤔 This week covered topics of music theory and MIDI. With regards to music theory, this was a needed review for me. I am already somewhat familiar with concepts notes, scales, measures, etc. but it has been some time since I have applied the theory. MIDI however is a new topic to me. I find the history and technical specifications of it interesting. Since I hope to experiment with MIDI using my Suzuki keyboard, I went ahead and bought a MIDI to USB adapter, and visited Professor Massey to learn a bit more about working with MIDI on linux.
|
||||
|
||||
|
||||
### Sunday 03-Nov-2024
|
||||
|
||||
🤔 Lectures this week continued coverage of audio filters, and introduced to us audio effects. By better understanding the theory and some technicaly challenges audio engineers face when working with signals at a given sample rate, frequency range, and variations of amplitude the role of filters becomes apparent. Audio effects were interesting and fun to play with in class, and I find myself somewhat trying to notice which effects were likely used in the music and podcasts I listen to.
|
||||
|
Reference in New Issue
Block a user