monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
633 stars 147 forks source link

tape .wavs are actually AIFF (some programs will fail to read) #673

Closed jlmitch5 closed 5 years ago

jlmitch5 commented 5 years ago

Running latest master as of this commit

When I use SFTP to get a wav out of tape recorded on norns and try to drag it over to ableton, I get the message "could not be read. it may be corrupt or not licensed"

Here is a tape wav that exhibits the issue: 0005.wav.zip

Apple preview plays it fine

catfact commented 5 years ago

hm, i don't have ableton but i seem to be able to use this file with everything i do have (max, SC, audacity, reaper, ffmpeg, sox, quicktime; on macos 10.14.1)

my thought was that maybe supercollider was terminated or the recording otherwise halted early without cleaning up the file. when that happens with wav files, one usually gets a file whose duration field is missing in the header, and can't be played by anything. when that happens its usually fixable by reading as a RAW file (specifiying format/channel count explicitly) and re-saving as WAV.

more simply, i can often use SoX like this:

sox --ignore-length broken.wav fixed.wav

in this case it had a weird effect - added a couple seconds to the duration?

okyeron commented 5 years ago

Looked into this with Ableton Live Suite 9. Same problem with that wav file.

That wav file from Tape shows the following in Quicktime's info pane: Linear PCM, 16 bit big-endian signed integer, 2 channels, 48000hz

A different wav file that loads into Ableton just fin shows: Linear PCM, 16 bit little-endian signed integer, 1 channels, 44100hz

Oh.... checking info in another app (Peak) - the 005.wav file says it's File Format AIFF with Compressor NONE ??? If I change the file extension to .aiff Ableton will import the file OK.

okyeron commented 5 years ago

So - does supercollider default to saving in AIFF?

https://github.com/supercollider/supercollider/wiki/Recording-in-SuperCollider-(WIP)

To stop recording, run Server.default.stopRecording or hit Cmd+Period. SuperCollider outputs the recording to an AIFF file whose path is printed in the post window.

Looks like SC needs . recHeaderFormat to be set to wav, or file naming on norns to be changed to AIFF

.recHeaderFormat = string
Get/set the header format (string) of the output file. The default is "aiff". Must be called before prepareForRecord.
catfact commented 5 years ago

oh! you're quite right, how silly of me. these are .aiffs and that is indeed the supercolider default.

i assumed we were setting the format differently here https://github.com/monome/norns/blob/master/sc/core/Crone.sc#L175

but apparently not!

easily fixed, and fwiw is made moot by new-crone: https://github.com/monome/norns/blob/feature/new-crone/crone/src/Tape.h#L153

(it's really funny that literally every other program trusts whats actually in the header over the filename.)

> ffmpeg -i 0005.wav

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, **aiff**, from '0005.wav':
  Duration: 00:02:26.09, start: 0.000000, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16be, 48000 Hz, stereo, s16, 1536 kb/s
okyeron commented 5 years ago

Follow up question -what file formats can norns Play? Is mp3 supported?

artfwo commented 5 years ago

anything supported by libsndfile, but mp3 is not supported by it.

catfact commented 5 years ago

we could add an mp3 decoder like MAD.

https://www.underbit.com/products/mad/ example: https://lauri.võsandi.com/2013/12/implementing-mp3-player.en.html couple gotchas: https://thebreakfastpost.com/2016/11/26/mp3-decoding-with-the-mad-library-weve-all-been-doing-it-wrong/

catfact commented 3 years ago

if you are reading this in 2021 (or later), please be advised that this issue does not apply at all to the new TAPE system. look elsewhere for issues with exported files, and please try to provide artifacts and/or steps to reproduce when reporting issues.