Solved

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

Posted on 2012-03-28
8
1,735 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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
 
LVL 83

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 83

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

730 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