store all data from pfft

Feb 4, 2010 at 8:50am

store all data from pfft

Hallo,

I am really new to Max, so my question may sound a bit dumb …

I’m in my second (and last) Master year for Piano. For my end work i am trying to write a program that can analyse the music and determine wich cord(s) are played. Never good luck, but now a friend of me suggested i should use MaxMSP, and as far as I see he is wright.

I looked into the ‘Forbidden Planet’-example and its showing me iits up for the job. He analyses the data with a Fast Fourier Transform module and gives an output from the frequencies set in the filter.

This is my idea: I need the fft to output everything (frequencie’s with there amplitude) so I can filter the notes and determine wich are played (probably i will run into problems to determine upper and lowernotes from notes that are actualy played).

So: is it possible to make (p)fft~ give a textual output of all the frequencies he found (with there amplitude) to work with?

Thanks in advance
Hans

#48216
Feb 4, 2010 at 5:13pm

Hello maxer,

What you are trying to do is a hard job ; the Holy Grail of computer music ; IMHO you should have a look on [pitch~] [fiddle~] [sigmund~] and [yin~] externals before (www.maxobjects.com or google them) ; And if you still want to do yours, welcome !

#173396
Feb 5, 2010 at 3:28am

Seconded, this is good advice!

#173397
Feb 8, 2010 at 10:54am

I have a windows/linux machine… it seems that most of the externals are for Mac only. I am now trying to work with pitch~. The others won’t run on a Windows machine… ro bad, espacially the fiddle~ seems a very good one to me.

But still I don’t get it, a Fourier Transform is analysing the waves, why isn’t it possible to just store all the data and work with it? Probably i am asking a very stupid question, but if i can analyse it, why can’t i store the data from the (P)FFT?

#173398
Feb 8, 2010 at 11:40am

A Fourier Transform might analyze waves, but doesn’t do that in order to make a statement about the content of those wave: based on a given set of sine waves, it calculates how to mix them together in order to get the original wave. And that is quite far from analyzing pitches, let alone chords. It is not impossible, but the data from the FFT recipe needs to be reworked. This reworking is the tricky part. The chef working at Melodyne does a good job at realizing what is described as the holy grail of computer music: make an out of tune singer sound in tune.

In the meantime you could use sfrecord~ to capture the values from a cartopol~ and (after some scaling) have a view of the harmonic content.

_
johan

#173399
Feb 8, 2010 at 12:06pm

The spectrum of a single piano note is already complex, as it has a lot of harmonics, just think about how would you distinguish a played fifth interval from a single note? The fifth just adds to the energy of the harmonics from the fundamental note. Not impossible, but tricky, certainly not a beginners task…
But if you simply play on a digital piano, all is easy, Midi is pretty straight forward…
There is also an external from Arshia Cont at
http://cosmal.ucsd.edu/arshia/index.php?n=Main.Transcribe
This external is optimized for analyzing piano. But as for the lack of an own piano I didn’t try it…

Good luck,

Stefan

#173400
Feb 10, 2010 at 10:58am

I know that the spectrum of a single note is complex, that’s no problem, as a student at the Lemmens institute we learned what this spectrum is, it determines the colour of the sound (it is determined by the upper (and lower) notes).

The ultimate purpose of my end work is developing an educational help by digitalizing the sheet music, show it on a touch screen (so the player can make notes). De computer is able to ‘follow’ the music and show wrongfully played notes and ‘turn’ the pages.

It seems like the pitch~ external is doing the job, it can output up to 100 frequencies with there amplitude. So it has to go in a filter that determines (based on the amplitude) which notes are played and which are upper notes. The played notes are going into a midi and are compared with the ones in the sheet music.

I will start again with the help file of pitch~ as a base.

I really appreciate your help.

#173401
Feb 11, 2010 at 7:19am

Hello maxer,

[iana~] from Ircam could be usefull for your job, but regrettably it is not free ;
(as [yin~] moreover), in case of …

I forgot [analyzer~] from CNMAT and [ol.autotalent~] from Oli Larkin ;

I didn’t set a lot of time to try the last one but (even if it is not its real purpose) IMHO you can test it for pitch tracking. In my memory, CNMAT have a nice tutorial (and externals) for visualize/synthetise additive harmonic frequencies.

http://olilarkin.blogspot.com

http://cnmat.berkeley.edu/downloads

@jvkr : the holy grail of computer music ;-)

HTH

#173402
Mar 13, 2010 at 11:19am

I did some work, and I’m really stunned of Max/MSP’s possibilities.
The patch I worked on is attached, there’s only one problem: pitch~ seems to fail in analysing low frequencies… For the upper part of the keyboard everything works just great.

I was thinking that a FFT needs at least one complete wave to analyse a frequency, is it possible that the samples are to small for low frequencies so there can’t be a complete wave in one?

Suggestions?

My patch is attached, in the zip I included the pitch~ external and the fftw3.dll used to analyse (fftw3.dll should be in your max folder)

Attachments:
  1. thesis.zip
#173403
Mar 31, 2010 at 7:47pm

Hi Artexanis,,briefly, if I understood well, you can use pfft~ and transform your sound in matrices with Jitter, then you can analize the sound on the fly using jit.cellblock and visualize/edit/retrieve any single value stored in a cell: 2 planes > amplitude and phase. From this analysis you can obtain the fundamental frequency of every frame (or a group of frames) and so the harmonics too…or many other infos that you can use to transform the sound or to make a midi score.

las

#173404

You must be logged in to reply to this topic.