Audio in headphones ruined

Why do recorded tracks sound good when I listen to them in headphones via a sound card, but when I listen to them in headphones without going through the sound card, they sound bad?

Hi there and welcome to the forums!

Could you describe your two listening environments a bit more?
What does this mean?

For the same reason the sound is different whether it’s played on a phone or in the car => different equipment alters the sound differently.

There is a simple explanation for what you have observed.

The key difference when you use your sound card and when you don’t is in the way the audio is CONVERTED (Digital → Analog).

This is why DA converters are sold as standalone units only to perform that single function but do it well.

You need a converter any time you want to listen to music that exists in digital form.

Your sound card must have better conversion than your PC or laptop, if you hear a marked improvement in the sound.

Maybe you are hearing it with some windows audio “enhancements”.
Depends also what you are playing through and what drivers are being used.

You can make sure all of those things are disabled in windows sound settings.

Hi, I’ll try to explain myself better. That is, if I listen to the recording with the setup I recorded with, so Mac, sound card and headphones, the sound is clean, while then when I went to listen to the track with the setup only Mac and headphones connected to the Mac, the sound is like ruined.

You need to provide more details.
What is the samplerate and bit depth of the recording?
Form your description it sounds like the samplerate of your recording is 88 or 96KHz. Mac headphones out can’t handle samplerates higher than 48kHz.

I think the sampling frequency is this one here 44.1, so under 48kHz, and the bits tell me 24… I’m attaching the photo

I am sorry but that expression really doesn’t make anything clearer to us.
Could explain in greater detail in what way the sound is altered?