當前位置: 首頁>>代碼示例>>PHP>>正文


PHP getid3_lib::RGADamplitude2dB方法代碼示例

本文整理匯總了PHP中getid3_lib::RGADamplitude2dB方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::RGADamplitude2dB方法的具體用法?PHP getid3_lib::RGADamplitude2dB怎麽用?PHP getid3_lib::RGADamplitude2dB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在getid3_lib的用法示例。


在下文中一共展示了getid3_lib::RGADamplitude2dB方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: decodeMPEGaudioHeader


//.........這裏部分代碼省略.........
                     $thisfile_mpeg_audio_lame['raw'] = array();
                     $thisfile_mpeg_audio_lame_raw =& $thisfile_mpeg_audio_lame['raw'];
                     // byte $9B  VBR Quality
                     // This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications.
                     // Actually overwrites original Xing bytes
                     unset($thisfile_mpeg_audio['VBR_scale']);
                     $thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9b, 1));
                     // bytes $9C-$A4  Encoder short VersionString
                     $thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9c, 9);
                     // byte $A5  Info Tag revision + VBR method
                     $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xa5, 1));
                     $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xf0) >> 4;
                     $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0xf;
                     $thisfile_mpeg_audio_lame['vbr_method'] = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']);
                     $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3);
                     // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr'
                     // byte $A6  Lowpass filter value
                     $thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xa6, 1)) * 100;
                     // bytes $A7-$AE  Replay Gain
                     // http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
                     // bytes $A7-$AA : 32 bit floating point "Peak signal amplitude"
                     if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') {
                         // LAME 3.94a16 and later - 9.23 fixed point
                         // ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375
                         $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (double) (getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xa7, 4)) / 8388608);
                     } else {
                         // LAME 3.94a15 and earlier - 32-bit floating point
                         // Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15
                         $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xa7, 4));
                     }
                     if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) {
                         unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
                     } else {
                         $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
                     }
                     $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xab, 2));
                     $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xad, 2));
                     if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) {
                         $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xe000) >> 13;
                         $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1c00) >> 10;
                         $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x200) >> 9;
                         $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1ff;
                         $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']);
                         $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']);
                         $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']);
                         if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
                             $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
                         }
                         $info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator'];
                         $info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db'];
                     } else {
                         unset($thisfile_mpeg_audio_lame_RGAD['track']);
                     }
                     if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) {
                         $thisfile_mpeg_audio_lame_RGAD_album['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xe000) >> 13;
                         $thisfile_mpeg_audio_lame_RGAD_album['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1c00) >> 10;
                         $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x200) >> 9;
                         $thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1ff;
                         $thisfile_mpeg_audio_lame_RGAD_album['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']);
                         $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']);
                         $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']);
                         if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
                             $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
                         }
                         $info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator'];
                         $info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db'];
開發者ID:rauldobrota,項目名稱:zenphoto,代碼行數:67,代碼來源:module.audio.mp3.php

示例2: CalculateReplayGain

 function CalculateReplayGain()
 {
     if (isset($this->info['replay_gain'])) {
         $this->info['replay_gain']['reference_volume'] = 89;
         if (isset($this->info['replay_gain']['track']['adjustment'])) {
             $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment'];
         }
         if (isset($this->info['replay_gain']['album']['adjustment'])) {
             $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment'];
         }
         if (isset($this->info['replay_gain']['track']['peak'])) {
             $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']);
         }
         if (isset($this->info['replay_gain']['album']['peak'])) {
             $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']);
         }
     }
     return true;
 }
開發者ID:omalettie,項目名稱:PHP-Streaming-Audio,代碼行數:19,代碼來源:getid3.php

示例3: heavyCompression

 public static function heavyCompression($compre)
 {
     // The first four bits indicate gain changes in 6.02dB increments which can be
     // implemented with an arithmetic shift operation. The following four bits
     // indicate linear gain changes, and require a 5-bit multiply.
     // We will represent the two 4-bit fields of compr as follows:
     //   X0 X1 X2 X3 . Y4 Y5 Y6 Y7
     // The meaning of the X values is most simply described by considering X to represent a 4-bit
     // signed integer with values from -8 to +7. The gain indicated by X is then (X + 1) * 6.02 dB. The
     // following table shows this in detail.
     // Meaning of 4 msb of compr
     //  7    +48.16 dB
     //  6    +42.14 dB
     //  5    +36.12 dB
     //  4    +30.10 dB
     //  3    +24.08 dB
     //  2    +18.06 dB
     //  1    +12.04 dB
     //  0     +6.02 dB
     // -1         0 dB
     // -2     -6.02 dB
     // -3    -12.04 dB
     // -4    -18.06 dB
     // -5    -24.08 dB
     // -6    -30.10 dB
     // -7    -36.12 dB
     // -8    -42.14 dB
     $fourbit = str_pad(decbin(($compre & 0xf0) >> 4), 4, '0', STR_PAD_LEFT);
     if ($fourbit[0] == '1') {
         $log_gain = -8 + bindec(substr($fourbit, 1));
     } else {
         $log_gain = bindec(substr($fourbit, 1));
     }
     $log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2);
     // The value of Y is a linear representation of a gain change of up to -6 dB. Y is considered to
     // be an unsigned fractional integer, with a leading value of 1, or: 0.1 Y4 Y5 Y6 Y7 (base 2). Y can
     // represent values between 0.111112 (or 31/32) and 0.100002 (or 1/2). Thus, Y can represent gain
     // changes from -0.28 dB to -6.02 dB.
     $lin_gain = (16 + ($compre & 0xf)) / 32;
     // The combination of X and Y values allows compr to indicate gain changes from
     //  48.16 - 0.28 = +47.89 dB, to
     // -42.14 - 6.02 = -48.16 dB.
     return $log_gain - $lin_gain;
 }
開發者ID:richardbota,項目名稱:WordPress-Theme-Development-with-Bootstrap,代碼行數:44,代碼來源:module.audio.ac3.php


注:本文中的getid3_lib::RGADamplitude2dB方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。