better sounds

This commit is contained in:
Nishi 2026-05-23 12:19:22 +09:00
commit 94216f59d7
149 changed files with 3034 additions and 1485 deletions

17
tools/convert.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
cd ../samples_old
for i in *.wav; do
n=30
b=""
echo "$i"
while true; do
if ffmpeg -y -i $b$i -af silenceremove=1:0:-${n}dB:stop_periods=1:stop_duration=0:stop_threshold=-${n}dB -ar 11025 -ac 1 ../fishtalk/samples/$i 2>&1 | grep "empty"; then
n=`expr $n + 10`
b="../samples_older"
continue
fi
break
done
done

View file

@ -61,7 +61,7 @@ close($f);
foreach my $l (@used){
open(my $f, ">", "src/phon_$l.c");
open(my $in, "-|", "ffmpeg -i $base/$l.wav -f s8 -ar 2205 -ac 1 - 2>/dev/null") or die "OOPS";
open(my $in, "-|", "ffmpeg -i $base/$l.wav -f s8 -ar 11025 -ac 1 - 2>/dev/null") or die "OOPS";
binmode($in);
@ -77,13 +77,13 @@ foreach my $l (@used){
my $total = 0;
while(($len = read($in, $buffer, 32)) > 0){
my @data = unpack("C*", $buffer);
my @data = unpack("c*", $buffer);
my @arr = ();
$total += $len;
for(my $i = 0; $i < $len; $i++){
my $hex = sprintf("%d", $data[$i] - 128);
my $hex = sprintf("%d", $data[$i]);
push(@arr, $hex);
}