tonistiigi / audiosprite Goto Github PK
View Code? Open in Web Editor NEWJukebox/Howler/CreateJS compatible audio sprite generator
License: MIT License
Jukebox/Howler/CreateJS compatible audio sprite generator
License: MIT License
I tried to create an audiosprite for my game. But audiosprite always fail with the same error.
stefans-mbp:sounds stefansvebeck$ sudo audiosprite --log debug *.mp3
debug: Parsed arguments _=[bk_between_questions.mp3, bk_dialog_1.mp3, bk_dialog_2.mp3, bk_final_round.mp3, bk_main_1.mp3, bk_main_2.mp3, bk_question.mp3, ch_ming.mp3, ch_nemi.mp3, ch_rosanna.mp3, ch_simon.mp3, fx_after_question.mp3, fx_before_question.mp3, fx_bladlusen.mp3, fx_bladlusen_short.mp3, fx_click.mp3, fx_liv.mp3, fx_liv_short.mp3, fx_pr.mp3, fx_right.mp3, fx_right_short.mp3, fx_round_new.mp3, fx_wrong.mp3, fx_wrong_scary.mp3], log=debug, l=debug, output=output, o=output, path=, u=, export=ogg,m4a,mp3,ac3, e=ogg,m4a,mp3,ac3, format=default, f=default, autoplay=null, a=null, silence=0, s=0, gap=1, g=1, minlength=0, m=0, samplerate=44100, r=44100, channels=1, c=1, rawparts=, p=, $0=node /usr/local/bin/audiosprite
debug: Created temporary file file=/tmp/audiosprite.24839226342737675
debug: Spawn cmd=ffmpeg -version
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
Goldfire's Howler seems to be the best option nowadays for playing audio in web pages, and it supports Audio Sprites: https://github.com/goldfire/howler.js
It would be really nice to have an option to generate Howler conf in addition to jukebox.
I have a question about an error, and two small additional questions:
Thanks very much.
$ audiosprite -s 2 -o combo1 'AARON GERVAIS (LOUIS CK AM SPINRADE).mp3' 'ALICIA WALTER (REAL TALK).mp3 BIRTHMARK' '(LOVE POWER).mp3'
info: Silence gap added duration=3
info: 0=AARON GERVAIS (LOUIS CK AM SPINRADE).mp3
info: File added OK file=/var/folders/qq/wjmnhkns4vjb1r77hqv2f1pr0000gn/T/audiosprite.14227197977886363, duration=155.37632653061223
info: Silence gap added duration=1.623673469387768
error: Error: Error exporting file
at /usr/local/lib/node_modules/audiosprite/audiosprite.js:312:27
at /usr/local/lib/node_modules/audiosprite/node_modules/async/lib/async.js:148:21
at ChildProcess. (/usr/local/lib/node_modules/audiosprite/audiosprite.js:190:18)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
Im trying to export an ogg using single channel, but it breaks on the following command :
debug: Start export format=ogg
debug: Spawn cmd=ffmpeg -y -ar 22050 -ac 1 -f s16le -i /var/folders/2g/mnz3cs295mx9hrx7l9y3c3640000gp/T/audiosprite.3490381531883031 -acodec libvorbis -f ogg -ab 128k baseGameSound.ogg
It does however work when I do not use single channel.
Files are from http://gnome-look.org/content/show.php/Cleanus?content=61245
(these are MP3 files named as ogg, don't know why, but renaming the files to mp3 has no effect)
ceefour@hendy:~/tmp/Cleanus-OGG/sprite > audiosprite -e ogg,mp3 -f howler -o cleanus-ogg -g 0.3 ../*.ogg
debug: Parsed arguments _=[../Battery_Charging.ogg, ../K3B_Error.ogg, ../K3B_Success.ogg, ../KDE_Desktop10.ogg, ../KDE_Desktop1.ogg, ../KDE_Desktop2.ogg, ../KDE_Desktop3.ogg, ../KDE_Desktop4.ogg, ../KDE_Desktop5.ogg, ../KDE_Desktop6.ogg, ../KDE_Desktop7.ogg, ../KDE_Desktop8.ogg, ../KDE_Desktop9.ogg, ../KDE_Device_Connected.ogg, ../KDE_Device_Disconnected.ogg, ../KDE_Error.ogg, ../KDE_Event2.ogg, ../KDE_Event.ogg, ../KDE_Logout.ogg, ../KDE_pop.ogg, ../KDE_Startup.ogg, ../KDE_Window_Close.ogg, ../KDE_Window_Open.ogg, ../KDE_Window_Shade_Down.ogg, ../KDE_Window_Shade_Up.ogg, ../Kopete_Event.ogg, ../Kopete_Received.ogg, ../Kopete_Sent.ogg, ../Kopete_User_is_Online.ogg, ../LowBatteryAlarm.ogg, ../Window_Iconify.ogg], e=ogg,mp3, export=ogg,mp3, f=howler, format=howler, o=cleanus-ogg, output=cleanus-ogg, g=0.3, gap=0.3, path=, u=, log=info, l=info, autoplay=null, a=null, silence=0, s=0, minlength=0, m=0, samplerate=44100, r=44100, channels=1, c=1, rawparts=, p=, $0=audiosprite
debug: Created temporary file file=/tmp/audiosprite.014362295158207417
debug: Spawn cmd=ffmpeg -version
debug: Start processing file=../Battery_Charging.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Battery_Charging.ogg -ar 44100 -ac 1 -f s16le pipe:
util.pump() is deprecated. Use readableStream.pipe() instead.
info: File added OK file=/tmp/audiosprite.22132545709609985, duration=1.044671201814059
info: Silence gap added duration=1.2553287981859411
debug: Start processing file=../K3B_Error.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/K3B_Error.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.13487249799072742, duration=2.141814058956916
info: Silence gap added duration=1.1581859410430841
debug: Start processing file=../K3B_Success.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/K3B_Success.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.3766818977892399, duration=1.7499773242630385
info: Silence gap added duration=0.5500226757369615
debug: Start processing file=../KDE_Desktop10.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop10.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.7876935570966452, duration=0.5744671201814059
info: Silence gap added duration=0.725532879818594
debug: Start processing file=../KDE_Desktop1.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop1.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.7543931272812188, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop2.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop2.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.26619959552772343, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop3.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop3.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.5545179196633399, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop4.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop4.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.7542353158351034, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop5.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop5.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.622084665345028, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop6.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop6.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.173782936995849, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop7.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop7.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.0012624321971088648, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop8.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop8.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.6332280528731644, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Desktop9.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Desktop9.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.5749752067495137, duration=0.6267120181405895
info: Silence gap added duration=0.6732879818594104
debug: Start processing file=../KDE_Device_Connected.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Device_Connected.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.20169578585773706, duration=1.044671201814059
info: Silence gap added duration=1.2553287981859411
debug: Start processing file=../KDE_Device_Disconnected.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Device_Disconnected.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.956946864258498, duration=1.0185487528344672
info: Silence gap added duration=1.2814512471655328
debug: Start processing file=../KDE_Error.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Error.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.18649493507109582, duration=0.7312018140589569
info: Silence gap added duration=0.5687981859410431
debug: Start processing file=../KDE_Event2.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Event2.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.7731257516425103, duration=0.8095691609977325
info: Silence gap added duration=0.4904308390022675
debug: Start processing file=../KDE_Event.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Event.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.400481037562713, duration=0.8095691609977325
info: Silence gap added duration=0.4904308390022675
debug: Start processing file=../KDE_Logout.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Logout.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.7914322479628026, duration=2.820997732426304
info: Silence gap added duration=0.4790022675736962
debug: Start processing file=../KDE_pop.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_pop.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.42137549072504044, duration=0.4960997732426304
info: Silence gap added duration=0.8039002267573696
debug: Start processing file=../KDE_Startup.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Startup.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.06403044448234141, duration=5.589977324263039
info: Silence gap added duration=0.7100226757369612
debug: Start processing file=../KDE_Window_Close.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Window_Close.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.36530930432491004, duration=0.5483446712018141
info: Silence gap added duration=0.751655328798186
debug: Start processing file=../KDE_Window_Open.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Window_Open.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.019994460744783282, duration=0.1565079365079365
info: Silence gap added duration=1.1434920634920636
debug: Start processing file=../KDE_Window_Shade_Down.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Window_Shade_Down.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.29141633468680084, duration=0.3654875283446712
info: Silence gap added duration=0.9345124716553288
debug: Start processing file=../KDE_Window_Shade_Up.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/KDE_Window_Shade_Up.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.4547124393284321, duration=0.31324263038548755
info: Silence gap added duration=0.9867573696145124
debug: Start processing file=../Kopete_Event.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Kopete_Event.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.2244569652248174, duration=1.2797732426303854
info: Silence gap added duration=1.0202267573696147
debug: Start processing file=../Kopete_Received.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Kopete_Received.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.5800625709816813, duration=0.9401814058956917
info: Silence gap added duration=0.35981859410430833
debug: Start processing file=../Kopete_Sent.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Kopete_Sent.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.9119340069591999, duration=0.7573242630385487
info: Silence gap added duration=0.5426757369614512
debug: Start processing file=../Kopete_User_is_Online.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Kopete_User_is_Online.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.622257454553619, duration=0.8618140589569161
info: Silence gap added duration=0.4381859410430839
debug: Start processing file=../LowBatteryAlarm.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/LowBatteryAlarm.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.35453224810771644, duration=1.2275283446712018
info: Silence gap added duration=1.0724716553287983
debug: Start processing file=../Window_Iconify.ogg
debug: Spawn cmd=ffmpeg -i /home/ceefour/tmp/Cleanus-OGG/Window_Iconify.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=/tmp/audiosprite.48956903093494475, duration=0.4438548752834467
info: Silence gap added duration=0.8561451247165532
debug: Start export format=ogg
debug: Spawn cmd=ffmpeg -y -ac 1 -f s16le -i /tmp/audiosprite.014362295158207417 -acodec libvorbis -f ogg cleanus-ogg.ogg
[1]
ceefour@hendy:~/tmp/Cleanus-OGG/sprite > ffmpeg -y -ac 1 -f s16le -i /tmp/audiosprite.014362295158207417 -acodec libvorbis -f ogg cleanus-ogg.ogg
ffmpeg version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Feb 6 2014 20:53:28 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Ignoring attempt to set invalid timebase for st:0
[s16le @ 0x863400] Could not find codec parameters (Audio: pcm_s16le, 1 channels, s16)
[s16le @ 0x863400] Estimating duration from bitrate, this may be inaccurate
/tmp/audiosprite.014362295158207417: could not find codec parameters
[1]
For audiosprite -c 2 -f howler -o cleanus-mp3 -g 0.3 ../*.mp3
:
ceefour@hendy:~/tmp/Cleanus-OGG/sprite > ffmpeg -y -ac 2 -f s16le -i /tmp/audiosprite.45090715354308486 -acodec libvorbis -f ogg cleanus-mp3.ogg
ffmpeg version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Feb 6 2014 20:53:28 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Ignoring attempt to set invalid timebase for st:0
[s16le @ 0x2193400] Estimating duration from bitrate, this may be inaccurate
Input #0, s16le, from '/tmp/audiosprite.45090715354308486':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 2 channels, s16
[ogg @ 0x219f120] sample rate not set
Output #0, ogg, to 'cleanus-mp3.ogg':
Stream #0.0: Audio: libvorbis, 2 channels, s16
Stream mapping:
Stream #0.0 -> #0.0
Could not write header for output file #0 (incorrect codec parameters ?)
Additionally #14 should be fixed to make it less confusing.
To make this work on Ubuntu I had to symlink avconv as ffmpeg and change line 166 to add "-strict -2" just before the output file name
spawn('ffmpeg',['-y', '-ar', opts.samplerate, '-ac', opts.channels, '-f', 's16le', '-i', src]
.concat(opt).concat(['-strict','-2']).concat(outfile))
Getting the following error after requiring or including in in my webpack React app:
Module not found: 'child_process'
Regression from #10
I need no gap between sound sprites but logs shows that gaps are added and quite big gaps
e.g.
cmd line: audiosprite -l debug --output d:/work/hero/sounds-reduced -f howler -v 3 -g 0.0001 D:/work/hero/src/branches/small/res/sounds-reduced/*
output
info: File added OK file=C:\Users\SSOLOZ1\AppData\Local\Temp\audiosprite.6968405144289136, duration=1.6297505668934241\AppData\Local\Temp\audiosprite.26521250791847706, duration=0.21623582766439908
info: Silence gap added duration=0.370349433106576
debug: Start processing file=D:/work/hero/src/branches/small/res/sounds-reduced/stone_fall.ogg
debug: Spawn cmd=ffmpeg -i D:\work\hero\src\branches\small\res\sounds-reduced\stone_fall.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=C:\Users\SSOLOZ
info: Silence gap added duration=0.7838641723356009
debug: Start processing file=D:/work/hero/src/branches/small/res/sounds-reduced/stones_collision.ogg
debug: Spawn cmd=ffmpeg -i D:\work\hero\src\branches\small\res\sounds-reduced\stones_collision.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=C:\Users\SSOLOZ1\AppData\Local\Temp\audiosprite.707215964095667, duration=0.145124716553287991\AppData\Local\Temp\audiosprite.14779552235268056, duration=0.2620181405895692
info: Silence gap added duration=0.854975283446712
debug: Start processing file=D:/work/hero/src/branches/small/res/sounds-reduced/stones_collision2.ogg
debug: Spawn cmd=ffmpeg -i D:\work\hero\src\branches\small\res\sounds-reduced\stones_collision2.ogg -ar 44100 -ac 1 -f s16le pipe:
info: File added OK file=C:\Users\SSOLOZ
info: Silence gap added duration=0.7380818594104308
debug: Start processing file=D:/work/hero/src/branches/small/res/sounds-reduced/stopwatch_add.ogg
debug: Spawn cmd=ffmpeg -i D:\work\hero\src\branches\small\res\sounds-reduced\stopwatch_add.ogg -ar 44100 -ac 1 -f s16le pipe:
subj.
should be similar to ogg, but in different container. ffmpeg supports it.
I'm testing this lib out by combining two mp3s. One is 22kb and the other is 37kb. The output mp3 is 113kb. I'm using 0
gap for testing purposes. What could be increasing the output file size so much?
Having given audiosprite
many input mp3's, we have found that final file export never completes.
It seems, the reason is that ffmpeg
's output buffer gets full and should be read out. Otherwise it starts hanging. (Please, check the following: http://stackoverflow.com/questions/20792427/why-is-my-node-child-process-that-i-created-via-spawn-hanging)
As a workaround, we tried to specify the -v quiet
option to ffmpeg
and it solved the problem. Also specifying {stdio: 'ignore'}
to spawn solves the issue.
Currently output files are only written to current directory. Because JSON asset paths are loaded relative to the page the plain filenames are likely to be wrong.
audiosprite --rawparts "mp3,ogg" -o 'sprite' -s 2 .
creates rawparts with filenames "sprite_001", "sprite_002" etc - should these filenames not match the original filenames and therefore the id's in the sprite json file so that switching between using a webaudio system and an audiosprite system can use the same ids?
Hello... first, thanks for the really useful tool!
I was just wondering, is there any way to ask the program to only spit out an mp3? The problem is that recent versions of FFMPEG don't come with the correct codecs to generate m4a files, so the process dies when it gets to that point.
Cheers
Jon
Now it returns sprite size, not a 1 sound size
See #13
At the moment a lot of the different formats are hardcoded. This should be changed to allow different adapters for different frameworks.
By default samples length is 1 second, I've tried set --minlength 0.2
and 0 sec but looks like samples length is still 1 second. Values longer then 1 seconds works properly.
Full command
audiosprite PATH\*.wav --output PATH\sprites\mysound --export ogg,mp3,wav --gap 0 --minlength 0.2
iOS 8 again requires first sound to play from user event for Web Audio API. Silent slice could be used to initialize audio engine but currently its not generated.
It would be nice to have this library being able to export a Promise
in order to use it synchronously with async
/await
.
When run with debug option
ffmpeg version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Nov 9 2013 19:09:46 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Ignoring attempt to set invalid timebase for st:0
[s16le @ 0x1e2a1c0] Could not find codec parameters (Audio: pcm_s16le, 1 channels, s16)
[s16le @ 0x1e2a1c0] Estimating duration from bitrate, this may be inaccurate
/tmp/audiosprite.2510260413400829: could not find codec parameters
└> npm -g i audiosprite
/Users/metalim/.nvm/versions/node/v5.7.0/bin/audiosprite -> /Users/metalim/.nvm/versions/node/v5.7.0/lib/node_modules/audiosprite/cli.js
/Users/metalim/.nvm/versions/node/v5.7.0/lib
└── [email protected]
└> audiosprite
env: node\r: No such file or directory
└> npm -g i [email protected]
/Users/metalim/.nvm/versions/node/v5.7.0/bin/audiosprite -> /Users/metalim/.nvm/versions/node/v5.7.0/lib/node_modules/audiosprite/cli.js
- [email protected] node_modules/audiosprite/node_modules/balanced-match
- [email protected] node_modules/audiosprite/node_modules/concat-map
- [email protected] node_modules/audiosprite/node_modules/brace-expansion
- [email protected] node_modules/audiosprite/node_modules/inherits
- [email protected] node_modules/audiosprite/node_modules/minimatch
- [email protected] node_modules/audiosprite/node_modules/path-is-absolute
- [email protected] node_modules/audiosprite/node_modules/wrappy
- [email protected] node_modules/audiosprite/node_modules/once
- [email protected] node_modules/audiosprite/node_modules/inflight
- [email protected] node_modules/audiosprite/node_modules/glob
/Users/metalim/.nvm/versions/node/v5.7.0/lib
└── [email protected]
└> audiosprite
error: No input files specified.
info: Usage: audiosprite [options] file1.mp3 file2.mp3 *.wav
...
A common method of cache-busting is to include a "short hash" in the filename.
Hi
I am busy writing a little app that uses a UI to create AudioSprites. Im running into an issue where when my app is packaged it does not seem to find ffmpeg. Is there a way to bundle ffmpeg into my app and point audiosprite to that file? Also, where do the exported files get created when using the API?
Not sure if this is an issue or just lack of documentation or maybe my own stupidity.
Regards
PS: This is the error im getting :
Uncaught Exception:
Error: spawn ffmpeg ENOENT
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:465:9)
at process._tickCallback (node.js:379:17)
$ git clone [email protected]:tonistiigi/audiosprite.git
$ cd audiosprite
$ npm install
$ npm test
...
Uncaught AssertionError: beep end time not 1.77
Am I missing something?
Edit: Oh, it's 1.7235147392290249
btw.
Audiosprite spawns ffmpeg with stdout pipe when it generates sprites. It is listening for the 'exit' event instead of 'close' which causes the piped stdout stream to sometimes be incomplete before the sprite is generated:
Line 118 in c487140
I ran into this issue with our build system which is concurrently generating loads of sprites (ie. maxing out cpu). I was able to reproduce this with Amazon AMI Linux as well as Ubuntu Linux (running in AWS as well). Also I tried with Node 6.x and 8.x - both behaving similarly. I wrote a small script to reproduce this behaviour with a simple 'cat' operation piping a large text file to stdout and listening to the 'exit' event. Changing the 'exit' to 'close' fixed the problem.
Link to the 'close' event documentation: https://nodejs.org/api/child_process.html#child_process_event_close
Some related discussion: https://stackoverflow.com/questions/37522010/difference-between-childprocess-close-exit-events
Let me know if you need more details on this.
Hi !
I'm trying to use audiosprite on Windows and I get the following error.
FFmpeg is installed and working.
Do you know why I get that error message ?
(error: Error exporting file msg=Error exporting file, format=mp3, retcode=1, signal=null)
Thanks !
$ audiosprite 1.mp3 2.mp3
info: File added OK file=C:\Users\fboss\AppData\Local\Temp\audiosprite.917463, duration=1.4106122448979592
info: Silence gap added duration=1.5893877551020408
info: File added OK file=C:\Users\fboss\AppData\Local\Temp\audiosprite.13961, duration=1.5151020408163265
info: Silence gap added duration=1.4848979591836735
error: Error exporting file msg=Error exporting file, format=mp3, retcode=1, signal=null
"spritemap": {
"a_lose": {
"start": 0,
"end": 0,
"loop": false
},
"a_sitdown": {
"start": 1,
"end": 1,
"loop": false
},
"a_standup": {
"start": 2,
"end": 2,
"loop": false
},
...........................
File added OK file=/var/folders/kk/nc3_3h215n928hptm6g52ps40000gn/T/audiosprite.7941562433261424, duration=0
I just had a long head-scratching session that could be solved with a simple addition to audiosprite
. On Linux at least, audiosprite
uses the directory found in the TMPDIR environment variable for temporary file creation. Because it is the only app on my PC that uses that variable it took me a while to figure out what my root problem was with my audiosprite
runs, since they were failing with the dreaded ENOENT
error. The problem turned out to be that the directory value assigned to TMPDIR was invalid. That is, the value assigned to TMPDIR did not exist on my disk. Once I figured this out I changed TMPDIR to a valid directory and audiosprite
worked fine.
I suggest having audiosprite
do a directory existence check for the directory found in TMPDIR, before actually trying to run ffmpeg
, and reporting a fatal error if the directory is not found.
Thank you for creating this useful utility.
Hi,
ran in to an issue where if using a directory for input and the filenames are all numberic ie.. 1.mp3, 2.mp3, 3.mp3 the id's generated in the json (i'm using createjs) don't correspond to the input files.
the json has all the id's, and the information included with the id is valid (start, duration), but the id does not correspond to the input file. i'm on win 10.
The help notes that Howler is the default, however the JSON output appears to be Jukebox format when "--format howler" is not specified:
info: Usage: audiosprite [options] file1.mp3 file2.mp3 *.wav
info: Options:
...
--format, -f Format of the output JSON file (default, howler)
Tested on Windows with audiosprite v0.3.0.
on this line, https://github.com/tonistiigi/audiosprite/blob/master/audiosprite.js#L224, why is there a Math.ceil(duration)? the ceil is added a silent gap in between my files, which isn't what i want. anyways, any feedback is appreciated.
When using the install command for ffmpeg from the readme
brew install ffmpeg --with-theora --with-libogg --with-libvorbis
I received this warning from brew:
Warning: ffmpeg: this formula has no --with-libogg option so it will be ignored!
Seems to work fine
audiosprite --output minimalist -f howler --export ogg,mp3 -g 0 --path *.wav
When there are 6 wave files in the folder, audiosprite will only see 5 of them.
When there are 5 wave files in the folder, audiosprite will only see 4 of them.
..
..
When there is 1 wave file in the folder, audiosprite will mention there are no files.
MacOS ventura.
I think they zynga took it off
Tests currently only check the old jukebox format. Ideally all formats should be checked as new contributors will likely use only one themselves.
Spritemap object keys are not ordered. This means that it can get mixed up with rawparts that are just a sequence of numbers.
Possible solutions:
Any way to do this without breaking old behavior? Don't want to add a new option flag again.
Suddenly audio distortions have started to appear in our audiosprites files. We're not sure if it's a change to node or what but here is a fix:
(In appendSilence function line 231)
buffer.fill(null)
becomes
buffer.fill(0)
I'm running node v0.11.12 and ffmpeg 2.2.3
Previously I had ffmpeg 1.2 and the pops/cracks were still in the generated file. Upgrading ffmpeg did not resolve the issue.
I don't know why, but just setting process.env.path didn't work for me when building on Netlify.
You can see what troubles I got into here: https://github.com/ubershmekel/ld47/blob/master/build/build-sounds.js
I ended up copying the audiosprite.js
file and modifying it to allow using a custom ffmpeg
binary file path.
input file chunk-[ɑːb]-ob.mp3 etc can't find in the return object. cause by glob.sync(chunk-[ɑːb]-ob.mp3) return [], not [chunk-[ɑːb]-ob.mp3]?
For some reason, after installing the package, the binary audiosprite
has wrong line endings, resulting this error.
$ npm install --save-dev audiosprite
$ ./node_modules/.bin/audiosprite --help
env: node\r: No such file or directory
I've cloned the project locally and ./cli.js
works properly - no problem with line ending. Maybe publishing to NPM from a windows machine mess up with line endings?
More info about this here: npm/npm#4607
When I run brew install ffmpeg
I get error:
Error: invalid option: --with-theora
Googling explains it as brew options is obsolete: https://discourse.brew.sh/t/ffmpeg-options-missing/3935
Jukebox isn't freely available anymore and has been abandoned by Zynga, thus it might make sense to remove support for it.
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.