AsahiLinux / asahi-audio

Userspace audio for Asahi Linux
MIT License
130 stars 12 forks source link

t2 linux #5

Closed lemmyg closed 1 year ago

lemmyg commented 1 year ago

Thanks for the amazing work with mac speakers.

Probably you already know, there is a project call T2 linux. We are facing exact same issue with T2 mac speakers. You work is so helpful for us. I have been testing your tirs in my macbook 16.1 2019. Unfortunately they don't much exactly but is an starting point. I just wanted to contact and let you know that we are following your work. If you need any help from me for testing stuff just let me know. I know that speakers are not exactly them same. Subwoofer are very similar, tweeter no. Better try it,

https://wiki.t2linux.org/

https://discord.com/invite/68MRhQu

Thanks Galder

chadmed commented 1 year ago

Thanks for reaching out. I have an A1708 which I believe has the exact same arrangement as all later 13" models do, and agree that the IRs for the J31x-es are not suitable. I don't really have the resources at the moment to invest in a secondhand T2 machine, or really any other machine at all for that matter, so unfortunately I'm unable to directly help out. The test_notes folder has a haphazard screed in which I try to document what I did, which may be a good place to start for working out how to embark on this yourselves. I don't use Discord but I'm happy to leave this issue open to consult. Alternatively, just email me.

lemmyg commented 1 year ago

Hi James, thanks for your quick reply. I understand that must be difficult to find new models. Specially when macs are very expensive. Maybe we could try by ourself and try to help you with other models. Also maybe find some student of sound engineering that would like to collaborate. It would be very useful if you could share your Carla, Rew scenes.

About last night IRs, I just want to give some feedback. Feel free to correct me if I'm wrong. Basses sounds much better. But still I missing very low freq. In MacOS I can hear strong 40hz 30hz signal generated with Audacity.In Linux almost nothing. Maybe is model difference?

About using same IR for subwoofer, I think is correct, I believe their are dual opposed subwoofers. At least for 6 speakers models. I could confirm it last night. Decreasing one of the speakers I could notice a vibration, with 2 not vibration in my laptop. So I understand that they cancel each other. "High‑fidelity six‑speaker system with force‑cancelling woofers" Tweeter are very high but probably because different models? For now I need to decrease them 30%.

Overall, I would say that it sounds much better, like 70% of what MacOs does. Which is far much better that no dsp horrible sound!

Feel free to close this issue. If I need to contact you I can raise a new one or send you an email. Also come by to the T2 group, there is many people collaborating there.

Feel free to contact me if I can help with anything.

Thanks for everything, at least now I can watch a film in my linux mac :) Galder

chadmed commented 1 year ago

The current woofer IR has a HPF set at 50 Hz, which is why you can't hear anything below that. Trying to bump the bass response much harder results in severe clipping, and I'm all but certain Apple's doing some funky stuff with phasing to overcome this (their IR plists make reference to imaginary numbers). I don't really fancy going down that route at this point in time.

As for Carla/REW settings, I dropped using Carla a long time ago and just do everything in REW now since I captured the response curves of the drivers with a calibration mic. REW doesn't really have scenes or presets, you just set EQ filters based on the response curve and then export that as an IR in a format of your choosing.

lemmyg commented 1 year ago

Thanks for your reply. Very interesting the phasing thing in very low freq. I'll try to follow some Rew tutorials as this tool is new for me. I have some experience with DAWs but I never did anything like sound engineering and calibration. I'm thinking of buying a second hand calibration mic(miniDSP UMIK-1), just to have some fun and learn something. Looks like it is the cheapest mic for this job. Thanks for your time, I don't want to bother you more. Regards Galder

On Fri, 28 Oct 2022 at 02:37, James Calligeros @.***> wrote:

The current woofer IR has a HPF set at 50 Hz, which is why you can't hear anything below that. Trying to bump the bass response much harder results in severe clipping, and I'm all but certain Apple's doing some funky stuff with phasing to overcome this (their IR plists make reference to imaginary numbers). I don't really fancy going down that route at this point in time.

As for Carla/REW settings, I dropped using Carla a long time ago and just do everything in REW now since I captured the response curves of the drivers with a calibration mic. REW doesn't really have scenes or presets, you just set EQ filters based on the response curve and then export that as an IR in a format of your choosing.

— Reply to this email directly, view it on GitHub https://github.com/chadmed/asahi-audio/issues/5#issuecomment-1294306303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFKRHD4SMKVRT5ZBM4FTTTWFMU63ANCNFSM6AAAAAARPGILFM . You are receiving this because you authored the thread.Message ID: @.***>

lemmyg commented 1 year ago

Hello James, finally I manage to adjust the settings to make it work on my MacBook pro 16,1 2019 with T2 audio driver. I would like to share those settings with T2 kernel team but first I need to ask you for permission. The FIRs are not specific for a 16,1 but is much better that nothing and it would be an starting point to understand the process for T2 kernel team. here my changes: https://github.com/chadmed/asahi-audio/compare/main...lemmyg:asahi-audio:macbookT2_16_1

Regards Galder

chadmed commented 1 year ago

Of course you have my permission, this project is MIT licensed.

I've left some comments on that branch.

lemmyg commented 1 year ago

