Solved

How to convert a 'mono' signal to a 'stereo' signal?

Posted on 2012-03-28
8
1,581 Views
Last Modified: 2013-11-25
Hey,

      I'm trying to write a program to convert a 'mono' signal to a 'stereo' signal.  I was just wondering what the simplest way to get this done was.

I was hoping to do it in Python, but I would be open to doing it in an other language as well.

Could anyone point me to any tutorials or sample code that could get me started?

Appreciate any help on this!
0
Comment
Question by:errang
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37779321
You can not simply "Convert" a mono input to a stereo output.  The mono signal does not contain any information to "Make" it stereo.
0
 

Author Comment

by:errang
ID: 37779344
Yea, I was wondering if there were any library functions that helped with it.  Rather than manually converting the signal myself.
0
 
LVL 16

Expert Comment

by:gelonida
ID: 37779400
What is your exact intention and what file format are you talking about.

Do you wan to convert a file with only one audio channel into a file with two identical audio channels or do you look for a smart algorithm trying to add some stereo effect?

What file format do you talk about .mp3 / .wav  raw audio format ???

On the command line sox is one of the commands allowing to convert audio file formats but there are many others.

Depening on your needs and your platform (Windows? Linux?)  you can either use python to call one of these scripts or you could install a python library to perform this task.

A few more details will help us to give a better answer.
0
 

Author Comment

by:errang
ID: 37779461
>>Do you wan to convert a file with only one audio channel into a file with two identical audio >>channels or do you look for a smart algorithm trying to add some stereo effect?

>>What file format do you talk about .mp3 / .wav  raw audio format ???

I'm trying to convert a .wav file.  I can't attach the file here because it isn't one of the supported file types.  I'm just trying to produce a file with a stereo signal, I'm guessing something that would change the frequency or changing the phase of the signal would do the trick, right?

>>Depening on your needs and your platform (Windows? Linux?)  you can either use python to call one of these scripts or you could install a python library to perform this task.

I'm running this program on a Macintosh at the moment.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 37779701
Use Audacity to do your audio editing.  http://audacity.sourceforge.net/  Standard practice is to take the mono signal and put a copy of it on both the left and right channels.
0
 

Author Comment

by:errang
ID: 37779912
>>Use Audacity to do your audio editing.  http://audacity.sourceforge.net/  Standard practice is to take the mono signal and put a copy of it on both the left and right channels.

That's not an API, is it? I need to write a program to do that.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 37780512
Then here is some info about WAV file formats:  http://en.wikipedia.org/wiki/WAV  You have to know what bitrate and codec you need to use along with how to construct the headers.  The links at the bottom of the article will have more info.
0
 
LVL 16

Accepted Solution

by:
gelonida earned 250 total points
ID: 37780613
sox is a command line tool if you can compile / install it, you can control it via a python script.

you could use it for example to convert the wav file to a raw audio file, read it in with python, modify values and then with sox  convert the raw format back to wav
What I still don't understand:
Why do you want to create a stereo signal.
Do you want to have a file, that is 'technically speaking' steroe, but has the same signal on the left or on the right side or do you really need different values on the left and right channel.

If yes, for what reason. There's many operations you can do but The reason is why you want to do these operations.

Do you want an audible difference or is just toggling the least significatn bit of one channel enough?
Would a phase shift be enough, or just changing the volume of one channel?

It all depends on the motiviation behind your question.


Python has also a wav module, but it depends on the exact format of the wav file (compression on or off etc. whether the module will be able to read it)

http://docs.python.org/library/wave.html
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now