Bird
0
0

You have a stereo WAV file loaded as a NumPy array with shape (44100, 2). How do you convert it to mono by averaging the two channels?

hard📝 Application Q9 of 15
SciPy - Integration with Scientific Ecosystem
You have a stereo WAV file loaded as a NumPy array with shape (44100, 2). How do you convert it to mono by averaging the two channels?
Amono = data.sum(axis=1)
Bmono = data.mean(axis=0)
Cmono = data.mean(axis=1)
Dmono = data.flatten()
Step-by-Step Solution
Solution:
  1. Step 1: Understand array shape and axis

    Shape (44100, 2) means 44100 samples, 2 channels; axis=1 is channel axis.
  2. Step 2: Average across channels

    Use mean(axis=1) to average left and right channels per sample.
  3. Final Answer:

    mono = data.mean(axis=1) -> Option C
  4. Quick Check:

    Average channels with mean(axis=1) [OK]
Quick Trick: Average channels with mean(axis=1) [OK]
Common Mistakes:
  • Averaging wrong axis
  • Summing instead of averaging
  • Flattening loses channel info

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes