Re: [LAU] loop speeding in sample level accuracy

From: Dan Richert <dan.richert@email-addr-hidden>
Date: Thu Sep 18 2008 - 21:38:01 EEST

SoX can do the job with some help. Here's a little Perl script to
figure out the speed scaling ratio based on the desired new length in
samples:

#!/usr/bin/perl

if(@ARGV != 3){ die "Usage: resize-audio.pl <in_file> <new_size>
<out_file>\n"; }
($in_file,$new_size,$out_file) = @ARGV;
$size = `sox $in_file -n stat 2>&1 |grep ^Samples |awk '{print \$3}'`;
$ratio = $size / $new_size;
print "$ratio\n";
`sox $in_file $out_file speed $ratio`;

In the couple tests I ran, it doesn't get to the *exact* new size
specified in samples, but pretty close -- I converted a file 12486
samples long to 3000 samples and ended up with a file with 3002 samples.

Jari Suominen wrote:
> Tiago Tavares kirjoitti:
>
>> Can SoX do the job?
>>
>
> Nope. Speed shift takes in prosent or cents.
>
> ....j
>
>
>> On Thu, Sep 18, 2008 at 1:51 PM, Jari Suominen <jari.suominen@email-addr-hiddenwrote:
>>
>>
>>> Hello,
>>>
>>> I'm trying to search a program (with no success) that could used for
>>> speeding up an audio file to a certain length. I mean, I would have a
>>> audio file that has 40000 samples, and I would need it to be 40010. And
>>> the pitch of the file can/should change. All speed change stuff that I
>>> have found will take semitones/cents/procents as a input parameter. I
>>> would wan't to only input the exact length (in samples) that I need.
>>>
>>> My purpose is basically make bunch of files that are loopable and have
>>> equal length with each other.
>>>
>>> Does this thing exist or do I have to make it myself?
>>>
>>> Thanks!
>>>
>>> ..j
>>> _______________________________________________
>>> Linux-audio-user mailing list
>>> Linux-audio-user@email-addr-hidden
>>> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
>>>
>>>
>>
>>
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@email-addr-hidden
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
>

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
Received on Fri Sep 19 00:15:03 2008

This archive was generated by hypermail 2.1.8 : Fri Sep 19 2008 - 00:15:04 EEST