audio-utils
Advanced tools
Comparing version 0.0.10 to 1.0.0
{ | ||
"name": "audio-utils", | ||
"version": "0.0.10", | ||
"version": "1.0.0", | ||
"description": "Audio utilities like fundamental frequency detection, populate buffer with sinusoidal curves", | ||
"main": "src/audio_utils.js", | ||
"scripts": { | ||
"test": "make" | ||
"test": "node test/test_audio_utils.js" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
audio-utils | ||
=========== | ||
Audio utilities like fundamental frequency detection, populate bufer with sinusoidal curves | ||
Audio utilities like fundamental frequency detection, populate buffer with sinusoidal curves | ||
module.exports.audio_utils = function(environment_mode) { // functional inheritance Crockford 2008 pg 52 | ||
// module.exports.audio_utils = function() { | ||
/* | ||
Audio utilities like fundamental frequency detection, populate bufer with sinusoidal curves | ||
// Audio utilities like fundamental frequency detection, populate buffer with sinusoidal curves | ||
*/ | ||
var shared_utils = require("shared-utils"); | ||
var path = require('path'); | ||
function resolvePath(str) { | ||
if (str.substr(0, 2) === '~/') { | ||
str = (process.env.HOME || process.env.HOMEPATH || process.env.HOMEDIR || process.cwd()) + str.substr(1); | ||
} | ||
return path.resolve(str); | ||
} | ||
// -------------------------------------------------------- // | ||
console.log("do_clustering .... environment_mode ", environment_mode); | ||
var that = {}; | ||
var shared_utils; | ||
switch (environment_mode) { | ||
case "nubia": // repository owner tinkering mode - ignore it and use nothing which defaults to dev which is OK | ||
var local_github_parent = process.env.GITHUB_REPO_PARENT; | ||
if ( ! local_github_parent ) { | ||
console.error("ERROR - do not use environment_mode value of :", environment_mode, | ||
" instead use dev or leave blank"); | ||
process.exit(8); | ||
} | ||
shared_utils = require(resolvePath(local_github_parent + "shared-utils/src/node_utils")); | ||
break; | ||
case "dev": | ||
shared_utils = require("shared-utils"); // get these modules from global install | ||
break; | ||
default : | ||
shared_utils = require("shared-utils"); | ||
break; | ||
}; | ||
// --- | ||
@@ -270,6 +228,4 @@ | ||
}; // play_detect_frequency | ||
exports.play_detect_frequency = play_detect_frequency; | ||
that.play_detect_frequency = play_detect_frequency; | ||
// --- | ||
@@ -451,5 +407,4 @@ | ||
}; // detect_fundamental_frequency | ||
exports.detect_fundamental_frequency = detect_fundamental_frequency; | ||
that.detect_fundamental_frequency = detect_fundamental_frequency; | ||
// ------------------------------------------------------------------------ // | ||
@@ -461,6 +416,5 @@ | ||
value add of how this populates buffer with sinusoidal curve is the | ||
curve is assured to both start and stop at the zero cross over threshold, | ||
output sinusoidal curve is assured to both start and stop at the zero cross over threshold, | ||
independent of supplied input parms which control samples per cycle and buffer size. | ||
This avoids that "pop" which otherwise happens when rendering audio curve | ||
This avoids that "pop" which otherwise happens when rendering audio curves | ||
which begins at say 0.5 of a possible range -1 to 0 to +1 | ||
@@ -536,6 +490,3 @@ | ||
that.pop_audio_buffer = pop_audio_buffer; | ||
exports.pop_audio_buffer = pop_audio_buffer; | ||
return that; | ||
}; |
#!/usr/bin/env node | ||
var environment_mode = process.argv[2] || "dev"; | ||
console.warn("running code in environment_mode: ", environment_mode); | ||
// --- | ||
var audio_util_obj = require("../src/audio_utils"); | ||
// var audio_util_obj = require("../src/audio_utils"); | ||
// var audio_utils = audio_util_obj.audio_utils(); | ||
var audio_utils = audio_util_obj.audio_utils(environment_mode); | ||
var audio_utils = require("../src/audio_utils"); | ||
console.log("audio_utils ", audio_utils); | ||
@@ -28,28 +24,4 @@ | ||
var shared_utils; | ||
var shared_utils = require("shared-utils"); | ||
switch (environment_mode) { | ||
case "nubia": // repository owner tinkering mode - ignore it and use nothing which defaults to dev which is OK | ||
var local_github_parent = process.env.GITHUB_REPO_PARENT; | ||
if ( ! local_github_parent ) { | ||
console.error("ERROR - do not use environment_mode value of :", environment_mode, | ||
" instead use dev or leave blank"); | ||
process.exit(8); | ||
} | ||
shared_utils = require(resolvePath(local_github_parent + "shared-utils/src/node_utils")); | ||
break; | ||
case "dev": | ||
shared_utils = require("shared-utils"); // get these modules from global install | ||
break; | ||
default : | ||
shared_utils = require("shared-utils"); | ||
break; | ||
}; | ||
// ------------------------------------- // | ||
@@ -122,4 +94,11 @@ | ||
shared_utils.write_32_bit_float_buffer_to_16_bit_wav_file(source_obj, source_wave_filename); | ||
// shared_utils.write_32_bit_float_buffer_to_16_bit_wav_file(source_obj, source_wave_filename); | ||
shared_utils.write_32_bit_float_buffer_to_16_bit_wav_file(source_obj, source_wave_filename); | ||
// var read_wav_file = function(input_filename, cb_read_file_done) { | ||
console.log("source_wave_filename ", source_wave_filename); | ||
@@ -144,2 +123,3 @@ | ||
/* | ||
shared_utils.read_16_bit_wav_file_into_32_bit_float_buffer( | ||
@@ -150,3 +130,8 @@ wav_file_input_obj, | ||
cb_read_file_done); | ||
*/ | ||
shared_utils.read_wav_file(wav_file_input_obj.filename, cb_read_file_done); | ||
}; // synth_curve_write_to_wav_file_then_read_back | ||
@@ -153,0 +138,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
64222
10
0
8
5
497