Solved

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

Posted on 2012-03-28
8
1,612 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groovy example issue 10 90
Groovy:unable to resolve class error 2 69
wipe a usb using python 5 29
Manually install and use a Python module (no root access) 1 3
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article will show, step by step, how to integrate R code into a R Sweave document
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.
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.

911 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

23 Experts available now in Live!

Get 1:1 Help Now