Solved

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

Posted on 2012-03-28
8
1,640 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check to see if file is submitted in correct folder 1 38
Scripting vs. Programming languages 25 166
Need sample Angular apps for study 4 91
Need a good Angular tutorial 5 81
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

831 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