How should data be formated for a frequency file?
Kye
Posts: 2,200
Hey all,
I've been working on a sound driver that lets the propeller chip generate a 1-22050 Hz on an I/O pin. That I/O pin is then pluged into an amplifier which controls a speaker.
The results so far are great, I can play any tone (frequency) that I want (I can't hear them all however) and I can play them for any amount of time that I want.
Now, the next step in the developement cycle is to make the speaker play from a data table full of tones to generate a song. I've already come up with a simple format for this which uses a table built like this.
However, I'm not sure if this is the best way to control the tone the speaker plays.
All I can control is the frequency which I send to the speaker and the time that I send it for.
...So is there any standardized filetype out there that works with only the frequency and time to play music?
I want to try to make the driver easily usable with already established file types. So if anyone knows either a better way to format·the data table for a song or a standard file type for this please speak up.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I've been working on a sound driver that lets the propeller chip generate a 1-22050 Hz on an I/O pin. That I/O pin is then pluged into an amplifier which controls a speaker.
The results so far are great, I can play any tone (frequency) that I want (I can't hear them all however) and I can play them for any amount of time that I want.
Now, the next step in the developement cycle is to make the speaker play from a data table full of tones to generate a song. I've already come up with a simple format for this which uses a table built like this.
word (frequency) word (time in milliseconds to play the frequency) word (frequency) word (time in milliseconds to play the frequency) word ... word ... etc.
However, I'm not sure if this is the best way to control the tone the speaker plays.
All I can control is the frequency which I send to the speaker and the time that I send it for.
...So is there any standardized filetype out there that works with only the frequency and time to play music?
I want to try to make the driver easily usable with already established file types. So if anyone knows either a better way to format·the data table for a song or a standard file type for this please speak up.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
It depends on your objective. If it's just to play music (using a Western scale), the frequencies are bound by 12 semitones per octave (C to C), and the durations by powers of two and their dotted complements. You also need to consider playing styles, such as legato, marcato, staccato, glissando, etc., as well as by overall tempo. The user documentation for the SoundPAL may give you some ideas.
There's also the ABC notation, along with the aforementioned RTTTL.
-Phil
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Does that sound like a good idea? Making a converter?·It would then make the driver more flexible and able to play any higher level data type format.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
To my eyes the code is clumsy and big, but there are tons of tones out there and all kinds of PC converter and composer programs.
If you want something small and probably limited, you'll have to use a proprietary form.
SoundPAL notation looks pretty compact. It could use a Spin interpreter and PC tool set ....
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
This is another existing format for sound files on the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian
uController.com - home of SpinStudio - the modular Development system for the Propeller
PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!
SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,