Real-Time Digital Signal Processing

Moderator: flatmax

Post Reply
nbusters
Posts: 4
Joined: Tue Sep 26, 2017 8:27 am

Real-Time Digital Signal Processing

Post by nbusters » Sat Dec 02, 2017 9:24 am

Hi,

I'm trying to build a simple DSP with the Raspberry Pi 3 using the stereo soundcard and could use some help.

Problem:
I have a function generator hooked up to the RCA-in and an oscilloscope connected to the RCA-out. The function generator is outputting a simple sine wave. However, I am not seeing anything on the scope. I've been fiddling with the settings in ALSA Mixer according to some of the threads on here, but so far no luck.

Additional Info:
1) I want to tie the output of the ADC to the input of the DAC so that I can later implement filters in between to filter out noise in real time.
2) I'm planning to eventually do this in python.
3) The goal is to keep latency as low as possible.

Any suggestions/tips would be greatly appreciated. Thanks in advance!

robiwan
Posts: 59
Joined: Wed Jul 05, 2017 1:18 am

Re: Real-Time Digital Signal Processing

Post by robiwan » Sun Dec 03, 2017 6:25 pm

What application are you using to pipe audio from input to output ? I use this and it works nicely:

>alsaloop -c 2 -r 48000 -C plughw:0 -P plughw:0

nbusters
Posts: 4
Joined: Tue Sep 26, 2017 8:27 am

Re: Real-Time Digital Signal Processing

Post by nbusters » Sat Dec 09, 2017 3:00 am

I apologize for not getting back to you sooner.

I was using the wire example from the pyaudio site (https://people.csail.mit.edu/hubert/pya ... re-example) to do it:

Code: Select all

"""
PyAudio Example: Make a wire between input and output (i.e., record a
few samples and play them back immediately).
"""

import pyaudio

CHUNK = 1024
WIDTH = 2
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 5

p = pyaudio.PyAudio()

stream = p.open(format=p.get_format_from_width(WIDTH),
                channels=CHANNELS,
                rate=RATE,
                input=True,
                output=True,
                frames_per_buffer=CHUNK)

print("* recording")

for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
    data = stream.read(CHUNK)
    stream.write(data, CHUNK)

print("* done")

stream.stop_stream()
stream.close()

p.terminate()
I've just ran the command you posted, but still nothing. I just hope it isn't a hardware issue.
Do you know what the ALSA mixer settings should look like for this?

robiwan
Posts: 59
Joined: Wed Jul 05, 2017 1:18 am

Re: Real-Time Digital Signal Processing

Post by robiwan » Sat Dec 09, 2017 3:34 pm

I've put up screenshots of alsamixer settings for the card in this thread: http://forum.audioinjector.net/viewtopic.php?f=5&t=3068

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests