Audio Manipulation In C++

Hi all. I hope this is the right place to post this.

I am a music technology student and I've recently picked up learning C++ as it would greatly help my career knowing a programming language, especially this one since it is used in the video games industry.

Anyways onto the main topic. What I want to create is a program (in C++) that lets the user load a 16bit linear PCM WAVE file. Then I want to manipulate the audio sample data within that wave file. I want to either remove every nth sample or randomise them within a certain parameter (±10%). Then write it as a new WAVE file.

I am familier with the structure of WAVE files and the RIFF header. I also at the moment use Xcode as my IDE (since my macbook pro is my work computer), but I can code on my PC if necessary using codeblocks.

Is it possible to do this in Xcode, if at all? What libraries would I need? I hope its simpler than I think it is.

Thankyou for your help and time.

James

EDIT:


So in simple terms it should display something similar to this? I know there are errors in this, just so you get an idea of what I'm after:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using namespace std;

class main()	//function start
{
	string fileinput;	//variable
	string outlocation;	//variable
	
	cout << "please type file path directory: \n \n";
	cin >> fileinput;	//navigate to file by typing
	
	cout << "Where would you like to save new file? \n \n";
	cin >> outlocation;	//select output by typing
	
	// Then all the maths and manipulation is done
	
	cout << "Your file has been created at ";
	cout << outlocation;
	cout << "\n \n";
	
	system("pause");
	
	return 0;
}

Last edited on
Is it okay to bump this? Im still stuck
Firstly, you should include <string> since you have used std::string which is defined in this header. Other than that the code you have is OK, although apparently it's bad to use the system command for portability and security reasons.

Now for the real point. Manipulating audio data will require an external library to load the audio data for you. SFML is a low level media library with an audio component, so you could try that. However using such a library might be considered overkill just to get at WAV data.
I'm not sure what you're asking.

If you're familiar with the structure of wave files, then what's the problem? What are you stuck on?
Topic archived. No new replies allowed.