Click here to Skip to main content
12,763,360 members (26,081 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ MFC VC9.0 VisualC++
How to calculate and implement the beats per minute, pitch and tempo of any *.wav file and change its beats per minute to any other value which can decrease bpm or increase bpm using vc++,mfc
Posted 7-May-12 0:24am
Updated 9-May-12 19:46pm
Chandrasekharan P 7-May-12 6:26am
Did you try directX tools?
chaiein 7-May-12 7:46am
I have Directx but how can i make use of it to get bpm? or pitch or tempo
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

These are not fields or properties in a wave file.

A wave file simply contains a representation of a waveform over time.

What you're looking for, is information on waveform analysis. There are tools that will approximate some of the functions you're looking for. It's not an exact science, as music is very messy from an analysis point of view. It's extremely difficult for computers to process information, that our ears and brain seem to process relatively easily.

This is a topic that you could devote your entire life to.

But there you go, google 'Waveform Analysis'
chaiein 10-May-12 1:49am
There are many softwares to change the beats per minute for any music. where Can I get sample projects for the same so I can refer to learn..
JackDingler 10-May-12 11:21am
Yes, there are, for Midi files.

Perhaps you meant midi and not wav?
JackDingler 10-May-12 11:31am
I think the problem your facing, is a misunderstanding about the capabilities of various music and sound formats.

Software that changes the beats per minute of a music file, is going to be working on a file that encodes notes and not sounds. Examples include ABC and Midi. Many of these packages use a proprietary format.

You just don't have information about beats per minute in a wave file.

Consider for a moment, a wave file consisting of a 440 tone played for one second. How many beats is that? How would you detect how many beats it is? Is it in 4/4, 3/4, 6/8, 9/8? You can't tell. What's the Tempo? 50 BPM? 100 BPM? There's not enough information. And if you don't know this, you can't convert it to a another value.

MIDI files encode this information. So with these files it is possible to change the BPM. But they aren't wav files. And if you convert them to wav, you lose that information.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

About pitch and tempo, what Jack said was right, if by bpm you mean bits per minute, please check WAVEFORMATEX structure that a wave file contains.[^]

Please check the following links too:[^][^]
chaiein 9-May-12 0:16am
I am able to set 16 and 32 bits only. where 16 is normal and 32 is fast and 8 gives noise inbetween. I need to implement for more than 32 and less than 8 with out any noise
<pre lang="c++">
m_pFile = new CSoundFile("sound1.wav");
if(m_pFile && m_pFile->IsOK())

stib_markc 9-May-12 0:45am
Then you have a lot to work on, because this is not possible with the API or some other commands. Normally used sampling rates are between 8 kHz (telephone quality) and 48 kHz (DAT tapes). The most fundamental parameter is sampling rate which limits the highest frequency than can be stored. You can refer "Nyquist-Shannon Sampling Theorem". This becomes a whole different ball game then.
From what I have read, sample encoding limits dynamic range of recorded signal (difference between the faintest and the loudest signal that can be recorded). In theory the maximum dynamic range of signal is number_of_bits * 6 dB . This means that 8 bits sampling resolution gives dynamic range of 48 dB and 16 bit resolution gives 96 dB. So, I do not think what you want to do is possible to do using the available mmio API or MCI API.
chaiein 10-May-12 0:36am
There are many softwares to change the beats per minute for any music. where Can I get sample projects for the same so I can refer to learn..
stib_markc 10-May-12 6:27am
i suggest you the best thing to do :
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

The simplest thing you can do is changing the sampling rate in the header of the file. The effect is like playing a tape/record at lower or higher speed.
Do not change bits per sample, that will result in garbage.
If you want to change effects independently, you'll have to do terrible maths. Sorry I do not find the publication where the algorithm is described anymore, some of the hits of Google when searching for "audio similarity algorithm" might help to get to the theory.
But an open source program which can do those effects might help you more: audacity[^]
JackDingler 10-May-12 17:38pm
So is it 'samples per second' that you wanted?
chaiein 15-May-12 0:57am
'sample per second' works similar to 'beats per second' so 'samples Per second' easy way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 10 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100