Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to control where a sound is going to be heard, in the left

For example, when I import an mp3 file, and I want to hear it only from the left ear, what should I do?

I've never worked with sounds before, so I didn't know where to start. The Documentation Center seems very undocumented on this topic.

share|improve this question
1  
MMA does not have native mp3 import. You'll need to convert it into a supported format, then import, and you can then manipulate it. –  rasher Feb 22 at 10:53
    
And can't the mp3 be converted inside MMA? Also, what formats are you talking about? –  Arcotick Feb 22 at 10:57
1  
You could, I suppose, convert it in MMA, but there are far easier ways, including open-source. Search the doc. center for "sound", see the "sound and sonification", "the representation of sound", "audio formats", and the tutorials therein. –  rasher Feb 22 at 11:01
2  
The supported formats for sound import are here –  Simon Woods Feb 22 at 13:04
    
@Arcotick so if you solve the issue with the supported formats, do I understand you correctly, that you want then extract just a channel from that stereo sound? for instance left channel is voice and right channel guitar. you want to extract the voice channel into a mono? –  Stefan Feb 22 at 14:55

1 Answer 1

up vote 7 down vote accepted

The first step is to convert the sounds to one of the supported formats. I recommend WAV or FLAC. Then you can Import it. You'll get an expression of the form

Sound[SampledSoundList[{leftChannel, rightChannel}, sampleRate]]

where rightChannel and leftChannel are numerical lists of amplitudes.

Generally, if you want to hear the sound from just the left speaker, you need to create an all-zero amplitude list of the same length for the right channel too.

For example, after extracting data from the above expression, you can re-create it as

Sound[SampledSoundList[{leftChannel, 0*rightChannel}, sampleRate]]

to mute the right channel.

share|improve this answer
    
i thought more of something like: Sound[SampledSoundList[sound[[1, 1, channel]], sample_freq]]. totally overseeing the muting effect by multiplying with zero ;) –  Stefan Feb 22 at 18:46
    
@Stefan Yours is the way to go to extract one channel. But as I understood the question the OP wanted the sound to come only from the left channel and not the right one, hence the need for an all-zero right channel. –  Szabolcs Feb 22 at 23:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.