Edit in JSFiddle

<h3>Detect Audio Formats with Modernizr tests (only CSS control)<br/>
<a href="www.aureliomerenda.com/detect-audio-formats-support-modernizr-tests/">www.aureliomerenda.com/detect-audio-formats-support-modernizr-tests/</a></h3>
<br/>
<p class="mp3 ok">Your browser support MP3</p>
<p class="mp3 no">Your browser support MP3</p>

<p class="ogg ok">Your browser support OGG</p>
<p class="ogg no">Your browser don't support OGG</p>

<p class="wav ok">Your browser support WAV</p>
<p class="wav no">Your browser don't support WAV</p>

<p class="m4a ok">Your browser support M4A</p>
<p class="m4a no">Your browser don't support M4A</p>
.ok, .no {
    display: none;
    padding: 2px;
}

.ok {
    background-color: #7DF481;
}

.no {
    background-color: #FE8484;
}

HTML.audiomp3 .mp3.ok { display: block; }
HTML.no-audiomp3 .mp3.no { display: block; }

HTML.audioogg .ogg.ok { display: block; }
HTML.no-audioogg .ogg.no { display: block; }

HTML.audiowav .wav.ok { display: block; }
HTML.no-audiowav .wav.no { display: block; }

HTML.audiom4a .m4a.ok { display: block; }
HTML.no-audiom4a .m4a.no { display: block; }
/****** MODERNIZR TEST *******/

Modernizr.addTest('audiomp3', function(){
     var elem = document.createElement('audio'),
          bool = false;

     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.mp3 = elem.canPlayType('audio/mpeg;').replace(/^no$/,'');
               if(bool.mp3 == "maybe" || bool.mp3 == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }

     return bool;
});


Modernizr.addTest('audioogg', function(){
     var elem = document.createElement('audio'),
          bool = false;

     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
               if(bool.ogg == "maybe" || bool.ogg == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }

     return bool;
});


Modernizr.addTest('audiowav', function(){
     var elem = document.createElement('audio'),
          bool = false;

     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.wav = elem.canPlayType('audio/wav; codecs="1"').replace(/^no$/,'');
               if(bool.wav == "maybe" || bool.wav == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }

     return bool;
});


Modernizr.addTest('audiom4a', function(){
     var elem = document.createElement('audio'),
          bool = false;

     try {
          bool = !!elem.canPlayType;
          if ( bool ) {
               bool = new Boolean(bool);
               bool.m4a = ( elem.canPlayType('audio/x-m4a;') || elem.canPlayType('audio/aac;') ).replace(/^no$/,'');
               if(bool.m4a == "maybe" || bool.m4a == "probably"){
                    bool = true;
               } else {
                    bool = false;
               }
          }
     } catch(e) { }

     return bool;
});