that's great. Unfortunately I can't see your comments

lemmyg commented 1 year ago

Hello James, finally I manage to get a UMIK-1 measurement microphone. I took some measurements and upload them in my branch in case can give some extra information for mac speakers. I noticed that there is some floor noise in the low frequencies as I don't have a proper place. I do my best., still learning :) https://github.com/lemmyg/asahi-audio/blob/macbookT2_16_1/test_notes/mac161_fr/speaker_16_1.mdat

I can see that measurement from MacOs and Linux with your FIRs are pretty similar.

Regards Galder

chadmed commented 1 year ago

@lemmyg I have some new unpublished work which drastically improves performance (on my machine at least)

Also re the noise at the low end, there is a fix for that which I will be touching on briefly in a blog post soon. It involves a lot of magic and DSP operations that I have no clue how to implement, so I have no ETA on it dropping in Linux :P

chadmed commented 1 year ago

Your measurements also look fine to me but you should read up on providing cal files to REW so that it's repeatable. I don't have a calibrated mic so I can't really help you on the specifics of that but the UMK-1 is well supported and IIRC is the example used in the REW help files for calibration.

lemmyg commented 1 year ago

Hi @chadmed, thanks for taking the time to have a look my measurements. I was looking in the REW forums and it looks like the floor noise is normal for home environments. I'm also following REW and UMK-1 documentation. UMK-1 microphone only needs the calibration file that I'm already using it. So I will just to ignore those very low frequencies. I took the measurement with -12dbfs signal and the system volume to 75 dbs.

About missing Apple low subs. Apple probably have best sound engineers doing black magic:). Because how is possible that they manage to reproduce 30hz clearly in those tiny speakers.

About following your work, I find difficult to adjust your FIRs as once imported in REW is like a black box. I don't really know which filters were applied. Also when I exported again, I got like a delay. Probably because that's not the way to do it.

If you could share your measurements and filters, would be more easy to follow your work and adjust it for other models. I can understand if you are not happy with it.

Looking forward to see those latest changes.

Regards Galder

chadmed commented 1 year ago

I understand exactly what magic Apple are using and how it works, I'm just not good enough at writing DSP code or the maths behind it to actually implement it (it's a feature that LADSPA is missing but sorely needs) :P

As for my data, I have no problem sharing if you really need it, but I don't think it's going to help you really. You won't be able to see the "filters" I apply because the IR in a way abstracts them away. Keep in mind that what you're aiming to do here is apply EQ filters to the measurement that flatten it out (or better yet sound good to your real human ears).

Seeing what filters I apply for this specific machine is irrelevant for the purposes of the T2 machines since you will need different ones based on your measurements. It's all about evening out the frequency response so that there aren't huge differences between frequencies. I recommend using the psychoacoustic smoothing feature for visualising this since it will take noise out of the graph. You should aim to flatten out the response such that the largest delta in response between "nearby" frequencies is no greater than 3 dB. Once you get good, you can try dialing it in even further!

chadmed commented 1 year ago

And the delay effect is because you have not applied the IR window to your exported IR. Tick the "Apply IR Window" option when you're exporting.

lemmyg commented 1 year ago

thanks for your reply. About the filters, I think you could export them as text. It would be a good reference. Is a shame that REW doesn't have a proper scene save mechanism.

So in theory I need create some crossovers to separate the speakers. subwoofers and tweeters and them try to flatten the response as much that I can. finally test them with different samples and take more measurements.

Thanks for the "Apply IR Window". I was suspicious with that feature but I thought that maybe import FIRS and exporting it maybe wasn't the way to do it.

lemmyg commented 1 year ago

About the apple magic, does it have any name or is there any paper about it?

chadmed commented 1 year ago

If you do a search for "psychoacoustic bass" theres a couple of IEEE papers about it but not much else. It's a really neat trick though, and you should be able to implement it with a couple of biquads.

lemmyg commented 1 year ago

thanks for your reply. it looks like the famous maxxbass plugin. Ill have a look if I can find any code example in github.

lemmyg commented 1 year ago

Hi @chadmed, I was looking for bass enhancement examples. I found that Easy effects has a plug-in but also Carf. https://calf-studio-gear.org/doc/Bass%20Enhancer.html Calf's plug-ins are LV2, so it should be possible to integrate in the pipe-wire chain. Just that. Regards and have a good Christmas :) Galder

lemmyg commented 1 year ago

Hi chadmed, I pushed some changes in https://github.com/lemmyg/asahi-audio/tree/macbookT2_16_1 you maybe interested. I added the REW measurement with EQ filters. Regards

chadmed commented 1 year ago

Nice!

I have a feeling that the speakers probably still sound boxy/honky when the volume is not set to the maximum, or wherever you took your calibration measurements. Is this the case?

lemmyg commented 1 year ago

Hi chadmed, I'm not sure. I could be that you don't have same speakers? Also I have been taking measures in my room. Could not be the best place for this job. Or finally me, no having any idea. :) The best way I found to get some improvements was taking measurements on MacOs and then in Linux each speakers separated. Add the filters to each FIR until the measurement matches macOS. Now I'm continuing tweaking, listening some samples in different places and comparing again. Some people in T2 team has started testing my setup. Probably Ill get some feedback soon. Regards