Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .syntax unified
- .global main
- .type main, %function
- main:
- bl init
- mov r3, 0
- mov r4, 0
- b restart
- restart:
- mov r0,0 @ Initialize r0 to be played
- add r4,1 @ Reference register as the current peak
- cmp r4,5
- ittee eq
- moveq r3, 0
- moveq r4, 0
- addne r3, 2000
- addne r3, 2000
- ldr r6, =array @ Loading the array location
- ldr r7, [r6, 4] @ Loading the first element on the array
- mov r5, r7 @ Use r5 for reference to compare to r7
- ldr r8, [r6] @ Size of the array
- mov r9, 1 @ Array Index
- ldr r10, =duration @ Loading the array location
- ldr r11, [r10, 4] @ Loading the first element on the array
- sub r11, r11, r3
- @mov r3, r11 @ Use r5 for reference to compare to r7
- b positive_peak
- @ normal:
- @ mov r3, 1
- @ bx lr
- @ faster:
- @ add r3, 2000
- @ bx lr
- positive_peak:
- @ ldr r4, =0x7fff
- mov r0, 0x7fff @ Putting the positive peak value to r0 to be played
- sub r11, 1 @ Checking the duration counter
- cmp r11, 0 @ Comparing it to 12000 to change pitch
- beq change_pitch
- sub r7, 1 @ Adding 1 to the counter
- cmp r7, 0 @ Because the Period = 1/f and the BSP is 48khz then to get the period for 1/440HZ we multiply is by 48khz
- @ But we need the point for half of a period because each peak is only half a period
- @ Which is 54.5 but since we can't use float in integer then we use
- beq negative_peak @This will change the peak to negative peak if high peak has reach the half period
- push {r3}
- bl BSP_AUDIO_OUT_Play_Sample
- pop {r3}
- b positive_peak
- negative_peak:
- @ ldr r4, =0x8000
- mov r0, 0x8000
- sub r11, 1
- cmp r11, 0
- beq change_pitch
- add r7, 1 @Substracting 1 to the counter
- cmp r7, r5
- @ bleq change
- @when the subs reach 0 then the negative peak has reach half of the period which is 55 then we change it to positive
- beq positive_peak
- push {r3}
- bl BSP_AUDIO_OUT_Play_Sample @This will play the sound at the particular value of r0
- pop {r3}
- b negative_peak
- change_pitch:
- add r9, 1 @ Add the Array index
- cmp r8, r9 @ Restart if it has reach the array limit
- beq restart
- mov r12, 4
- mul r12, r9, r12 @ Multiply index with 4 to change the array index by *4 each loop
- ldr r7, [r6,r12]
- mov r5, r7 @ Change the reference pitch to the current pitch
- ldr r11, [r10, r12] @ Loading the first element on the array
- sub r11, r11, r3
- @mov r3, r11 @ Use r5 for reference to compare to r7
- b positive_peak
- .data
- array:
- .word 122 @ Array Size
- @.word 122, 130, 122, 122, 109, 109, 122, 122, 130, 130, 122, 122, 97, 97, 122, 0, 122, 130, 122, 122, 109, 0, 122, 0, 130, 0, 122, 0, 97, 97, 122, 0
- .word 132, 0, 111, 176, 0, 111, 0, 132, 166, 166, 166, 0, 0, 0, 0, 176, 166, 132, 111, 88, 0, 111, 0, 132, 74, 79, 83, 0, 0, 0, 0, 118, 0, 88, 132, 0, 88, 118, 0, 88, 0, 125, 132, 0, 148, 0, 148, 148, 148, 0, 0, 0, 148, 148, 148, 0, 0, 0, 157, 157, 166, 166, 176, 0, 111, 88, 0, 111, 0, 132, 148, 148, 148, 0, 0, 74, 74, 74, 0, 0, 0, 132, 111, 88, 0, 111, 0, 132, 88, 99, 0, 0, 0, 0, 99, 124, 166, 176, 99, 124, 176, 111, 132, 186, 198, 140, 166, 198, 148, 148, 148, 0, 0, 0, 0, 0, 105, 99, 88, 83, 66, 56
- duration:
- @.word 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 60000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 60000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 24000, 12000, 12000, 12000, 12000, 12000, 12000, 24000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000
- @.word 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 66000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 66000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 30000, 18000, 18000, 18000, 18000, 18000, 18000, 30000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000, 18000
- .word 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 48000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 48000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 26000, 14000, 14000, 14000, 14000, 14000, 14000, 26000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000, 14000
- @ @196 , 185, 220, 246.94
- @ @122.448 , 129.729 , 109.0909 , 97.189
- @ @132.144, 0, 111.111, 176.379, 0, 111.111, 0, 132.144, 166.481, 166.481, 166.481, 0, 0, 0, 0
- @ 132, 0, 111, 176, 0, 111, 0, 132, 166, 166, 166, 0, 0, 0, 0
- @ 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000
- @ @176.379, 166.481, 132.144, 111.111, 88.189, 0, 111.111, 0, 132.144, 74.158, 74.158, 74.158, 74.158, 78.567, 83.237, 0, 0, 0, 0
- @ 176, 166, 132, 111, 88, 0, 111, 0, 132, 74, 79, 83, 0, 0, 0, 0
- @ Continous
- @ 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 60000, 12000, 12000, 12000, 12000, 12000, 12000
- @ @117.718, 0, 88.189, 132.144, 0, 88.189, 117.718, 0, 88.189, 0, 124.72, 132.144, 0, 148.312, 0, 148.312, 148.312, 148.312, 0, 0, 0, 148.312, 148.312, 148.312, 0, 0, 0
- @ 118, 0, 88, 132, 0, 88, 118, 0, 88, 0, 125, 132, 0, 148, 0, 148, 148, 148, 0, 0, 0, 148, 148, 148, 0, 0, 0
- @ 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000
- @ @157.129, 157.129, 166.481, 166.481, 176.379, 0, 111.111, 88.189, 0, 111.111, 0, 132.144, 148.312, 148.312, 148.312, 0, 0, 74.158, 74.158, 74.158, 0, 0, 0
- @ 157, 157, 166, 166, 176, 0, 111, 88, 0, 111, 0, 132, 148, 148, 148, 0, 0, 74, 74, 74, 0, 0, 0
- @ 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000
- @ @132.144, 111.111, 88.189, 0, 111.111, 0, 132.144, 88.189, 88.189, 88.189, 88.189, 88.189, 98.98, 0, 0, 0, 0
- @ 132, 111, 88, 0, 111, 0, 132, 88, 99, 0, 0, 0, 0
- @ Continous
- @ 12000, 12000, 12000, 12000, 12000, 12000, 12000, 60000, 12000, 12000, 12000, 12000, 12000
- @ @98.98, 124.72, 166.481, 176.379, 176.379, 98.98, 124.72, 176.379, 111.111, 132.144, 186.8722, 197.9, 197.9, 139.99, 166.481, 197.9, 148.312, 148.312, 148.312, 0, ,0 ,0 ,0 ,0
- @ 99, 124, 166, 176, 99, 124, 176, 111, 132, 186, 198, 140, 166, 198, 148, 148, 148, 0, 0, 0, 0, 0
- @ Continous Continous
- @ 12000, 12000, 12000, 24000, 12000, 12000, 12000, 12000, 12000, 12000, 24000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000
- @ @104.876, 98.98, 88.189, 83.237, 66.066, 55.55
- @ 105, 99, 88, 83, 66, 56
- @ 12000, 12000, 12000, 12000, 12000, 12000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement