Go Back   Home > Forums > >

PC Based Computer music servers, crossovers, and equalization

PeppyMeter
PeppyMeter
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools
Old 18th October 2021, 04:16 PM   #501
t0bit0bsen is offline t0bit0bsen  Germany
diyAudio Member
 
Join Date: Jul 2019
Hi Francesco,

try to replace in line 129

Code:
unsigned int bins[spectrum_size+1];
by

Code:
unsigned int bins[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 22, 26, 31, 36, 43, 51, 61, 72, 86, 102, 121, 144, 170, 202, 240};
and remove all the "create bins" stuff from line 160 to 181

and compile it again.

Note: This is untested. No guarantee.
Note2: The Spectrum Size you wished is 32.

Kind regards

Tobias
  Reply With Quote
Old 19th October 2021, 10:24 PM   #502
fdealexa is offline fdealexa  Italy
diyAudio Member
 
Join Date: Aug 2020
Location: Rome - Italy
Thank you very much, Tobia.
I have tried and it is much better than the previous one.
I have 2 questions:
1. How can you calculate the numbers you suggested? So if you change something, I don't need to bother you.
2. How can I exclude any window options? It seems to me that 2 of the 3 options create a lot of noise on all frequencies.
Thanks again and greetings,
Francesco
  Reply With Quote
Old 20th October 2021, 06:19 AM   #503
fdealexa is offline fdealexa  Italy
diyAudio Member
 
Join Date: Aug 2020
Location: Rome - Italy
Sorry, Tobias.
The first question is:
How can you calculate the numbers you suggested? So if I would like to change something, I don't need to bother you.
Thanks again and best regards,
Francesco
  Reply With Quote
Old 21st October 2021, 12:19 PM   #504
t0bit0bsen is offline t0bit0bsen  Germany
diyAudio Member
 
Join Date: Jul 2019
Hi,

the result of the fftw-algorithm are 256 frequency bins (+1 DC). They are equal distributed. The maximum frequency is sample_rate/2, eg. 22.05kHz for 44.1kHz sample rate.

So the first frequency is
22050Hz / 256 ~= 86 Hz

The second is 2x the first:
2x 22050Hz / 256 = 172Hz

and so on.

The numbers represent the indices used for calculation. E.g.:

bins = {1, 2, 3, 5, 9}

returns values for frequencies:

Code:
for(x = bins[m]; x < bins[m+1]; x++)
m=0:
x = 1 .. x < 2
amplitudes summed for
f=f(1) = 86Hz

m=1:
x = 2 .. x < 3
amplitudes summed for
f = f(2) = 172Hz

m=2:
x = 3 .. x < 5
amplitudes summed for
f = f(3) = 258Hz and f = f(4) = 345Hz

m=3:
x = 5 .. x < 9
amplitudes summed for
f = f(5) = 431Hz up to f = f(8) = 689Hz

I hope I could clarify more than I caused confusion...

Kind regards,

Tobias
  Reply With Quote
Old 21st October 2021, 09:25 PM   #505
fdealexa is offline fdealexa  Italy
diyAudio Member
 
Join Date: Aug 2020
Location: Rome - Italy
Thanks Tobias,
I will try and inform you about it.
Thanks again and greetings,
Francesco
  Reply With Quote
Old Yesterday, 10:48 AM   #506
fdealexa is offline fdealexa  Italy
diyAudio Member
 
Join Date: Aug 2020
Location: Rome - Italy
Hi Tobias, hi everyone,
after numerous and thorough tests I am pretty sure I can say that my opinion is that:
1. The frequency spectrum sent by peppyalsa ends at 44100 and not 22050 (such as try using "logarithmic_frequency 0" and only half of the values sent will be different from 0).
2. The "Window function for FFT" cannot be avoided (such as try using "window 0" and try to listen to a fixed frequency signal such as a 1000Hz sine wave and you can notice many of the values sent will be other than 0).
I would be very happy if you could give me your point of view on the items just described.
Forgive me if I am too pushy and pressing.
Thanks for everything and have a nice weekend,
Francesco
  Reply With Quote
Old Today, 10:06 AM   #507
t0bit0bsen is offline t0bit0bsen  Germany
diyAudio Member
 
Join Date: Jul 2019
Hi Francesco,

thanks for sharing your opinion.

1.
The FFT always ends at the half of your sample rate. If the sample rate is 44100Hz, the upper most frequency is 22050Hz. For confirmation you can check it on e.g. on a PeppyPlayer, see attachment. What is your sample rate?

2. You can disable the windowing be setting it to any other number than 1, 2 or 3, as the windowing is only applied if it is set to one of these numbers:
Code:
		if (window_function == 1) {input_buffer[buffer_index] = input_buffer[buffer_index] * hann[buffer_index];}
		if (window_function == 2) {input_buffer[buffer_index] = input_buffer[buffer_index] * hamm[buffer_index];}
		if (window_function == 3) {input_buffer[buffer_index] = input_buffer[buffer_index] * black[buffer_index];}
Maybe your input signal is not a pure sine wave. Clipping can cause additional frequency responses. Have you tried a not so "loud" version of your test sample?

Kind regards

Tobias
Attached Images
File Type: jpg FFT.jpg (23.1 KB, 16 views)
  Reply With Quote
Old Today, 10:37 PM   #508
rpi is offline rpi  United States
diyAudio Member
 
Join Date: Apr 2015
Location: San Francisco
Francesco, can you share the testing file which you use and the output (screenshot) which you observe? That would help to reproduce the issue (if any).

Thanks in advance!
  Reply to this post

Reply


PeppyMeterHide this!Advertise here!
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 11:01 PM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 15.00%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
Copyright ©1999-2021 diyAudio
Wiki