From ea6e6ee1040fa85f743ab50b699fbeb04d9a0522 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 20 Mar 2018 23:35:18 +0100 Subject: scripts --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 9c17115..3bb05ff 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,11 @@ ENV/ *~ *.swp *.swo + +*.wav +*.mp3 +*.aif +*.aiff + +results/ + -- cgit v1.2.3-70-g09d2 From 6fe185e50393f57aa7125bb83866aeb96cb88c92 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 9 Apr 2018 07:39:22 +0200 Subject: including results scripts --- .gitignore | 5 +- results/crossfade_cat.sh | 129 +++++++++++++++++++++++++++++++++++++++++++++++ results/loop.sh | 20 ++++++++ results/xfade.sh | 25 +++++++++ 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100755 results/crossfade_cat.sh create mode 100755 results/loop.sh create mode 100755 results/xfade.sh (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 3bb05ff..c14acc1 100644 --- a/.gitignore +++ b/.gitignore @@ -98,5 +98,8 @@ ENV/ *.aif *.aiff -results/ +results/exp* +!results/*.sh + +run_here.sh diff --git a/results/crossfade_cat.sh b/results/crossfade_cat.sh new file mode 100755 index 0000000..13a8e90 --- /dev/null +++ b/results/crossfade_cat.sh @@ -0,0 +1,129 @@ +#!/bin/bash +# +# crossfade_cat.sh +# +# Concatenates two files together with a crossfade of $1 seconds. +# Filenames are specified as $2 and $3. +# +# $4 is optional and specifies if a fadeout should be performed on +# first file. +# $5 is optional and specifies if a fadein should be performed on +# second file. +# +# Example: crossfade_cat.sh 10 infile1.wav infile2.wav auto auto +# +# By default, the script attempts to guess if the audio files +# already have a fadein/out on them or if they just have really +# low volumes that won't cause clipping when mixxing. If this +# is not detected then the script will perform a fade in/out to +# prevent clipping. +# +# The user may specify "yes" or "no" to force the fade in/out +# to occur. They can also specify "auto" which is the default. +# +# Crossfaded file is created as "mix.wav". +# +# Original script from Kester Clegg. Mods by Chris Bagwell to show +# more examples of sox features. +# + +SOX=sox +SOXI=soxi + +if [ "$3" == "" ]; then + echo "Usage: $0 crossfade_seconds first_file second_file [ fadeout ] [ fadein ]" + echo + echo "If a fadeout or fadein is not desired then specify \"no\" for that option. \"yes\" will force a fade and \"auto\" will try to detect if a fade should occur." + echo + echo "Example: $0 10 infile1.wav infile2.wav auto auto" + exit 1 +fi + +fade_length=$1 +first_file=$2 +second_file=$3 + +fade_first="auto" +if [ "$4" != "" ]; then + fade_first=$4 +fi + +fade_second="auto" +if [ "$5" != "" ]; then + fade_second=$5 +fi + +fade_first_opts= +if [ "$fade_first" != "no" ]; then + fade_first_opts="fade t 0 0:0:$fade_length 0:0:$fade_length" +fi + +fade_second_opts= +if [ "$fade_second" != "no" ]; then + fade_second_opts="fade t 0:0:$fade_length" +fi + +echo "crossfade and concatenate files" +echo +echo "Finding length of $first_file..." +first_length=`$SOX "$first_file" 2>&1 -n stat | grep Length | cut -d : -f 2 | cut -f 1` +echo "Length is $first_length seconds" + +trim_length=`echo "$first_length - $fade_length" | bc` + +# Get crossfade section from first file and optionally do the fade out +echo "Obtaining $fade_length seconds of fade out portion from $first_file..." +$SOX "$first_file" -e signed-integer -b 16 fadeout1.wav trim $trim_length + +# When user specifies "auto" try to guess if a fadeout is needed. +# "RMS amplitude" from the stat effect is effectively an average +# value of samples for the whole fade length file. If it seems +# quite then assume a fadeout has already been done. An RMS value +# of 0.1 was just obtained from trail and error. +if [ "$fade_first" == "auto" ]; then + RMS=`$SOX fadeout1.wav 2>&1 -n stat | grep RMS | grep amplitude | cut -d : -f 2 | cut -f 1` + should_fade=`echo "$RMS > 0.1" | bc` + if [ $should_fade == 0 ]; then + echo "Auto mode decided not to fadeout with RMS of $RMS" + fade_first_opts="" + else + echo "Auto mode will fadeout" + fi +fi + +$SOX fadeout1.wav fadeout2.wav $fade_first_opts + +# Get the crossfade section from the second file and optionally do the fade in +echo "Obtaining $fade_length seconds of fade in portion from $second_file..." +$SOX "$second_file" -e signed-integer -b 16 fadein1.wav trim 0 $fade_length + +# For auto, do similar thing as for fadeout. +if [ "$fade_second" == "auto" ]; then + RMS=`$SOX fadein1.wav 2>&1 -n stat | grep RMS | grep amplitude | cut -d : -f 2 | cut -f 1` + should_fade=`echo "$RMS > 0.1" | bc` + if [ $should_fade == 0 ]; then + echo "Auto mode decided not to fadein with RMS of $RMS" + fade_second_opts="" + else + echo "Auto mode will fadein" + fi +fi + +$SOX fadein1.wav fadein2.wav $fade_second_opts + +# Mix the crossfade files together at full volume +echo "Crossfading..." +$SOX -m -v 1.0 fadeout2.wav -v 1.0 fadein2.wav crossfade.wav + +echo "Trimming off crossfade sections from original files..." + +$SOX "$first_file" -e signed-integer -b 16 song1.wav trim 0 $trim_length +$SOX "$second_file" -e signed-integer -b 16 song2.wav trim $fade_length +$SOX song1.wav crossfade.wav song2.wav mix.wav + +echo -e "Removing temporary files...\n" +rm fadeout1.wav fadeout2.wav fadein1.wav fadein2.wav crossfade.wav song1.wav song2.wav +mins=`echo "$trim_length / 60" | bc` +secs=`echo "$trim_length % 60" | bc` +echo "The crossfade in mix.wav occurs at around $mins mins $secs secs" + diff --git a/results/loop.sh b/results/loop.sh new file mode 100755 index 0000000..beb1286 --- /dev/null +++ b/results/loop.sh @@ -0,0 +1,20 @@ +rm fades.txt +rm files.txt +rm mix.sh + +ITER=0 +NEXT=1 +for i in `ls -v *.wav` +do +echo "[0$ITER][$NEXT]acrossfade=ns=5:o=1:c1=tri:c2=tri[0$NEXT];" >> fades.txt +printf '\-i %s ' $i >> files.txt +ITER=$(expr $ITER + 1) +NEXT=$(expr $NEXT + 1) +done + +printf "ffmpeg " >> mix.sh +cat files.txt >> mix.sh +printf " -filter_complex \"" >> mix.sh +cat fades.txt >> mix.sh +echo '\" out.wav' >> mix.sh + diff --git a/results/xfade.sh b/results/xfade.sh new file mode 100755 index 0000000..9fc4d39 --- /dev/null +++ b/results/xfade.sh @@ -0,0 +1,25 @@ +crossfade_dur=1 +i=0 +limit=10000 + +for file in `ls *.wav | sort -V` +do + i=$((i+1)) + if [ $i -eq $limit ] + then + break + fi + + if [ $i -eq 1 ] + then + cp $file mix.wav + else + # ../../crossfade_cat.sh $crossfade_dur mix.wav $file yes yes + echo $file + sox $file tmp.wav highpass 10 + sox mix.wav tmp.wav out.wav splice $(soxi -D mix.wav),0.01 + mv out.wav mix.wav + rm tmp.wav + fi +done + -- cgit v1.2.3-70-g09d2 From e604b502db345110ea9b2780682c2baaeb7a73c9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 9 Apr 2018 08:44:40 +0200 Subject: node stuff --- .gitignore | 3 + package-lock.json | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 21 +++ upload.js | 38 ++++++ 4 files changed, 453 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 upload.js (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index c14acc1..836c30d 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,6 @@ results/exp* run_here.sh +.env + +node_modules/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..cefb77b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,391 @@ +{ + "name": "samplernn", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.2.1" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.1" + } + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "dotenv": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz", + "integrity": "sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" + } + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.14.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "request": { + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.7.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.2.1" + } + }, + "sshpk": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..838862f --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "samplernn", + "version": "1.0.0", + "description": "samplernn", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git@asdf.us:samplernn.git" + }, + "author": "jules ", + "license": "UNLICENSED", + "private": true, + "dependencies": { + "dotenv": "^5.0.1", + "minimist": "^1.2.0", + "request": "^2.85.0" + } +} diff --git a/upload.js b/upload.js new file mode 100644 index 0000000..1cdcba8 --- /dev/null +++ b/upload.js @@ -0,0 +1,38 @@ +#!`which node` + +require('dotenv').load(); +var request = require('request') +var path = require('path') +var fs = require('fs') +var argv = require('minimist')(process.argv.slice(2)); + +var request = request.defaults({jar: true}) + +var j = request.jar() +var cookie = request.cookie('bucky.sid=' + process.env.COOKIE) +j.setCookie(cookie, 'https://bucky.asdf.us/'); +var request = request.defaults({jar:j}) + +var id = process.env.THREAD_ID + +console.log(argv) + +if (!argv['_'] || ! argv['_'].length) { + console.error('not enough args!') + process.exit() +} + +var r = request.post('https://bucky.asdf.us/api/thread/' + id + '/comment', function (err, res, body) { + if (err) { + return console.error('upload failed:', err); + } + // console.log(err, res, body) + console.log('Upload successful'); +}) + +var form = r.form() +form.append('comment', '') +form.append('csrf', 'csrf') +argv['_'].forEach(fn => { + form.append('files', fs.createReadStream(path.join(__dirname, fn))) +}) -- cgit v1.2.3-70-g09d2 From 630c245ad0d42ab4a83198c4c04f78feaa1a0428 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 10 Apr 2018 00:41:29 +0200 Subject: ignore runhere scripts --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 836c30d..8ab7957 100644 --- a/.gitignore +++ b/.gitignore @@ -101,8 +101,9 @@ ENV/ results/exp* !results/*.sh -run_here.sh +run_here* .env node_modules/ + -- cgit v1.2.3-70-g09d2 From efe9c4a7f53414c628a865207c6a47f8e5a016f0 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 10 Apr 2018 10:46:12 +0200 Subject: gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 8ab7957..ca60642 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,5 @@ run_here* node_modules/ +results/old_checkpoints/ + -- cgit v1.2.3-70-g09d2 From 33bcbba9cf576bcae3fe72732a373d66af177591 Mon Sep 17 00:00:00 2001 From: jules on spawn Date: Tue, 10 Apr 2018 21:48:43 +0200 Subject: dont put flacs in git --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index ca60642..2ad71be 100644 --- a/.gitignore +++ b/.gitignore @@ -97,6 +97,7 @@ ENV/ *.mp3 *.aif *.aiff +*.flac results/exp* !results/*.sh -- cgit v1.2.3-70-g09d2 From 7287a81b9af14ca8b24f258a2e3de08f39bb63c7 Mon Sep 17 00:00:00 2001 From: jules on spawn Date: Tue, 1 May 2018 03:22:09 +0200 Subject: process script --- .gitignore | 3 ++ datasets/dataset.pl | 4 ++ datasets/silence.sh | 0 latest.pl | 6 +-- process_fns | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 datasets/silence.sh create mode 100755 process_fns (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 2ad71be..26a1d76 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,6 @@ node_modules/ results/old_checkpoints/ +mgb +run_* + diff --git a/datasets/dataset.pl b/datasets/dataset.pl index edde43f..a6eb984 100755 --- a/datasets/dataset.pl +++ b/datasets/dataset.pl @@ -25,6 +25,10 @@ sub process($) { return; } + if ($ext eq 'mp3') { + system('ffmpeg', '-i', $filename, $name . '.wav') + $filename = $name . '.wav'; + } my $soxi = `soxi $filename`; my @lines = split("\n", $soxi); diff --git a/datasets/silence.sh b/datasets/silence.sh new file mode 100644 index 0000000..e69de29 diff --git a/latest.pl b/latest.pl index c09a5cd..ddd5952 100755 --- a/latest.pl +++ b/latest.pl @@ -69,9 +69,9 @@ sub process($){ } $epoch[0] =~ /(\d+)/; - if ($1 < 4) { - return 0; - } + #if ($1 < 4) { + # return 0; + #} if (-e "output/" . $name . ".mp3") { return 1; diff --git a/process_fns b/process_fns new file mode 100755 index 0000000..ad47a28 --- /dev/null +++ b/process_fns @@ -0,0 +1,109 @@ +workon samplernn + +function generate () { + exp_name=$1 + n_samples=$2 + sample_rate=$3 + duration=$4 + let sample_length=$3*$4 + + echo "" + echo "###################################################" + echo "###################################################" + echo "###################################################" + echo "" + echo ">> generating $exp_name" + echo "" + echo "###################################################" + echo "###################################################" + echo "###################################################" + echo "" + python generate.py \ + --exp $exp_name --dataset $exp_name \ + --frame_sizes 8 2 \ + --n_rnn 2 --dim 1024 --q_levels 256 \ + --seq_len 1024 --batch_size 128 \ + --val_frac 0.1 --test_frac 0.1 \ + --sample_rate $sample_rate \ + --sample_length $sample_length \ + --keep_old_checkpoints False \ + --n_samples $n_samples \ + --epoch_limit 1 \ + --resume True + sleep 1 +} +function run () { + exp_name=$1 + epoch_limit=$2 + n_samples=$3 + sample_rate=$4 + duration=$5 + let sample_length=$4*$5 + + echo "" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo "" + echo ">> running $exp_name" + echo "" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo "" + python train.py \ + --exp $exp_name --dataset $exp_name \ + --frame_sizes 8 2 \ + --n_rnn 2 --dim 1024 --q_levels 256 \ + --seq_len 1024 --batch_size 128 \ + --val_frac 0.1 --test_frac 0.1 \ + --sample_rate $sample_rate \ + --sample_length $sample_length \ + --n_samples $n_samples \ + --keep_old_checkpoints False \ + --epoch_limit $epoch_limit \ + --resume True + sleep 1 +} +function standard () { + dataset=$1 + run $1 6 6 44100 5 + ./latest.pl -l $1 +} +function quick () { + dataset=$1 + run $1 4 6 44100 5 + ./latest.pl -l $1 +} +function half () { + dataset=$1 + run $1 2 6 44100 5 + ./latest.pl -l $1 +} +function fast () { + dataset=$1 + run $1 1 6 44100 10 + ./latest.pl -l $1 +} +function emph () { + dataset=$1 + run $1 1 6 44100 10 + run $1 3 6 44100 5 + ./latest.pl -l $1 +} + +function start () { + dataset=$1 + cd datasets/ + perl dataset.pl "${dataset}.wav" + cd .. + quick $dataset +} +function start_standard () { + dataset=$1 + cd datasets/ + perl dataset.pl "${dataset}.wav" + cd .. + standard $dataset +} + -- cgit v1.2.3-70-g09d2