Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I need some tools to detect the fundamental frequency and pitch of a sound. I Googled for "pitch detect" and found some .nb files that do these tasks, but all the files are in Mathematica 3.0 format. I downloaded and installed the Signal Processing package, but this did not help, because these files use some obsolete functions like DiscreteWindow, ContinuousPiecewiseData, etc. I also tested the Signals and Systems toolbox but for the same reason there was no output in most cases.

Are there any newer replacements of these functions or some way to find their definitions in some old packages?

share|improve this question
    
Take a look at all sections of Signal Processing guide - would it suit your goals? –  Vitaliy Kaurov Jan 8 '13 at 19:18
1  
Why couldn't you just use FourierTransform? –  cartonn Jan 8 '13 at 19:55
add comment

1 Answer

I downloaded and looked at some of these files you linked to above. To get one notebook autocorr.nb for example to run on V9, here are the steps I did:

Removed

  <<Miscellaneous`Audio`

Since by http://reference.wolfram.com/mathematica/Compatibility/tutorial/Miscellaneous/Audio.html

  The functionality in  is now available through the newly created Audio Package.

Also removed

<<Statistics`DescriptiveStatistics`

Since http://reference.wolfram.com/mathematica/Compatibility/tutorial/Statistics/DescriptiveStatistics.html

Functionality in this package has been added to the built-in Mathematica kernel.
is replaced by the kernel function Commonest.

Changed

 snd=ReadSoundfile["oboe1.wav"]

to

 snd=Import["ExampleData/rule30.wav","Data"][[1]]

However, ReadSoundfile did more than just read the sound data, it also did:

Mathematica graphics

While Import["ExampleData/rule30.wav","Data"] does not do that. It leaves the data as is:

snd[[1, 1 ;; 10]]    
 (* {0., -0.0078125, -0.0078125, -0.015625, -0.015625, 
  -0.0078125, -0.0078125, -0.0078125, -0.0078125, 0.}  *)

If there is no other function to do this conversion, you can do the mapping yourself and do the conversion and look more into it. I did not do this for now as I just wanted to see what changes needed to make it work. If you have trouble with this conversion, you could post a separate question.

Now going on using the sound data as is.....

Replaced

 ListPlot[sft,PlotJoined->True,PlotRange->All,PlotStyle->RGBColor[0,0,1],Frame->True];

by

 ListPlot[sft,Joined->True,PlotRange->All,PlotStyle->RGBColor[0,0,1],Frame->True];

and it worked now

Mathematica graphics

Mathematica graphics

Ofcourse the plots do not look as the original ones, since the sound data was not scaled in this case as it was before.

Conclusion

To get this one notebook autocorr.nb to work on V9, the above changes are what is needed. You can examine the other notebooks the same way.

The code is hard to read, and they use UpperCase for variable names, which is bad. I am sure it can be optimized much more as it is full of explicit loops and procedural style which can be slow in Mathematica.

FYI, I have the old signal processing package (it does not run any more on newer versions) and the documentaions I kept here

As was mentioned above, V9 now contains many new signal processing functions.

Update:

Just to answer the comment below:

  I also tried change pitchtrack.nb of the above mentioned package with no success. 
  I don't know how to replace DiscreteWindow, ContinuousPiecewiseData, and other 
  functions. Maybe these are built-in functions of the old Mathematica 2. Any help? 

These are in the old signal processing package, which I added a link to above.

Mathematica graphics

Mathematica graphics

Basically those notebooks used the old Mathematica DSP package. Therefore, to use them now, they need to be converted to use the new DSP functions in V9 or other functions in current version of Mathematica.

share|improve this answer
    
I also tried change pitchtrack.nb of the above mentioned package with no success. I don't know how to replace DiscreteWindow, ContinuousPiecewiseData, and other functions. Maybe these are built-in functions of the old Mathematica 2. Any help? Also there is a strange table called Fraza in many notebooks (for example in amdf.nb) without any definition! Some ideas please! –  user5326 Jan 9 '13 at 6:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.