lua---audio
lua---audio copied to clipboard
load_and_save_example.lua not working
my code:
require 'audio'
aud, sample_rate = audio.load('what_a_wonderful_world.mp3')
print(#aud)
print(sample_rate)
audio.save('test_out.mp3', aud, sample_rate)
output:
6094080
2
[torch.LongStorage of size 2]
test_out.mp3 ends up being an empty mp3 file. input file is 6.2mb, test_out.mp3 is 417 bytes, and duration is 00:00
I am not able to reproduce the issue. Can you try audio.save with a different output format, such as test_out.ogg or test_out.wav
i tried with .wav and it produced a 48.8 mb wav file that seems to be empty/unplayable. When I tried .ogg I got this error message, which might be more informative:
formats: no handler for given file type `ogg'
/Users/andrei/torch/install/bin/luajit: /Users/andrei/torch/install/share/lua/5.1/audio/init.lua:74: [write_audio_file] Failure to open file for writing at /tmp/luarocks_audio-0.1-0-804/lua---audio/generic/sox.c:135
stack traceback:
[C]: in function 'save'
/Users/andrei/torch/install/share/lua/5.1/audio/init.lua:74: in function 'save'
test.lua:9: in main chunk
[C]: in function 'dofile'
...drei/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x010300ebd0
Does this issue reproduce with audio.samplevoice() or is it just with your specific file?
is samplevoice() supposed to return a sample rate? I'm trying to save the tensor that the function returns but it doesn't provide a sample rate so I can pass to the save() function.
used 41100 as sample rate and it seams to work (though sped up). I guess it's the file I was using. It's a standard mp3 file though, not sure why it's not working.
I've tried using many different mp3 and wav files as input and none of them worked. Only the sample voice seems to be saving. All the different files look like they're successfully being filled into the tensor, but they result in output files that are empty. Any idea what could be wrong?
Hello, same problem here (almost). Saving .mp3 results in an unplayable file and .ogg never returns from the call. However .wav seems to work fine. Any update?