by i-Bot » Tue Jan 30, 2007 10:54 pm
by i-Bot
Tue Jan 30, 2007 10:54 pm
The speaker is connected to port D.5 of the processor. So at a simple level you could just toggle port 28 which corresponds to D.5. However with the slow performance of the interpreter, then only a small range of low frequency tones is possible.
The music command is quit complex and uses interrupts. It plays tones in sequence out of the program EEPROM. The start of the music command starts the process, it does not run all the time. This means there is no RAM location that can be poked to give a tone. It may be possible to modify or bend existing tones, but I don't see any way to initiate a tone outside the program script.
I do understand the limitation with the music command. I used some of your Theramin code to make changing tones with Gyro motion, since it was the easiest way to convert from a variable to a tone.
I haven't spent much time looking at the music code, and did not include it in the C routines.
I guess if you have something interesting or specific in mind, we might add a new command to Robobasic, or convert your code to C and then be able to toggle the speaker faster.
The speaker is connected to port D.5 of the processor. So at a simple level you could just toggle port 28 which corresponds to D.5. However with the slow performance of the interpreter, then only a small range of low frequency tones is possible.
The music command is quit complex and uses interrupts. It plays tones in sequence out of the program EEPROM. The start of the music command starts the process, it does not run all the time. This means there is no RAM location that can be poked to give a tone. It may be possible to modify or bend existing tones, but I don't see any way to initiate a tone outside the program script.
I do understand the limitation with the music command. I used some of your Theramin code to make changing tones with Gyro motion, since it was the easiest way to convert from a variable to a tone.
I haven't spent much time looking at the music code, and did not include it in the C routines.
I guess if you have something interesting or specific in mind, we might add a new command to Robobasic, or convert your code to C and then be able to toggle the speaker faster.