Adjust Balance When Playing Audio in C# - c#

Is there a way to adjust the left/right balance when playing a sound in C# using the built in SoundPlayer class? I don't want to adjust the overall system balance, just the balance for the sound the program is playing.

Sound Player a simple lib to play wave files so dont think it has the capability. You can check the AXWindowsMediaPlayer for advance functionality

If you want to stick with SoundPlayer, you can create your Stream-derived class that will wrap around original wave file, but will manipulate sound samples and adjust left and right volume to your liking.

Related

Controlled pitch or frequency shifting in Unity3d

TL;DR - I'm looking for a plugin or technique to pitch shift audio assets precisely.
I'm working on a unity3d project to create a binaural VR music visualizer (why I'm trying). I've created a basic visualizer and the music player components pretty easily with tutorials online but I'd like to find an easy way of frequency shifting audio tracks. This is similar to pitch-shifting, which unity supports via the Audio Pitch Shifter Effect but it's expressed as a multiplier rather then a unit of measure and effects playback speed. However, I need to pitch-shift the audio while maintaining playback rate as the normal audio plays in one ear, and the effected audio plays in the other.
The goal being that I can use a standard slider to decide the frequency of the binaural wave, and relate it to the left and right audio output, and with the VR solution, I can provide similar bi-visual effects at the appropriate frequency in each eye for a more intense effect.
I think I might have found my own solution buried in plugins - but it's much more specific then I would have thought: https://www.assetstore.unity3d.com/en/#!/content/66518
Though I would like to hear anyone else's approach to advanced audio effects like this.

How to make sure all mp3s play at the same volume?

I'm making a music player in Winforms, C#. Some of my mp3s are softer than others.
Is there an easy method to normalize(is that the right word?) all my mp3s, so that no matter which I choose to play, they all play at the same standard volume?

Decrease audio compression rate

Hi I Want to Decrease the Compression rate/Playing Speed of My Audio Tracks in C# Using NAudio class, i.e. I want tracks to play at a slower speed than their original speed.
Previously I was using Windows Media Player object for just this thing and NAudio for everything else, but I want to shift completely to NAudio.
NAudio does not have a built-in feature to do this. When I need to change playback rate, I create a managed wrapper around the SoundTouch dll. I keep meaning to blog about how to do this, but for now, check out the PracticeSharp project which also uses SoundTouch and NAudio.

Show waveform of playing sound

Let's say I want to make a simple application that can play sounds. In WPF, I can use either the MediaPlayer class or the MediaElement class to take care of the playback.
Is it possible to actually extract data from the playing sound in order to draw the playing sound as a waveform (possibly using a charting library)? Something like in the image below. Alternatively, is it possible to at least obtain and display the output volume as we see in the Windows speakers system tray icon (second image below)?

Xact vs AudioContent

I am using XNA to develop a game which requires both sound effects and music. I'm trying to figure out how to implement the sound engine. Microsoft provides the ability to use the Content Pipeline to load and play audio. However, I also seen people use Xact to do the same thing. My question is, whats the difference and what would be the better approach to making a sound engine?
Xact is feature rich but complex to use. It was originally the only way to play sound but people wanted something simpler so Microsoft added the content pipeline method.
Use the Content Pipeline if you want:
To play a sound (2d or 3d)
To not have to invest a lot of time
learning an audio framework
Use Xact if you want:
Categories of sounds that can be
interdependently controlled, like
mute game sounds but not menu sounds
Real time advanced control over sound
pitch, volume. For things like
turrets spinning up, cars
accelerating etc.
To have multiple varieties of a
single sound effect like a seven
different pain sounds and have Xact
choose which one to play.
To have a sound play with slightly
different pitch, volume, filter or 3d
pan every time it is played. This is
really good for bullets and
repetitive things like that. There
is nothing that says fake computer
simulation like a repeating sound
with no variance.
To allow a game designer or sound
designer full control to edit and
change sounds without touching the
code.
To have sound banks (collections of
sound) that you can load or unload as
a group, which can use different
compression settings and can be in
memory or streaming.
To mix the volume, pitch and priority
of sounds in an editor.
To apply filtering to a sound.
To control whether the sound is
looping or not.
To use DSP Effects
One of my favourite things about Xact is editing and previewing of sound functions in editor. For example a volume fade on a turret overheat sound. With XACT you can sit down with the sound designer, even if he's not a technical guy and edit the control curves until he's happy with the sound. Once you've set it up it's really easy to change later on. In this example image here a turret is overheated. At the end of the overheat cycle the hissing steam noise volume is reduced, but because it's a curve I have a lot of control over how the sound fades out. I've used this with a beam weapon as well, dropping the frequency according to a curve as it runs out of ammo.

Categories

Resources