Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recognizing notes within recorded sound - Python [closed]

Tags:

python

audio

I'm wondering if I can extract a sequence of musical notes from a recorded sound using Python.

It is the first time I'm considering using Python for this.


Help would be truly awesome :)

like image 312
RadiantHex Avatar asked Aug 30 '10 13:08

RadiantHex


People also ask

How do I read an audio file in Python?

open() This function opens a file to read/write audio data. The function needs two parameters - first the file name and second the mode. The mode can be 'wb' for writing audio data or 'rb' for reading.

How do I stop Playsound in Python?

After successful execution of the program, audio file will start playing. Now Click on terminal, once you see the cursor, type Ctrl+C , it will bring you out of the terminal and audio will also stop playing.

How do you record audio in Python?

Recording AudioThe python-sounddevice and pyaudio libraries provide ways to record audio with Python. python-sounddevice records to NumPy arrays and pyaudio records to bytes objects. Both of these can be stored as WAV files using the scipy and wave libraries, respectively.

Can Python play sounds?

Play sound on Python is easy. There are several modules that can play a sound file (. wav).


1 Answers

What you would want to do is take your audio samples, convert them into the frequency domain with a Fast Fourier Transform (FFT), find the most powerful frequency in the sample, and convert that frequency into a note.

See FFT for Spectrograms in Python for pointers to libraries to help with the first two items. See http://80.68.92.234/sigproc.html for some sample code to get you started.

like image 106
Gabe Avatar answered Sep 20 '22 01:09

Gabe