Can I take the derivative of a function that represents a piece of music? The music is given in .mp3, .midi or whatever comes in handy.

  • 1
    $\begingroup$ Could you be a bit more specific? Do you want to take the derivative of a discrete-time sampled waveform? $\endgroup$ – Mr.Wizard Jun 9 '13 at 12:35
  • $\begingroup$ @Mr.Wizard sorry, forgot that mp3 is not continuous waveform. Is the waveform of MIDI continuous/is there a simple way to perform fourier transform on a MIDI input? $\endgroup$ – arax Jun 9 '13 at 12:42
  • 2
    $\begingroup$ Midi is like sheet music. If you want a waveform, convert mp3->wav with any external tool (this is easy to do) and then import the wav and work on it as bill sugested $\endgroup$ – Rojo Jun 9 '13 at 12:51
  • 1
    $\begingroup$ If the input is a MIDI, the following is relevant: stackoverflow.com/questions/7592596/… $\endgroup$ – Corey Kelly Jun 9 '13 at 14:52

In Mathematica, you can read in .wav files using Import. Since the data is then a discrete data sequence, you can't take a real calculus-style derivative, but you can take the derivative numerically, for instance, using functions like Differences and DerivativeFilter (thanks Jens). In fact, the derivative operation is a kind of high-pass filter, which will augment the noise and remove the low frequencies. You can listen to the changed sound using SampledSoundFunction or by saving the result out to a .wav file using Export. There are plenty of other ways you can manipulate the sound: LowpassFilter and HighpassFilter come to mind.

| improve this answer | |
  • $\begingroup$ Don't forget DerivativeFilter for lists. $\endgroup$ – Jens Jun 9 '13 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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