Where to ask Jack questions

7 replies [Last post]
kellyschrock
User offline. Last seen 3 years 25 weeks ago. Offline
Joined: 2007-01-13
Posts:

Hello,

I'm writing a MIDI sound module for Jack, and I have a question about how to mix multiple samples together. I can get my samples to play correctly, but every once in a while I try to play a specific wave file and it crashes my app. Others cause loud pops to appear in the sound. I've looked on the Jack forums, but I'm not seeing any activity there. The jackaudio.org forums look like they've been overrun by porn spammers, actually. So, I'm wondering where I can go to ask someone a question about how to mix samples and get decent results.

Thanks

sampo
User offline. Last seen 11 weeks 1 day ago. Offline
Joined: 2006-03-16
Posts:

jackaudio.org has forums? The jackit-devel mailing list is pretty active and is a good source for information.

Mixing samples together is ridiculously easy. Just sum the samples: sum = sample_stream_1 + sample_stream_2;

What your problem sounds like is deeper problems than just mixing algorithms. Is your applications real-time safe? Performing system calls (definitely not safe) in the audio thread might cause issues like this.

Distortion can be caused if your sources are too loud to be summed together. So loud that the summed result is out-of-bounds ( abs(sum) > 1.0 ). Another option is that you don't "declick" the samples. "Declicking" means a process where you quickly fade in and fade out sound sources. This makes sure that the summed signal will not contain any discontinuities introduced by abruptly cut sound waves.

paul
paul's picture
User offline. Last seen 1 day 10 hours ago. Offline
Joined: 2006-03-16
Posts:

I am not aware of *any* forums at jackaudio.org or even at the old location on sourceforge. What forums are you referring to, since I would like to remove them. Are you talking about the sf.net site or the jackaudio.org site?

niko123456
User offline. Last seen 5 years 12 weeks ago. Offline
Joined: 2007-01-05
Posts:

speaking of Jack...

Once upon a time JACK used to translate changes in BPM across applications - ie, changing the BPM in Ardour would change the BPM in hydrogen etc..

Has JACK abandoned this ability? Or does it still exist somehow?

paul
paul's picture
User offline. Last seen 1 day 10 hours ago. Offline
Joined: 2006-03-16
Posts:

It still exists. The apps have to agree to use JACK transport info, and one of them must be the time master. Hydrogen has a button to make it slave to JACK transport; Ardour has two buttons, one to make it the master, one to make it sync with JACK transport.

kellyschrock
User offline. Last seen 3 years 25 weeks ago. Offline
Joined: 2007-01-13
Posts:

sampo:

Thanks for the info first of all, this is helpful.

As for system calls I'm making, my mixing code basically operates on a queue, basically a std::queue of samples. The only "system" call that my mixing thread makes that I can think of is to lock the queue with a mutex to remove spent samples, and that occurs outside of the loop where the summing takes place. That could be causing the problem, I guess? (I have to lock the queue to modify it, because a different thread is putting notes on the queue in response to incoming MIDI messages.) If that is the problem, I assume I could move the queue-maintenance code to a separate thread and get around the problem?

I know for sure that I'm not "declicking" my samples... I wouldn't know how to quickly fade them in and out while I'm copying them. Are you talking about something like a multiplier whose value fluctuates between, say, 0.5 and 1.0 and is applied to the summed samples in the copying loop?

Sorry for the n00b questions. I write J2EE apps at my day job. This is new territory for me. :-)

kellyschrock
User offline. Last seen 3 years 25 weeks ago. Offline
Joined: 2007-01-13
Posts:

paul:

I looked for them just now so I could send you the URL where I saw them (at home), but now I can't locate them on jackaudio.org. I'm at work right now, but when I get home I'll take a look and let you know where I found them.

kellyschrock
User offline. Last seen 3 years 25 weeks ago. Offline
Joined: 2007-01-13
Posts:

An update:

I have it working without pops now. For some reason, some of the samples I'm loading (from wave files) have more "frames" in them than can legitimately be played, so processing frames at the ends of them was causing pops. If I stop processing samples about 200 frames before the end, I don't get the pops. I don't know why that is, but it's a start. At least I can record the samples in ardour now without getting gigantic peaks in the tracks that make everything sound bad.