Hello,
I've been playing with audio recently, and noticed that if I set the
third nibble of the short sent to .AudioX/asdr to anything other than
zero, the ending note will loop, playing endlessly.
Using the latest uxn{asm,emu} from https://git.sr.ht/~rabbits/uxn, on
Linux, I am able to reproduce the problem with this code:
|30 @Audio0 [ &vector $2 &position $2 &output $1 &duration $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
|0100
#01 .Audio0/duration DEO ( bug happens whether this line is here or not )
#2460 .Audio0/adsr DEO2
;noise-pcm .Audio0/addr DEO2
#0100 .Audio0/length DEO2
#99 .Audio0/volume DEO
#15 .Audio0/pitch DEO
BRK
@noise-pcm
c9 d0 82 fa 0c cb 11 fb e7 eb 79 7f c8 13 0d fe
fd 7b e7 19 1d cb de 8a a8 76 79 37 4b 5c 1e d0
46 d6 4a ac 6d c7 66 bc 5a 8d c0 fb 97 f0 c5 31
16 ef ca a6 b7 09 eb 09 8e b3 4e 52 cb 3d 53 e1
65 93 b6 5c c6 b0 34 14 c0 33 e8 0b 6a 78 c5 24
d1 d9 03 52 c0 06 26 8f 6f 3c 54 7c 23 16 14 62
07 f0 e2 bf cb bd 5f b2 f3 0b 20 50 9f eb 15 6f
85 55 30 b9 3f 65 0b 76 61 b8 84 bc 62 58 af df
70 3e 03 6f c3 46 9d 52 93 f4 e5 61 e1 28 d4 20
0c 89 f5 21 21 ef b1 b4 8e be 61 11 b8 c1 9d c0
31 56 0e ff 28 2a 20 e4 7d 39 3f 93 7f 71 ec 8b
6f 50 88 73 74 fe 41 82 92 42 67 59 44 06 f6 63
25 98 b3 d1 10 4f db b6 6f 9d 3b 6e 63 ec a2 d6
a1 ae 0b ae b1 37 85 57 84 01 4b c7 a2 55 5e f9
50 18 b6 bc cc 2c c2 44 d5 05 fc 47 b1 e6 b8 26
22 d9 aa f4 3b 57 47 e4 e7 31 98 40 c7 d6 f0 a0
I am also able to reproduce using piano.rom, by setting the sustain to
non-zero.
Also, this may or may not be related, but I notice that the octaves < 4
on piano.rom don't really play any sound?
Seeking aid. :)
Warmth,
~ Kira
Hi,
Charlie and I did some digging, and made some findings:
1. The infinite looping audio bug was introduced in the commit 49eda85851edbd65cf545468c23bfa4dd035a962. It can be reproduced in the stock piano.tal ROM.
2. The logic in env_advance() does not match the documentation at https://wiki.xxiivv.com/site/varvara.html#audio, which I'm assuming to be the canonical "correct" logic.
Some differences:
- Docs say DECAY is held until it reaches 50% volume. Code says hold DECAY until "env->vol <= env->s".
- Docs say SUSTAIN is held for the value given (as 15ths of a second). Code says hold SUSTAIN forever always.
Curious & hopeful that some of the authors of this code (or anyone else)
have capacity and experience to investigate & fix.
~ Kira
On 12/20 09:51, Kira Oakley wrote:
> Hello,
>
> I've been playing with audio recently, and noticed that if I set the
> third nibble of the short sent to .AudioX/asdr to anything other than
> zero, the ending note will loop, playing endlessly.
>
> Using the latest uxn{asm,emu} from https://git.sr.ht/~rabbits/uxn, on
> Linux, I am able to reproduce the problem with this code:
>
> |30 @Audio0 [ &vector $2 &position $2 &output $1 &duration $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
>
> |0100
> #01 .Audio0/duration DEO ( bug happens whether this line is here or not )
> #2460 .Audio0/adsr DEO2
> ;noise-pcm .Audio0/addr DEO2
> #0100 .Audio0/length DEO2
> #99 .Audio0/volume DEO
> #15 .Audio0/pitch DEO
> BRK
>
> @noise-pcm
> c9 d0 82 fa 0c cb 11 fb e7 eb 79 7f c8 13 0d fe
> fd 7b e7 19 1d cb de 8a a8 76 79 37 4b 5c 1e d0
> 46 d6 4a ac 6d c7 66 bc 5a 8d c0 fb 97 f0 c5 31
> 16 ef ca a6 b7 09 eb 09 8e b3 4e 52 cb 3d 53 e1
> 65 93 b6 5c c6 b0 34 14 c0 33 e8 0b 6a 78 c5 24
> d1 d9 03 52 c0 06 26 8f 6f 3c 54 7c 23 16 14 62
> 07 f0 e2 bf cb bd 5f b2 f3 0b 20 50 9f eb 15 6f
> 85 55 30 b9 3f 65 0b 76 61 b8 84 bc 62 58 af df
> 70 3e 03 6f c3 46 9d 52 93 f4 e5 61 e1 28 d4 20
> 0c 89 f5 21 21 ef b1 b4 8e be 61 11 b8 c1 9d c0
> 31 56 0e ff 28 2a 20 e4 7d 39 3f 93 7f 71 ec 8b
> 6f 50 88 73 74 fe 41 82 92 42 67 59 44 06 f6 63
> 25 98 b3 d1 10 4f db b6 6f 9d 3b 6e 63 ec a2 d6
> a1 ae 0b ae b1 37 85 57 84 01 4b c7 a2 55 5e f9
> 50 18 b6 bc cc 2c c2 44 d5 05 fc 47 b1 e6 b8 26
> 22 d9 aa f4 3b 57 47 e4 e7 31 98 40 c7 d6 f0 a0
>
> I am also able to reproduce using piano.rom, by setting the sustain to
> non-zero.
>
> Also, this may or may not be related, but I notice that the octaves < 4
> on piano.rom don't really play any sound?
>
> Seeking aid. :)
>
> Warmth,
>
> ~ Kira