pMusic sound processing


The sound processing in pMusic contains options to manipulate both the input and the output sound stream. It's handy to understand this difference to get the best possible effect on your tuning.


Output sound processing

The output sound processing is done after the stream has left the pMusic play-engine. So, it will only affect the Linux sound driver (Alsa). This is a smooth processing, and most often the recommended choice. The downside is that it will affect the sound output of all other apps using the Alsa driver, and does not have all the capabilities of the input processing.

pMusic offers a basic Volume and Balance controller. The Volume slider will work for mono as well as stereo, but the Balance does of course require a stereo channel. The default channel is Master, and this is most often a mono channel, and does not support different level for left and right speaker. You must specify correct channel for your system to get mixer volume to work as a balance controller. This is done in the preferences. Menu->File->Preferences. (See image below). There is also a mute-button in this basic sound processing module.

In addition, the output sound processing includes the equalizer embedded from pEqualizer. This is a frontend to alsaequal made by 01micko. This gives easy access to tuning the sound fitting your speakers and ears. Be aware that you can save your equalizer settings to a preset for later use. Check out the pEqualizer manual



When the equalizer is installed on your system, all sound is ported through it. Even if choosing the Flat preset the sound is filtered. It does not have a true bypass. If you are one of those wanting the raw output, the solution is to avoid using auto as your defined soundcard. This is the default setting, and to be changed in the preferences. Note that by setting the soundcard you also bound the Alsa driver to pMusic. This means other programs will not play audio as long as pMusic is active. On the other hand, pMusic will not play if sound driver is in use by other program.




Input sound processing

The input processing is tweaking the sound stream going into pMusic, so this gives more options to manipulate the streams structure (ie. tempo and fading). The downside of input processing is that it has to reload the stream setup, and it will give a tick/pause when changing the values.



Technical:
The input processing is put inside the generated playing command to the exec-file: $HOME/.pmusic/tmp/exec (check out the backend monitor plugin).
ffmpeg -i "/mnt/sdb1/musikk/mp3/Yngwie Malmsteen - Mistreated.mp3" -ss 134 -af "volume=2,treble=gain=3,bass=gain=-7" -f rtp rtp://127.0.0.1:1234 -ss 134 -af "volume=2,treble=gain=3,bass=gain=-7" -f au - 2>> /root/.pmusic/tmp/ffmpeg_output | aplay  2> /root/.pmusic/tmp/aplay_error
It is the -af (audiofilter) switch that defines the input sound processing, and we see here that volume is increased by 2dB, treble by 3dB while bass is decreased by 7dB. The -af values is grabbed from:
$HOME/.pmusic/tmp/ffmpeg_filter - for internal use
$HOME/.pmusic/tmp/ffmpeg_filter_basic - for plugin
$HOME/.pmusic/tmp/ffmpeg_filter_EQ - for plugin
So, the infrastructure are ready to test out your new sound processing plugin. If you want to look into how pMusic uses ffmpeg as its play engine it is described in the blogpost ffmpeg - the multimedia hub.



Manipulate Export files

The gui-module for input processing is also used when exporting files in the playqueue. This gives the abilities to convert the stream more radically than just changing the format. Since this is the same gui-module, all values stays active also when exporting the tracks. To avoid your exported files to be changed, keep the Bypass switch on.




Input volume / Normalize

Increasing the input volume should be used by caution, as it could give distortion to the sound. To optimize the input volume level, use the Normalizer. The normalizer will unify volume of all tracks, but never increase volume more than to a level without distortion. This is handy when your tracks comes from different sources, since the recording level was probably not the same. The normalizer uses resources on the volume calculation, and depending on your system, it will give a small gap before playing.

The output volume will not distort.

Posted on 27 Sep 2016, 07:48 by zigbert - Categories: Development
Edit - Delete


Comments:

Posted on 18 Jun 2016, 02:59 by jamesb
"Like this post"
This is excellent insight into how pMusic works, as well as revelation of its secret sauce of making use of advanced ffmpeg features. Thank you for sharing.
Delete



Add Comment

Title
Author
 
Content
Show Smilies
Security Code 1274598
The Puppy Linux mascot?
Password (to protect your identity)