phding / waveform-node Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
do you know how one would go about to draw an svg from the peaks
I've tried loading a 6min WAV and a 6min WebM for the same track, and while in the former case I suppose it could make sense that I'd run out of memory, I run out of memory with nothing else really going on in my script or running on my machine.
Here is my code:
var options = {
numOfSample: 500,
};
waveform.getWaveForm(
fullSourceAudioPath,
options,
function(error, peaks) {
if(error){
console.error(error);
return;
}
// TODO: Do something
}
);
Output:
<--- Last few GCs --->
at[50059:0x103801e00] 24374 ms: Mark-sweep 1395.0 (1413.2) -> 1395.0 (1413.2) MB, 1785.6 / 0.0 ms (+ 0.0 ms in 4 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1978 ms) (average mu = 0.162, current mu = 0.106) allocat[50059:0x103801e00] 26369 ms: Mark-sweep 1398.0 (1416.2) -> 1398.0 (1416.2) MB, 1780.5 / 0.0 ms (+ 0.0 ms in 4 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 1987 ms) (average mu = 0.135, current mu = 0.108) allocat
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x9b6d44841bd]
1: StubFrame [pc: 0x9b6d456b580]
Security context: 0x38208bc9e589 <JSObject>
2: getPeak [0x3820882ae6c1] [<myProjectPath>/node_modules/waveform-node/waveform-node.js:146] [bytecode=0x3820a9b0f0c9 offset=100](this=0x38207f686519 <JSGlobal Object>,waveformType=0,samplesPerPeak=63536,samples=0x3820fa1198c9 <JSArray[31767680]>,streamInfo=0x3820dce83999 <Object map = 0x...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
6: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
7: v8::internal::Heap::AllocateRawWithRetry(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
8: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
9: v8::internal::Factory::NumberToString(v8::internal::Handle<v8::internal::Object>, bool) [/usr/local/bin/node]
10: v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedDoubleElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)4> >::PrependElementIndices(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::FixedArrayBase>, v8::internal::Handle<v8::internal::FixedArray>, v8::internal::GetKeysConversion, v8::internal::PropertyFilter) [/usr/local/bin/node]
11: v8::internal::FastKeyAccumulator::GetKeysFast(v8::internal::GetKeysConversion) [/usr/local/bin/node]
12: v8::internal::FastKeyAccumulator::GetKeys(v8::internal::GetKeysConversion) [/usr/local/bin/node]
13: v8::internal::Runtime_ForInEnumerate(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x9b6d44841bd
.svscripts/bin/generate_media.sh: line 2: 50059 Abort trap: 6 "${BASH_SOURCE%/*}/../encoder/encode.js" "$@"
$ ./index.js
child_process.js:381
throw new TypeError('"file" argument must be a non-empty string');
^
TypeError: "file" argument must be a non-empty string
at normalizeSpawnArguments (child_process.js:381:11)
at exports.spawn (child_process.js:494:38)
at getDataFromFFMpeg (/tmp/1/node_modules/waveform-node/waveform-node.js:47:22)
at Object.exports.getWaveForm (/tmp/1/node_modules/waveform-node/waveform-node.js:215:2)
at Object.<anonymous> (/tmp/1/index.js:6:10)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
and, if provide an option call .toPrecision() on each peak would be great, so the data would be smaller when save to database
BTW, you did great work! thanks for your code
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.