DINAS big brother(s...
 
Notifications
Clear all

DINAS big brother(s)

Page 4 / 5

ElliottDesigns
(@elliottdesigns)
Estimable Member Moderator
Joined: 2 years ago
Posts: 245
 

@ajc9988 oh, ok. Raspberry Pis really are designed to run using an operating system, I'm implementing my FIRs with a convolution plugin built into a package called EasyEffects which I use on an operating system called Manjaro, but then again, we have very different use cases. Seems like for your use the Arduino is probably the better solution, especially for the price! I'd love to know how you get on with it!

Elliott Dyson - Mechanical Engineering Student and 3D printing & Design Freelancer


ajc9988 liked
ReplyQuote
ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@elliottdesigns - I've actually found some interesting ways to accomplish using the RPi, although some applications actually have the RPi as a slave due to a specific needed clock generator found on the ADAU1701 but not the RPi, making it easier to make the RPi a slave. Others allow different builds and using drivers to support the ADAU1701. So, if need be, and if the results would be better, I could incorporate the RPi which would have better support for things like ethernet, while still using the i2s to connect the two.

I was wondering, how does your memory usage look on it while running your FIR?

I also could do a different layer of abstraction, where I integrate the arduino microcontroller working with the ADAU1701, then setup an RPi for a pre-amp to take in signals and then output them to the speakers.

This is why I'm trying to research if this can do what I need, as the arduino plus the SRAM and PSRAM chips puts it at $30, and if I grab a couple other things, the price goes up, while I can grab the RPi4 2GB for around $35-42, depending on the website. Prices excluding shipping. So at this point, I am still open for which row to hoe, so to speak.

 

Edit:

Explanation of clocks needed to support system timer for RPi:
http://www.crazy-audio.com/2013/09/raspberry-pi-auda1701-dsp/

https://ez.analog.com/dsp/sigmadsp/f/q-a/65427/connect-raspberry-pi-to-adau1701-via-i2s-bus

More on being slave:
https://community.volumio.org/t/adau1701-dsp-and-slave-i2s-kernel-module/1962

https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=8496&start=400

Drivers:
https://github.com/MKSounds/ADAU1701-I2S-Audio-Driver-for-Raspberry-Pi/blob/master/adau1701-i2s.dts

Audio Codec:
https://github.com/raspberrypi/linux/blob/rpi-4.1.y/sound/soc/codecs/adau1701.c

https://github.com/torvalds/linux/blob/master/sound/soc/codecs/adau1701.c

These are some of the pages I have looked at, but that I could find again quickly. The one about the clocks on analog is better. 

Also, I haven't heard Manjaro in awhile. I never used it, but my friend in undergrad was using it while going to school for comp. science. I still haven't made the jump to linux fully, but can get around well enough.


ReplyQuote

ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@elliottdesigns -  So, because the 2GB version is sold out so many places, I sourced a 1GB version to start work to see if it is viable for inclusion as a slave. I did so under the theory this has 1MB of L2 cache and 1GB of memory. If the code is optimized enough, it should not need to hold too much in memory in order to process, especially since the current research suggests for lip sync, you can go -125ms to 45ms and there still be sync fine for people. If true, and looking at 20,000 coefficients taking 0.367 sec., or in your example 1M coefficients in 0.4 sec (400ms), in theory it would only be able to do around 100,000 coefficients or less to return the signal within the time period for lip sync. Considering this is still higher than the theoretical 2,000 for the Teensy 4.1 or the 550 I currently have set on the ADAU1701, so long as 1-2GB RAM is enough for the overhead (which is considerably more than is found needed on the other products, but doesn't mean the additional overhead related to the differences in products doesn't necessitate more memory), then there is a chance, even though expensive, that it may have the most robust solution for applying a FIR filter in this case for what I have already purchased.

Many do not have the 2GB version available and are back ordered until October to December. As such, just starting development now may be the way to go, so that if it is a dead end, I can drop the idea by sometime next month and go with another route.


ReplyQuote
ElliottDesigns
(@elliottdesigns)
Estimable Member Moderator
Joined: 2 years ago
Posts: 245
 

@ajc9988 Thought just occured to me, how are you using the Arduino for audio processing? I would have thought it was only 8bit capable, no? I'd love to hear more about what you are doing with it!

Elliott Dyson - Mechanical Engineering Student and 3D printing & Design Freelancer


ReplyQuote

ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@elliottdesigns - I'm starting with trying the RPi4. But this is where talking shop on specs of the Teensy 4.1 come in, discussing arduino code ran on other platforms (you can run it on RPi with modifications, part of the reason I decided to try to make the RPi work first before switching back to the Teensy), and how this would work.

First, let's talk the Teensy 4.1 specs. It uses the ARM Cortex-M7, which has the built in DSP dedicated hardware. https://www.pjrc.com/store/teensy41.html

image

As you can see, this can do floating point 32 and 64-bit math, 8MB flash memory, 1MB Ram, expansion for ram or flash chips on the developer board. So this isn't exactly arduino, and that gets to the next point.

Analog Devices, the maker of SHARC, the ADAU chips, sigmastudios, etc., has already worked with the Teensy 4.1, running arduino code, to run as a slave device to their other products. They have done this because the Arduino Uno or Duo (forgot which ATRM) was once used in conjunction with their projects to increase crunching of numbers, so they have how the code interacts with their software down. You could make it work with other code, but there is something to not recreating the wheel. So when I brought up Arduino, I was meaning the arduino code which can be more readily optimized for use with RPi for my purposes than recreating it in a deeper dive into raspbian optimizations, etc. Instead, it is doing the changes to the arduino code they already have, which they already adapted for the Teensy 4.1, to also work with the RPi 4.

Analog has an export function of the code created in sigmastudios which can work with Arduino (there is a little more to it than this, but in essence, it is this exporting that is why arduino got brought up). In other words, when you have the devices connected to sigma studios, you can design the flow of processing to include the offloading of the DSP functions that are faster on the modern ARM processor, especially with NEON for floating point calculations and some integer work otherwise, to then increase how much you can do with FIR filtering and any advanced additions you might have to make, such as using all pass filters cascading to address phase shifts if needed, etc. So the arduino code, which already has been worked on, is the important part, not an actual arduino itself, which at this point is slower than the Teensy 4.1 or the RPi 4.

So, what I am doing is having the signal come into the ADAU1701 JAB5 board, mainly because it has to be the master due to the master clock which is used for the timing signals related to the music processing, with a 12.288MHz crystal, meaning 48,000Hz native. You then use the i2s in and out on the board to send the signal to the developer board. Normally I'd prefer one jump, going from the RPi as master to the slave ADAU1701, but to do so, I'd have to develop the external clock board, then have both point to use that for MCLK, which the JAB5 has more limited pin connections to do this with. If developing the board from scratch, you could throw both chips on the same board and have more direct communication without as much jitter through the connecting of two boards, while optimizing one as the co-processor to the other. But that is not this project.

After setting up the RPi 4 or Teensy as slave, you take in the signal from the master (I need to play with this to see if I can create a scenario to allow input from the RPi4 to somehow be put through the processing loop, but that is why I wanted to start working on the project now to figure out the limitations of doing it this way, which isn't as well documented as I would have hoped), then route it over the i2s out to the RPi appropriate GPIO pins you change the arduino code to point to, then have the RPi apply the FIR filtering, returning the signal back to the ADAU1701 over the i2s in, to then have the three channel crossover applied to split it to the individual speaker channels, which then gets sent to the integrated amp and onto the speakers.

Now, I did mention about other inputs. I know people have gotten the CEC to work with an RPi so that a remote can control outputs on the RPi. But there isn't much information on if the RPi 4 has the pin for ARC connected or not (on the B+ from around 2014 or 2015, it was not). So determining that is of import, because if the hardware is capable, then it moves to software side, which once again, I'm not sure I can add inputs to the slave device into the chain, even though I know outputs on both master and slave are possible. This goes with also using the internet connection on the RPi as well.

Regardless of the additional inputs, the goal is to add the superior crunching power of the RPI4 chip into the line in order to apply a better FIR filter to the signal, considering it should greatly exceed the 550 coefficients of the ADAU1701.

Now, this is to do fully in speaker. Why? To basically make the speaker response as flat as possible and to minimize additional processing, considering you could place the speaker and then calibrate the FIR filter meaning the filter is serving both as the room correction filter and the speaker response filter. That reduces the need to do that using a receiver. And sure, there are questions on number of times through the ADCs and DACs, quality of the components doing the conversion, etc. But what I envision with these speakers, since they are powered, is first getting all that correction dealt with on speaker so that at most you need is a pre-amp, if not simple audio extractors or HDMI audio decoders, etc. to split out the source to go to the speaker to do the rest of the work. Eventual development into further products incorporating better quality components can come later. Proof of concept is first. And that is where using previously tread ground in order to integrate these into a plate amp is my first step.

Does this make more sense now?


ReplyQuote
ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@elliottdesigns - so, an update if you are considering using Raspberry Pi with ADI products (Analog Devices Incorporated, which makes the ADAU line of codecs and SigmaDSPs, Blackfin, Sharc and Sharc+, DACs and ADCs, etc.), ADI has their own version of the Linux kernel for Raspberry Pi specifically. Here is the link to that:

https://wiki.analog.com/resources/tools-software/linux-build/generic/raspberrypi

The documentation is a little outdated as the most current version of the OS that they have is 5.4.y, not 4.14.y.

https://github.com/analogdevicesinc/linux/tree/rpi-5.4.y

This can be used by also creating driver modules from their more detailed drivers on github. I attach the image I copied into /boot, replacing the kernel7l.img file in that folder. Obviously, if you need customization, it is better to just git the list and compile your own kernel, using make menuconfig to customize as needed. I made very few changes from their stock config, so if you need more specificity, something to consider.

Today, I will be trying to get the programmer to communicate with the RPi over I2C and getting the ADAU1701 to communicate with the RPi over SPI (and figuring out where to connect each of the clock generators to get proper data transport between the two). Then, I will see where to go from there once all the hardware can talk to each other, including, if needed, signal delays put in if needed so that both master and slave don't collide on trying to command the port on boot, etc.

How's your progress going?


ReplyQuote

ElliottDesigns
(@elliottdesigns)
Estimable Member Moderator
Joined: 2 years ago
Posts: 245
 

@ajc9988 Thanks for the update, got the Rona so not too much has changed. Temporarily leaving the smart speaker side of the project alone and going with a simple FIR DSP with the Teensy for now, so I can save money and get at least a 4.0 setup working. Haven't got myself a Teensy board yet to test it out, but I'm sure it will be fine 👍.

Elliott Dyson - Mechanical Engineering Student and 3D printing & Design Freelancer


ajc9988 liked
ReplyQuote
ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@elliottdesigns - sorry to hear about that. I had it last year toward the start. Had hot and cold sweats all night, aches all over, doing nebulizer treatments, oral steroids and IV steroids for when I went to the ER, and a prophylactic of broadband antibiotics to prevent secondary infection. It lasted about 10 days for me, was about like catching a bad cold or a flu (for context, I've had pneumonia that ate a hole in the left bottom lobe of my left lung filling it with blood where they thought I had a punctured lung; I was life flighted and in the ICU with pneumonia a different time for 13 or 14 hours, then was in an induced coma with pneumonia the next year, being under for 3 days that time; so I've had so many seriously life threatening lung ailments along with my asthma that this I place in that category, while also having sought emergent care decently early and was in the ER the following day, then it got better over the rest of the period). So I hope you feel better.

I can understand that. I'm to the point of trying to get everything to talk, but sigmastudios only has the ability (that I can find so far) of acting like a microprocessor to program or load the program onto the DSP chips they have. I posted on their forum asking if they have a way to offload the SIMD instructions for their DSPs over to the RPi4 (with the NEON SIMD processing), so I will find out more soon and will continue to play.

If that doesn't work, for the more expensive route, I could always use a DAC HAT for the RPi4 to take the signal in, do the FIR filter, and then connect the audio out to the audio in on the JAB5, then just fill out the program on the ADAU1701 doing other tasks since that was done. I could look into inputting the signal over i2s, but let me first do more research.

Either way, step by step.


ReplyQuote

ElliottDesigns
(@elliottdesigns)
Estimable Member Moderator
Joined: 2 years ago
Posts: 245
 

@ajc9988

Sounds like I'm quite well off compared to what you went through, hope you recovered well.

Something you might want to do if you end up using multiple pi's for processing is to set a constant clock frequency so that all devices have the same latency, otherwise it fluctuates. As for setting up the communication, it certainly sounds difficult.

If you can find a DAC hat with aux in; I definitely think that would be a wise choice, unfortunately I couldn't do that since all the board's you can get in England were output only. You can always attach a USB dac if you can't find a hat though.

I did find this: https://github.com/bmillier/FFT-Convolution-Filter-Uniformly-partitioned which is how I am now able to move over to the teensy since it allows for enough taps compared to the standard 200 limit. Not sure if you came across it, it seems a lot easier of a method and might suite what you are trying to do better too, since you are just trying to do processing rather than using the pi as a source for example. Also seems like a dirt cheap DIY alternative to the miniDSP 2x4hd if you use a few of them. Not high bit rate or sample rate though.

Also, we should probably have a separate section for this. Maybe "Active Crossovers and Manual room correction"? @123Toid

Elliott Dyson - Mechanical Engineering Student and 3D printing & Design Freelancer


ReplyQuote
ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

I'll definitely take a look @ElliottDesigns . As to miniDSP, most don't know but the original 2x4 was an ADAU1701 whereas the 2x4HD is one of ADI's Sharc chips. If I was buying a Sharc chip, I'd go for a developer board I saw for around $250 over the miniDSP 2x4HD. Not because that product is bad, just because I could get more bang with a newer Sharc or Sharc+ doing it that way. 

https://www.hifiberry.com/shop/boards/hifiberry-dac-adc/

That is an example, which is funny because it seems all they did is switch the headphone jack from output to input. But, that still is priced with the RPi fast approaching paying a fair amount (remember, I already have 4 JAB5s, so the solution is beefing up their capabilities, at least for this project). But, if need be.

I found out instead of using the SPI connections (which JAB5 uses SPI to setup their master and slave), it was recommended to me to use serial to connect the ADAU1701 to the RPi by ADI. I'm supposing use the i2c then, but shot an email to Wondom to see what they recommend. 

Best way I can think to run the filter (because he didn't mention that sigmastudios could program for the RPi to do the FIR filter) would be to route the signal to the RPi and create a little program just to grab it and apply the FIR and shoot it back. Not sure yet. Or find a program already made for RPi that could take the serial in and do a FIR and output it over the same. 

Just trying to figure the best way to do this.

And an active crossover and manual room correction section sounds awesome. Main reason it is in this thread is I plan to use this on my speakers. But, would possibly be worth having a devoted section or thread.


ReplyQuote

ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

So, part of my problem was the design for the software to run on the JAB5. I have at least created better working files for it. As such, here are the sigmastudio files to have a working FIR and working IIR based autoEQ. There are built in filters to add time shifts if needed, as well as a baffle step compensation filter and an infrasonic filter. The four knobs are for master volume, gain low, gain mid, and gain high. That way you can adjust volume and volume per driver (I have the knob setup after the crossover for the gain, thereby meaning it will be solely on the basis of that driver, not a frequency range being adjusted with gain).

Benefits of autoEQ: FIR takes processing more coefficients, which means more processor instructions and resources taken to process the filter. IIR takes fewer resources to do the same task. Seems like a no brainer until the drawbacks. IIR also relies on a feedback loop done to create the filter by using samples to optimize the placement of each tap, etc. It then allows to do the same after creation of the filter (which can be done in REW, then you move those settings over to the sigmastudios software).

Drawbacks of autoEQ: AutoEQ can lead to having a loss of phase coherency (not just time shifting). Polarity is sometimes called phase, and this can flip the signal by 180 degrees. But, an all-pass filter can be used to shift the phase by 90 degrees. 3xall phase is around 270 degrees for phase. But I have not yet learned if there is a way to fine grain tune the phase of the signal. So the risk on phase is there. The filter has settings for alignment and auto align, but this refers to delay and gain. So, just a reminder, autoEQ could have phase considerations. Be mindful of this when using it, but do not be afraid to use it.

 

P.S. this time the two programs are tested as outputting noise properly. This is only one channel. To do the other channel, create a second save file, then switch the input from 0 and 4 to 1 and 5. That way you get a left and a right speaker. The 4 and 5 are the inputs for Bluetooth. The 0 and 1 are for the input over wires.

Edit:

Still working on the RPi part, but was just getting noise back. I've seen reports of that both for connecting the wrong things or that the cables are not shielded and having interference for the jumper cables. That is a WIP. But the above files get it closer to a working solution either way (580 coefficients for FIR; no longer getting the -6 dB I was getting from other working files, so proper signaling unlike before; and working).


ReplyQuote
ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  
image
image
image
image
image

Bracing for the subwoofer part of the cabinet. 1269.32 cubic inches of bracing (excluding the volume of the vent shelf shown in the final picture tagged, which is 379.22 cubic inches).

@123Toid @pieter @Chedwin - tagged you guys because it seems you might be interested in the bracing design.


ReplyQuote

Pieter
(@pieter)
Eminent Member Registered
Joined: 4 months ago
Posts: 37
 

@ajc9988 

That looks great and I think stable.


ReplyQuote
Chedwin
(@chedwin)
Eminent Member Registered
Joined: 5 months ago
Posts: 32
 

Looks great but I have to wonder how you will assemble this? how will you attach the horizontal notched pieces? your trying to link 2 closed rings!

 

image

Josh Evans
- Professional Live Sound Engineer
- High End Commercial AV Install Technician


ajc9988 liked
ReplyQuote

ajc9988
(@ajc9988)
Estimable Member Registered
Joined: 7 months ago
Posts: 172
Topic starter  

@chedwin - Correct. Which is why there will have to be cutouts. Now, each brace is two pieces of plywood glued together. So, by cutting each of the two pieces wide enough to slide the smaller horizontal ones inside, then gluing the two pieces of plywood together, you can avoid a weakness if you had glued the two pieces of plywood together first and then cut a hole for the smaller ones to fit through. Further, by cutting in two different places, the uncut other piece for that spot acts as a scaffolding when you glue the cut piece back in.

So that is how I plan to do that part of it.

This is only a brace for one off type manufacturing, as it is not practical for large scale. Bracing done in the way of GSG's offerings (see below) would be a better way of doing it. Very similar, but slips together to form the bracing. I just have not given it enough thought to fully do it their way. Also, I do not have a CNC router, otherwise doing a design like theirs would be fairly trivial.

image
image

123Toid and Chedwin liked
ReplyQuote
Page 4 / 5

Newegg

Share:
%d bloggers like this: