I'm trying to remake the wheel, just to learn about it. This is a wave generator that is going to speak Vowels, I need to calculate a very big function so I want to know a faster method to do that.

1) I put overclocking (1000MHz)

2) I use two methods in bash to do 1000 sines. The first one give me 7 seconds and the other 4 seconds.

Code: Select all

```
#! /bin/bash
# /home/pi/Zepfdr/just4test/math_test02.sh
#Constants
pi=`echo "4*a(1)" | bc -l`
pi2=`echo "$pi*2" | bc -l`
#Variables
fnumber=200
ftim=0.0001
echo -e "Using do loops with | bc -l:\n"
for i in `seq 1 100`
do
fswave=`echo "$pi2*$fnumber*$ftim" | bc -l`
#echo "s($fswave)" | bc -l
ftim=`echo "$ftim+0.0001" | bc -l`
done
echo -e "\n\nUsing do loops with a faster nethod:\n"
for i in `seq 1 100`
do
fswave=$(bc -l <<< "$pi2*$fnumber*$ftim")
#echo "s($fswave)" | bc -l
ftim=$(bc -l <<< "$ftim+0.0001")
done
```

Just for information of my function, a vowel has:

Fundamental Frequency = fo

Harmonics = fo*2, fo*3, etc.

variables of Natural decrement of the harmonics = Function FL

variables of Formant 1 = Function F1 (Sine)

variables of Fomant 2 = Function F2 (Sine)

variables of Form...

*Amplitude of each frequency = Arithmetic Function (FL:F1:F2:F...:F5)

**Wave form = sin(2pi*fo*time)*Amplitude of fo + sin(2pi*f1*time)*Amplitude of f1 +....

I have 80 frequencies so its going to be a long wait. (I made this with a microcontroller I got like 19 minutes)... Hoping the raspberry can do it faster (Excel made it in 1 sec xD)

Thanks!