Has anyone used Thymio to mimick bird sounds? I'm a bit afraid the speaker isn't loud enough for it. I could find many .wavs of crows in the internet. But I think I do have to convert them first. Any ideas on matching the sound level of thymio with the birds sound level?
BTW: I tried to save a .wav file in MAC OSX by using Audacity. The file I get under export contains the ADC-logo and it doesn't work (I used exactly the settings in the wiki 8000, .wav, 8bit.)
Here is the original file:
http://www.freesound.org/people/inchadney/sounds/159426/
What do you mean with "doesn't work"?
You are no more able to reproduce the exported file on the MAC, you are not able to make Thymio reproduce it…
Sic Parvis Magna
It means thymio is playing its default start sound instead of the .wav I saved under s0.wav on the SD-card. So my thought is that the format somehow could be wrong, but I saved it exactly as written in the wiki.
Also: The s0.wav from a robot-library here works and the logo of that file is different. The one I exported got an audacity logo.
A video showing how to make sounds with audacity is available on youtube, hopefully it helps.
Make sure that no metadata is set in the exported file as explained also by the video.
The file you are exporting originally has two values in the first two metadata.
Sic Parvis Magna
That worked. The meta-box wasn't showing up automatically. Unfortunately the sound is way to quiet on thymio to mimick a raven. :(
BTW: Why is the timer limited to 65000 ms? It's too less! :-)
The sound sampling frequency is about 8Khz, which mean that the highest frequency you can get out of Thymio is 4Khz. According to this paper: S. Fagerlund, "Acoustics and physical models of bird sounds", this is too low. Thus you cannot mimick birds with Thymio.
BTW, the timer is limited because aseba can only handle signed 16 bits integer. But you can do a software counter inside the timer event to extend it.
Thank you for the information. Maybe I should try out beaglebone or arduino uno for this. But it will be definitely a bigger learning curve to use those.
BTW: I need more information on the math.rand() function and how I can assign them to a variable, cause it didn't work the way I did. It would be even better to assign a random number between say 30 seconds to 1.5 minutes.
math.rand() returns a random number between -32768 to 32767, if you want a number between 0 and n-1, do
var v = 0
var n = 10
call math.rand(v)
v = abs(v) % n
Striclty speaking, using a modulo for constraining a random variable range is a bad idea as the distribution will be affected. You should use a division to constrain the range between -n and n, and then an addition to shift the mean and have a range between 0 and 2*n.
In principle yes, but given the quality of our random number generator, I am not sure the effect is visible. There are also two problems for the distribution even with the division:
- the abs will not work if math.rand() returns -32768
- if the targetted number is not a divisor of 32768, then the distribution is skewed anyway
So this code works in all cases, with a non-uniform distribution I agree:
var v = 0
var n = 10
call math.rand(v)
v = abs(v/2) % n
This will not run if you want to generate a number between zero and a number bigger than 32768/2.
What about:
v = abs(v % n)
instead?
I have done some test with Thymio and it seems to run.
The code I have used to test it is:
var v = 0
var n = 32767
onevent button.forward
call math.rand(v)
v = abs(v % n)
Working in Aseba and looking at the Variables pane is possible to see the variable v to change randomly its value every time you press the forward button on Thymio.
Sic Parvis Magna
Indeed this works in more cases than the previous solution.