-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update README to force python2 * add support for PRE_EMPHASIS detection; mark pre-emphasis as FLAGS PRE in .cue * correct typo, s/ivar/type/ for pre_emphasis element in track table * add SoxPeakTask, program/sox module, sox.peak_level() * use sox peak detection in lieu of gstreamer
- Loading branch information
1 parent
3a2e302
commit b2ca316
Showing
4 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import logging | ||
from subprocess import Popen, PIPE | ||
|
||
SOX = 'sox' | ||
|
||
def peak_level(track_path): | ||
if not os.path.exists(track_path): | ||
logging.warning("SoX peak detection failed: file not found") | ||
return None | ||
sox = Popen([SOX, track_path, "-n", "stat"], stderr=PIPE) | ||
out, err = sox.communicate() | ||
if sox.returncode: | ||
logging.warning("SoX peak detection failed: " + s.returncode) | ||
return None | ||
return float(err.split('\n')[3].split()[2]) # Maximum amplitude: 0.123456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters