Repository navigation
Implement pitch detector class #58
Description
Activity
Currently there are only two built-in types of analysis available in the Sound library:
Amplitudefor 'loudness', andFFTfor frequency spectrum analysis. You can derive more complex audio features like 'tempo' or 'key/pitch' from amplitude and FFT, but that's actually quite a complex task.All analysis classes in the Sound library work in the same way: you choose which sound you want to analyse by calling:
analysisObject.input(soundObject);So the example above analyses the amplitude of the sound coming out of an
AudioInobject, i.e. the microphone or line-in. If you want to analyse the amplitude of a file that's being played back instead just use the following lines duringsetup():SoundFile file = new SoundFile(this, .....); file.play(); Amplitude amp = new Amplitude(this); amp.input(file);There's not a lot of user traffic over here on Github normally, if you have more questions or need coding help it's probably best to ask them over here at the Processing Discourse board: https://discourse.processing.org/c/processing/processing-libraries/19
Reacted by Joe23232THanks for your help :)
I did ask the community this but they didn't know the answer.
So in regards to tempo, how would I specifically get it if you happen to know?
- addedquestionQuestion about setting up or using the libraryQuestion about setting up or using the library
on Nov 17, 2020 395a5dc added a
BeatDetectorclass which allows you to detect beats, which is not quite the 'tempo' of a track, but as close as you might get in a non-specialized piece of audio software. The other existing Analyzers are now more well-documented and presented in the new website reference, which means the only thing missing from the picture is a built-in pitch/frequency detection class. This should be pretty straightforward to implement by simply wrapping the JSynPitchDetectorclass. It might look something like this:public class PitchDetector extends Analyzer { private final com.jsyn.unitgen.PitchDetector detector; private float minimumConfidence = 0.5; public PitchDetector(PApplet parent) { super(parent); } public PitchDetector(PApplet parent, float minimumConfidence) { super(parent); this.minimumConfidence = minimumConfidence; } // return the current frequency of the input signal if the confidence is at least as high // as this detector's minimumConfidence, 0 otherwise float analyze() { ... } // return the current frequency of the input signal if the confidence is at least as high // as the given minimumConfidence, 0 otherwise float analyze(float minimumConfidence) { ... } }
- changed the title
[-]Is it possible to get various information about an audio file such as current tempo, loudness, key/pitch etc?[/-][+]Implement pitch detector class[/+]on Sep 18, 2023 - addedenhancementNew feature or requestNew feature or requestand removedquestionQuestion about setting up or using the libraryQuestion about setting up or using the library
on Sep 18, 2023
Is it possible to get various information about an audio file such as current tempo, loudness, key/pitch etc?
I am going through the sound library and I am finding some difficulties finding how to do this.
For example if I want to get the loudness (I believe this is the amplitude) here is the sample code:
Where is the the sound coming in from?