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.

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:

#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";
	return 0;

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.


Edited by JB Audio: n/a

5 Years
Discussion Span
Last Post by rubberman

This is NOT simple stuff! First, C++ is NOT a scripting language. It is a fairly low-level system programming language with a lot of nuances - the devil being in the details. Second, audio programming like what you say you want to do, is not a simple proposition. My advice? Download the source to an open source audio processing program, such as Audacity, and study the code. From that, you can learn a great deal that will help you achieve your goal, which is in my mind, laudable (if not audible - sic!). Good luck! :-) Anyway, here is a link to Audacity: http://audacity.sourceforge.net/?lang=en

Edited by rubberman: n/a


What you have said has confirmed my worst fears hehe. No wonder audio programmers are in short supply! Anyways I'm downloading the source code now to take a look at it.
But do you think it would be possible to use openAL or FMOD EX to load into a buffer in which I can edit the samples?

I hate that it is easier to do this using javascript and Max/MSP than a programming language. (also thats why I said script originally. sorry, slip of the fingers).


... But do you think it would be possible to use openAL or FMOD EX to load into a buffer in which I can edit the samples?

Sorry, but although I am a proficient C++ programming, audio systems (other than as a musician/user) is not my domain, so I really can't answer that. The main thing about audio processing is that it is an A/D (analog/digital) signal processing problem for the most part - not an area of expertise that I am comfortable with. My work has been mostly with distributed networked systems and discrete machine controls. I understand the theory of audio (and analog) processing pretty well, but I am not a practitioner in that area. Sorry that I can't be more helpful to you.

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.