Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC VC9.0 VC VC++
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 6-May-12 23:24pm
chaiein1.8K
Edited 9-May-12 18:46pm
v3
Comments
Chandrasekharan P at 7-May-12 6:26am
   
Did you try directX tools?
chaiein at 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
good
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'
  Permalink  
Comments
chaiein at 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 at 10-May-12 11:21am
   
Yes, there are, for Midi files.
 
Perhaps you meant midi and not wav?
JackDingler at 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
good
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.
 
http://msdn.microsoft.com/en-us/library/windows/desktop/dd390970%28v=vs.85%29.aspx[^]
 
Please check the following links too:
 
http://stackoverflow.com/questions/939904/changing-speed-of-a-sound-file[^]
 
http://social.msdn.microsoft.com/Forums/en-US/windowspro-audiodevelopment/thread/da25f8cc-30e1-4f78-aa28-e66597b85c62[^]
  Permalink  
Comments
chaiein at 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())
{
m_pFile->SetBitsPerSample(16);
m_SoundOut.Start(m_pFile->GetFormat());
cout(m_pFile->GetBitsPerSample());

 
}</pre>
stib_markc at 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 at 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 at 10-May-12 6:27am
   
i suggest you the best thing to do : www.google.com
Rate this: bad
good
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 http://audacity.sourceforge.net/[^]
  Permalink  
Comments
JackDingler at 10-May-12 17:38pm
   
So is it 'samples per second' that you wanted?
chaiein at 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
0 OriginalGriff 364
1 Nirav Prabtani 268
2 _Amy 185
3 CHill60 170
4 Sergey Alexandrovich Kryukov 166
0 OriginalGriff 8,004
1 Sergey Alexandrovich Kryukov 7,017
2 Maciej Los 4,039
3 Peter Leow 3,738
4 CHill60 2,912


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 10 May 2012
Copyright © CodeProject, 1999-2014
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