
xaccrocheur |
encode samples so that Bhajis loops can load them ?
Mar 01, 2010 14:05
Hi everyone
I'm DLoading "samplepacks" (just a zipped list of samples) from freesound, for use w/ and most of them are in aif format.
I wrote a *simple* script to convert them to wav using sox.
Here it is :
[code]
#! /bin/bash
# This script converts all music files in the current dir to wav.
# hallucinet@free.fr
# V 0.1 No interaction, no fuss.
for a in *.aif; do
if [ -f "$a" ]; then
b="${a%.aif}"
sox "${b}.aif" "${b}.wav"
echo Converted "${b}.aif" to "${b}.wav"
sox -V "${b}.wav" -r 22000 "${b}-22.wav" rate
i=$[i+1]
fi
done
echo Converted "$i" aif files;
[/code]
But sometimes (not everytime, some aif samples end up perfectly comestible BL wavs - vegan wavs ;) ) I'm being, hum, not insulted, let's just say "put back to my place" (french saying) by BL, who errors (5555) and says that the resulting samples use "a compression that's not supported by BL"
So my question is : What exatly are the file format specs for a sample to be properly loaded in BL ?
I mean every kind of sample, mono or stereo, and the frequencies.
What I'd like is the format(s), and the possible freqs.
Ideally, I'd like my script to spit out TWO files : One that's full stereo @ 44kHz (or whatever the best quality is available in BL) and one that is mixed to mono, 22kHz (or whatever the lowest-but-still-acceptable quality possible.
When I'll know, I'll post my findings here, edit this very post so it's an answer rather than a question ;)
From Africa w/ love,
pX
Last edited by xaccrocheur on Mar 01, 2010 20:18; edited 1 time in total
|

olivier |
Re: encode samples so that Bhajis loops can load them ?
Mar 01, 2010 15:04
Hi,
Either IMA ADPCM [FormatTag = 17]:
- mono / 4 bits
Or PCM [FormatTag = 1]:
- mono or stereo
- 8 or 16 bits
Any sample rate
Please upload somewhere the offending file and I'll have a look. My bet is that it's compressed.
Olivier
|

xaccrocheur |
Mar 01, 2010 20:34
OK, thank you Olivier, here is my script now :
#! /bin/bash
# This script converts all music files in the current dir to wav.
# hallucinet@free.fr
# V 0.1 No interaction, no fuss.
for a in *.aif; do
if [ -f "$a" ]; then
soundfile="${a%.aif}"
sox -V "${soundfile}.aif" -b 16 "${soundfile}-44k.wav" rate 44k norm
sox -V "${soundfile}.aif" -b 16 "${soundfile}-22k.wav" channels 1 rate 16k norm
i=$[i+1]
fi
done
echo Converted "$i" aif files;
This script will take all the aif files in the current dir (put it in $PATH), and encode two files : One WAV as close as possible to the original, and the other, downsampled to 22K, and mixed to mono.
As far as I tested, all the resulting files are Bhajis-comestible :)
|

olivier |
Mar 01, 2010 22:29
xaccrocheur wrote: OK, thank you Olivier, here is my script now :
#! /bin/bash
# This script converts all music files in the current dir to wav.
# hallucinet@free.fr
# V 0.1 No interaction, no fuss.
for a in *.aif; do
if [ -f "$a" ]; then
soundfile="${a%.aif}"
sox -V "${soundfile}.aif" -b 16 "${soundfile}-44k.wav" rate 44k norm
sox -V "${soundfile}.aif" -b 16 "${soundfile}-22k.wav" channels 1 rate 16k norm
i=$[i+1]
fi
done
echo Converted "$i" aif files;
This script will take all the aif files in the current dir (put it in $PATH), and encode two files : One WAV as close as possible to the original, and the other, downsampled to 22K, and mixed to mono.
As far as I tested, all the resulting files are Bhajis-comestible :)
Your script seems to encode to 16k...
|

xaccrocheur |
Mar 05, 2010 10:44
olivier wrote:
Your script seems to encode to 16k...
No it does not...! Have you tried it ? (Hi Olivier!) take a full stereo aif file, copy it somewhere safe, and run the script in the dir, w/o arguments, you'll endup w/ 3 files, now enter file *. Have I any reason to doubt "file"s perspicacity ?
[xix@musicbox tmp]$ file *
mysoundfile-22k.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
mysoundfile-44k.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44000 Hz
mysoundfile.aif: IFF data, AIFF audio
The 1st two files have been produced w/ the script (AND BL eats them happily), and the third is the original. Is there something wrong ? Grml
|

olivier |
Mar 05, 2010 12:00
I'm confused... The file is called "22k" but the sample rate is clearly shown as being 16000 Hz. so?
|

xaccrocheur |
Mar 05, 2010 19:00
Damnit Olivier, you're right ; I don't know where my mind went.. Updated script here
for a in *.aif; do
if [ -f "$a" ]; then
soundfile="${a%.aif}"
sox -V "${soundfile}.aif" -b 16 "${soundfile}-44k.wav" rate 44k norm
sox -V "${soundfile}.aif" -b 16 "${soundfile}-22k.wav" channels 1 rate 22k norm
i=$[i+1]
fi
done
echo Converted "$i" aif files;
|

agc |
generatives
Mar 16, 2010 01:51
I'm taken with xaccrocheur's idea. Combine script-generated versions of a few basic source files, maybe process with filters. It has much potential... minialisme moire
|