[sdiy] Raspberry Pi 2 Synthesizer Project
Richie Burnett
rburnett at richieburnett.co.uk
Sun Feb 7 20:00:29 CET 2016
> I've been able to get a period size of 8 frames and I'm using a polling
> function instead of a callback. Either way, the period size is much larger
> than 2 frames.
Okay. By "frames" do you mean audio samples? It looks like I'll have to
read up on ALSA if I'm going to make my R-Pi do anything impressive audio
related. I've had it playing and recording WAV files via an external Edirol
USB audio interface (the on-board Audio output is awful quality,) but not
actually processing or synthesising anything in real-time.
> I prefer interrupt per DAC frame, but this worked surprisingly well so I'm
> encouraged to continue.
The block processing scheme is what I am used to myself. One interrupt
generated every 48 samples, or 64 samples or whatever, then you synthesise
another block of 64 samples to re-fill the buffer before they're played out.
Usually in two separate halves: The buffer write pointer and the playback
pointer ping-pong between the halves, so that you are always writing to the
other buffer to the one that the DAC is playing back the audio from. It
increases latency over the one interrupt per sample scheme for sure, but you
generate a lot less interrupts and it's a much more efficient way of working
once you get used to it.
-Richie,
-----Original Message-----
From: Scott Gravenhorst
Sent: Sunday, February 07, 2016 6:36 PM
To: synth-diy at dropmix.xs4all.nl
Subject: Re: [sdiy] Raspberry Pi 2 Synthesizer Project
Richie Burnett <rburnett at richieburnett.co.uk> wrote:
>Great stuff.
>
>Was it hard to get the ping-pong audio buffer stuff working
>properly with the OS and audio driver? I've never programed
>real-time audio on such a high-level platform before. I've always
>had to set up the buffers and DMA controller myself to make this
>sort of thing happen, on dspic33f etc.
>
>Look forward to seeing how you take the project forward.
>
>-Richie,
With the Linux ALSA lib, at least for this system, I've not been able to
get an interrupt or flag per sample time like dsPIC33F easily does.
That's what I'm accustomed to developing with, so ALSA is new/different
for me. I've been able to get a period size of 8 frames and I'm using a
polling function instead of a callback. Either way, the period size is
much larger than 2 frames. Polling is just an infinite loop that calls
a function to try to write already generated data. The function can
return a value that indicates try-again-later. So you loop on
generate-write. I prefer interrupt per DAC frame, but this worked
surprisingly well so I'm encouraged to continue.
-- ScottG
_______________________________________________
Synth-diy mailing list
Synth-diy at dropmix.xs4all.nl
http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7357 / Virus Database: 4522/11573 - Release Date: 02/07/16
More information about the Synth-diy
mailing list