0

According to comments of my previous question, I was too broad. So, I'll try to ask specifics questions.

Context

I want to develop with C++ a very very simple version of the software "Audacity"; in other words a software usefull for manipulating audio files with a graphical user interface. For example, I would like to select an extract of a sound A (start-end point - between XX:XX and YY:YY) then cut/copy it and then paste in another sound B (at ZZ:ZZ), mix two or more sounds, etc.

What I've found

Don't hesitate to correct me if a point is wrong.

Firstly, I think I'll use Qt to make the graphical user interface. I've seen that Qt can also manage audio files BUT, I feel that it can't really manipulate them (cut/paste, mix, ...).

I don't know exactly how an audio file works, and manipulating them can also be complex because of multiple formats, bitrates, sounds mixing... So, I've searched a library to facilitate manipulation and I've found FMOD Ex API.

Then, I've read documentation included with the installation and I've found some answers... and some questions.

  • Record from microphone

It's possible with System::recordStart and some other methods.

  • Play song on speakers

It's possible and it's the default ouput : System::playSound.

  • Play multiple sounds simultaneously

I've seen that it can be done with multiple Channel : we begin by init a System object with several channels and then, we can play several music : for each one, we call System::createSound and then System::playSound. We also need to update with System::update.

  • Save a sound

It's the same way that playing a song : System::playSound. We juste have to change output before with System::setOutput(FMOD_OUTPUTTYPE_WAVWRITER).

  • Save a mix of multiple sounds

I think we juste have to set the correct ouput (wav writer) and then do "Play multiple sounds simultaneously" step described before.

  • Change volume

It's possible thanks to Channel's method (setVolume).

Questions

  • Play / Mix multiple sounds

Is that the solution described before is correct ?

  • Play / Mix multiple sounds : don't start all sounds at the same time

As you can see on this multitracks screen, we can have multiple sounds and they can start at differents times. For example, how can I start playing FILE B six seconds after the begining of FILE A (which also continue to play) ? Is it the function Channel->setDelay ? How it works ? (I'm not sure to understand the DSP clock value...).

  • Select an extract (start-end point - between XX:XX and YY:YY)

I'm not sure about this point, maybe we can use Channel:setPosition and/or Channel->setDelay ? But, how it works ? (I'm not sure to understand the value of position and the DSP clock value for delay...).

  • Cut/Copy/Paste

Here, I really don't know how I can do it.

  • Qt and audio files

Do you agree that I can't use Qt to do all this manipulation ?

Thanks

I hope I'm clear. Don't hesitate if you don't understand a question.

voidcome
  • 41
  • 2

1 Answers1

0

I'm not familiar with Qt. My experience is with Java. Even so, I might be able to contribute a couple ideas. As far as the mixing audio is concerned, and dealing with multiple formats, I think the best path is to plan to convert all the contributing sound files to PCM values (ranging from -1 to 1) of a chosen frame rate. The values can be floats or doubles. (I actually used ints in my Java mixer though shorts would suffice for 16-bit encoding.)

Then, it is not so difficult to numerically add the corresponding (in time) values from each track for mixing, or do other forms of manipulation. The result is then converted back to the particular format needed for whatever you are using for playback, e.g., 16-bit 44100 fpm stereo for "CD quality". Having a single format for all the data also helps with making your graphical interface tools and displays.

This entry was meant to contribute to your solution, not be a complete solution to your question.

Phil Freihofner
  • 7,645
  • 1
  • 20
  • 41
  • My goal is not to do myself the manipulation, but thanks for your suggestion. Even so, it's interesting and I'll take a look at this. – voidcome Mar 18 '14 at 23:23