Skip to main content


The new #uxn audio device supports all 4 channels now and I accidentally did a Steve Reich with the "popcorn" demo lol

Still gotta add the "wait for zero crossing" option to reduce audio clicks but this should be functional enough for some testing.

You can find this test rom here: https://badd10de.dev/share/audio-test.tal

:uxn:

cc: @neauoire @d6

in reply to Devine Lu Linvega

sure, not a problem, note that I swapped some ports around while I was testing things (as you see on my .tal test file) but this isn't super important, we can set them up as y'all think it's best.

Before that though, if you can test the implementation in uxnpd and let me know if all works properly I would try to address the issues as soon as possible.

Remember we still have two free ports reserved for detuning, mode or midi, but let's start with what we got atm.

in reply to Bad Diode

I've pulled your changes, I'll spend the morning playing with it.
in reply to Devine Lu Linvega

awesome, looking forward to see what you come up with 😀
in reply to Bad Diode

I ported about half of oquonie's sounds, but the popping is really bad, is it possible that it's worst than before?
in reply to Devine Lu Linvega

I was about to post this, but I have an initial implementation of the wait-for-zero approach, you can pull the changes and test it out to see if it improves. If not, please record some audio samples and send them my way to take a look.

Here is an AFTER/BEFORE clip.

in reply to Devine Lu Linvega

the popping might be worse than before if you didn't change the attack values compared with before, since now we have a higher resolution, try bumping it up a bit and see if that does it
in reply to Bad Diode

what is the change in resolution like? Is it that a 0x8 nibble, becomes #80?
This entry was edited (1 year ago)
in reply to Devine Lu Linvega

before, each increment was 1/15 seconds (~66ms), now each increment is 10ms
in reply to Bad Diode

testing this through the playdate emulator is a painXD, we should have started with uxnemu haha
in reply to Devine Lu Linvega

sorry, it's what I had more at hand haha you don't have to go crazy with the testing, just let me know if you find issues and I'll do uxnemu when I have some time.
in reply to Bad Diode

well, it still pops a bit, but it's usable. I've done most sounds in oquonie. Porting wasn't too difficult.
in reply to Devine Lu Linvega

if push comes to shove I can add sample xfading between old and new sounds, way more expensive but should be also better sounding. Send me an Oquonie build with the sounds when you have it so that I can optimize for it
in reply to Bad Diode

some sounds I can't port, they just don't make any sound for some reason.

I'm very confused why it doesn't, does this looks right to you?

https://paste.sr.ht/~rabbits/b3efe74827288fabf4dd530f0555d5b85d2f49c2

in reply to Devine Lu Linvega

on mobile so not sure if I’m reading this right, but looks like you are not passing a pitch there right?

The duration is in milliseconds, in principle you don’t really need it unless you are sequencing sounds, you can just play oneshots by sending the pitch. When the time until the duration is due, the audio vector will be called.

Length is the number of bytes that the sample is using. In my example I think I used around 162 for a single cycle of a sine wave tuned at C4 (@44100hz)

in reply to Bad Diode

line12: .Audio0/pitch DEO

Has this changed?

This entry was edited (1 year ago)
in reply to Devine Lu Linvega

for example, I pass #2c for pitch, is this still a valid pitch value? (for octave 2, note G#)
#2C
This entry was edited (1 year ago)
in reply to Devine Lu Linvega

im not seeing the #2c on line 12, in principle the pitch works the same
#2C
in reply to Bad Diode

the pitch is passed to the play-stomp routine via the stack.

This is very strange.. I'll investigate further.

in reply to Devine Lu Linvega

Oh damn, it's the emulator, sometimes the playdate emulator fails to connect with alsa when I close/reopen it. 😠
in reply to Devine Lu Linvega

you can’t see me but I’m shaking my fist towards the sky
in reply to Bad Diode

okay that makes sense, so let's say I have a sample that I'd like to play once.

explosion.pcm

I don't want for it to loop. How do I find the duration? Right now, single-hit samples will play in a loop. Do I multiply the pitch with the length or something to find the real length of a single hit?

in reply to Devine Lu Linvega

no need to set the duration in this case, just the data addr, sample length and adsr and write the pitch. The looping should work as before, with a single bit indicating if it’s a looping or non looping sample. Writing the pitch is what triggers the sound. If this doesn’t work I may need to do some fixes.
in reply to Devine Lu Linvega

I think I hardcoded the looping on the audio callback for testing and forgot about it, oops!

I'm going to add the sample xfading and make sure one-shots play properly without looping.

Will keep you posted!

in reply to Bad Diode

Ok, I added sample cross-fading for new sounds so even samples with 0 attack will properly play without clicks.

Right now the XFADING amount is of 100 samples (around 2.26ms @44100) but this can be configured at compile time.

Also fixed the looping issues and updated the demo, which now uses 3 channels for playing popcorn (via audio vectors) and 1 channel (Audio0) to play a one-shot kick sample when pressing the B button.

@neauoire make sure to check: https://badd10de.dev/share/audio-test.tal

in reply to Bad Diode

thanks! I'll pull and try it out this afternoon 😀

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.