Only major keys are recognised, but there is a 1:1 mapping from minor keys to major keys, as with all other sets of key signatures, so this can be easily changed in the ABC file. "K:xy" - Set the key signature of the song to be 'xy', where x is a capital letter from A-G inclusive, and y is either '#', 'b', or nothing.The following lines can appear anywhere in the song body as well as in the header - if they appear in the song body, they will take effect when all notes that appeared before them have been played: You can omit 'n/d=' - if you do so, a note length of 1/4 will be assumed. "Q:n/d=t" - Set the song speed such that notes of length n/d are played t times per minute.if this is not specified, a crotchet is used) "L:n/d" - Set the default length of a note to be n/d (e.g."T:x" - Set the title of the song to be x.The following lines must appear before the song body, else they will either be ignored or cause playback errors: Types of header lines accepted by this library: Where x is a single letter and y is the rest of the line. Comments begin with '%' and can appear anywhere in the file.Here is an exhaustive list of all elements of ABC notation understood by this implementation: ABC files consist of a header with metainformation and details on how to play the song, followed by the body of the song which consists mostly of notes. Music files understood by this library are a subset of standard ABC notation, plus one extra operation. set_tempo(bpm) changes the tempo of the song (in crotchets per minute).changeKey(keystring) changes the key signature.If you want to do weird things to a song while it's playing, the following methods are also exposed: Use channel_set_wave(channel, wave) to change the waveform of tones played by the given channel.Use channel_stop(channel) to stop the note on the given channel.Use channel_play(note, duration) to play a note on the first channel not currently in use or replace the note on channel 3 if they're all in use. Verify that the above are initialised with pwm_is_in_use().Initialise the speakers and timers with pwm_init().If you really hate ABC notation or want to generate notes without calling a blocking method, you can manipulate the synthesizer yourself: Check whether the song is playing or not with abc_is_playing().Stop playback with abc_stop(), or wait for the song to end and it will stop on its own.Waveform generation, however, is not blocking and is done using ISR1) (NOTE: this loops until the song is finished as abc-file parsing is too complex for an ISR, so make sure this task is either managed by a scheduler or is the only non-ISR routine if you intend to use it as background music.Load the file from the SD card with abc_load_file(filename).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |