Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Sansa Clip Zip: EQ-settings different for each channel?
« previous next »
  • Print
Pages: [1] 2

Author Topic: Sansa Clip Zip: EQ-settings different for each channel?  (Read 4541 times)

Offline mcc01

  • Member
  • *
  • Posts: 69
Sansa Clip Zip: EQ-settings different for each channel?
« on: April 12, 2014, 02:50:37 PM »
Hi,

regarding the hardware of the ansa Clip ZIP: Suppose one could
implement it...would the hardware support different sound setting
(equalizer and such alike) for left and right channel?
If "Yes": Happy!
If "No": Would it be possible to do such things in software only
without frying the CPU or empty the battery in half an hour?
:)
Thank you for any help in advance !
Best regards,
mcc
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #1 on: April 12, 2014, 03:12:54 PM »
Its not possible currently, but it would not be difficult to implement.  Right now the EQ is applied to each channel separately, but the same filter coefficients are used each time. 

See filter_process in dsp_filter.c:  http://git.rockbox.org/?p=rockbox.git;a=blob;f=lib/rbcodec/dsp/dsp_filter.c;h=b74d499e51df99ace73bdba1de59a79ddb639147;hb=HEAD

The ARM assembly version of that function is also relevant on most devices:  http://git.rockbox.org/?p=rockbox.git;a=blob;f=lib/rbcodec/dsp/dsp_arm.S;h=16394b86909571aec590eb54002b753f52647a40;hb=HEAD#l560
Logged

Offline mcc01

  • Member
  • *
  • Posts: 69
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #2 on: April 13, 2014, 06:59:57 AM »
Hi Saratoga,

thanks for the good news and the pointers into the source. I have ordered a Sansa Clip Zip, which
is still on the way.
I already have compiled and installed the cross-compiler environment (I am on Gentoo Linux) and
compiled the current source code.
I only found th eprecompiled firmware of the devices...is there a Tar-ball (or something like that) of the source
of the stable release available somewhere ?

Have a nice Sunday! :)
Best regards,
mcc
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #3 on: April 13, 2014, 05:20:03 PM »
You can check out the source code from git, however if you built the cross compiler you probably already did this.
Logged

Offline mcc01

  • Member
  • *
  • Posts: 69
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #4 on: April 28, 2014, 02:08:21 PM »
Hi,

sorry for the delay...I had to get used to the make-install-boot-sequence of ROCKbox.

Since I am no audio-professional I have some questions to find the "best" way to implement
a Left/Right-aware handling of the Equalizer.

First one
In Rockbox there are quite a few Equalizers and Setting ot modify the sound. What is the
(and here it becomes complicate for me, since English is not my mother's tongue) "most
fundamental one?
Or in other words:
The simple "Treble/Bass"-Settings can easily be "emulated" by the more advanced "Graphical
Equalizer"-setting, which in turn can be emulated by...and so on.

What is the "last Equalizer"...the one, which can emulate all others?

This is the one I have to tweak first.

Second question:
I found -- and hope that it is correct -- that SELECT isn't used for the Equalizers.
I thought of an implementation like this:
The Equalizers are divided into three blocks of settings: Left, Right and Both.
"Both" is already there and means "bith channels are modified identically.
"Left" and "Right" means: Only the left of the right channel will be modified.

What to change will be selected with "SELECT". A small "left" or "right" or "both"
can be made visible on the screen.

Now...what is the best way for the following situation: Suppose one has a problems
to hear the higher freqs of the music with h(e/i)s left ear. So S/he changes the equalizer
settings for Left accordingly.
Then s/he changes the earphones. The new ones have a little to bright sound, so s/he
wants to lower the heights for both, Left and Right AND wants to keep the left-ear-related
setting from the previous settings.

S/he changes to Both with SELECT and lowers the upper freqs a little.

Is it correct to subtract the amount of dezibel on both sides even if their starting point
of the scale is different???

Thank you very much in advance for any help!
Best regards,
mcc

Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #5 on: April 28, 2014, 02:22:04 PM »
I think each of those is implemented by a different filter.

Figure out the GUI settings once you have everything else working.
Logged

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #6 on: April 28, 2014, 11:14:47 PM »
I was thinking something along the lines of:

 Settings:
- Sound Settings:
- - Graphic Equalizer:
- - - Both Channels
- - - Left Channel Only
- - - Right Channel Only

...etc. and then just present the same EQ configuration screen we're all used to, without the need for modifying any keymaps.


[Saint]
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline arom

  • Member
  • *
  • Posts: 7
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #7 on: August 31, 2017, 03:10:56 PM »
Hello, first post here. Amazing project.

I know almost nothing about programming, and after about an hour looking at dsp_filter.c all I could figure out was that everything in filter_process() is equal to buf[c](i) --- (had to use parentheses so it wouldn't turn the following text to italics). Prior occurrences of  f->coefs don't seem to be numbered according to filter_process, I only see a pattern of 4,0,2,2 instead of 1,2,3,4.

Please, give me some guidance in how to implement this, it would be hugely useful for those of us who suffer from asymmetrical hearing loss.

« Last Edit: August 31, 2017, 03:16:31 PM by arom »
Logged

Offline arom

  • Member
  • *
  • Posts: 7
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #8 on: September 16, 2017, 07:58:33 PM »
Where does the 0 in  f->coefs[0] point to? Same question for  f->history[c]["number"]. Please help.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #9 on: September 16, 2017, 08:30:38 PM »
I don't think it is realistic for you to change the EQ without first understanding c syntax.

Edit:  To answer your question, the square brackets are used to access arrays, so coefs[0] is the first element of the array coefs. The values are set in the _coefs functions just above filter_process.  If you want to learn about this, a general reference to c programming is probably a good place to start.
« Last Edit: September 16, 2017, 08:48:16 PM by saratoga »
Logged

Offline arom

  • Member
  • *
  • Posts: 7
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #10 on: September 16, 2017, 11:36:43 PM »
Quote from: saratoga on September 16, 2017, 08:30:38 PM
I don't think it is realistic for you to change the EQ without first understanding c syntax.

Edit:  To answer your question, the square brackets are used to access arrays, so coefs[0] is the first element of the array coefs. The values are set in the _coefs functions just above filter_process.  If you want to learn about this, a general reference to c programming is probably a good place to start.

I didn't see an array declaration in the way they show in online tutorials, that's what had me confused. I expected to see coefs[5] somewhere. Are my assumptions correct in that:

coefs[0] is the filter_shelf_coefs() function
coefs[1] is filter_bishelf_coefs
coefs[2] is filter_pk_coefs
coefs[3] is filter_ls_coefs
coefs[4] is filter_hs_coefs   ?

Thank you for helping me.
« Last Edit: September 17, 2017, 12:02:48 AM by arom »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #11 on: September 17, 2017, 01:27:45 AM »
Quote from: arom on September 16, 2017, 11:36:43 PM
Are my assumptions correct in that:
coefs[0] is the filter_shelf_coefs() function
coefs[1] is filter_bishelf_coefs
coefs[2] is filter_pk_coefs
coefs[3] is filter_ls_coefs
coefs[4] is filter_hs_coefs   ?

Each set of coefficients represents one IIR filter, and each of those functions can calculate a different type of filter (for example, bishelf_coefs calculates the coefficients for a bishelf filter).  filter_process is called once for each EQ filter the user enables. 

Take a look at the comments in the file.  They explain the meaning of those coefficients, how they are calculated, and provide a reference that describes what those functions are doing in more detail.
Logged

Offline arom

  • Member
  • *
  • Posts: 7
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #12 on: September 17, 2017, 01:16:05 PM »
Quote from: saratoga on September 17, 2017, 01:27:45 AM
Quote from: arom on September 16, 2017, 11:36:43 PM
Are my assumptions correct in that:
coefs[0] is the filter_shelf_coefs() function
coefs[1] is filter_bishelf_coefs
coefs[2] is filter_pk_coefs
coefs[3] is filter_ls_coefs
coefs[4] is filter_hs_coefs   ?

Each set of coefficients represents one IIR filter, and each of those functions can calculate a different type of filter (for example, bishelf_coefs calculates the coefficients for a bishelf filter).  filter_process is called once for each EQ filter the user enables. 


So, there is an array of 5 elements called coef[] per each EQ filter? 12 EQ bands x 5 = 60 elements?

Other somewhat related questions:

in void filter_process(struct dsp_filter *f, int32_t * const buf[], int count, unsigned int channels), is "count" the number of enabled EQ filters?

I thought I'd figured out a way to make the EQ apply to only one channel, by changing the "0" in "for (unsigned int c = 0; c < channels; c++)" to 1, assuming the number of channels is 2, it would no longer apply the EQ to the second channel due to c<channels no longer being true. I did that, compiled it and tried it on my Clip+, but it still applies the EQ to both channels; I tried equaling c to several other numbers up to 100, same result. I tried doing the same thing for "for (int i = 0; i < count; i++)" also, same result.

How many channels are there? What value of "c" is needed so that "c<channels" is no longer true?
« Last Edit: September 17, 2017, 01:38:00 PM by arom »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #13 on: September 17, 2017, 02:43:48 PM »
Quote from: arom on September 17, 2017, 01:16:05 PM
Quote from: saratoga on September 17, 2017, 01:27:45 AM
Quote from: arom on September 16, 2017, 11:36:43 PM
Are my assumptions correct in that:
coefs[0] is the filter_shelf_coefs() function
coefs[1] is filter_bishelf_coefs
coefs[2] is filter_pk_coefs
coefs[3] is filter_ls_coefs
coefs[4] is filter_hs_coefs   ?

Each set of coefficients represents one IIR filter, and each of those functions can calculate a different type of filter (for example, bishelf_coefs calculates the coefficients for a bishelf filter).  filter_process is called once for each EQ filter the user enables. 


So, there is an array of 5 elements called coef[] per each EQ filter? 12 EQ bands x 5 = 60 elements?

The maximum number of EQ bands is 10.  But yes, each one has 5 elements, so the most you can have is 50. 

Quote from: arom on September 17, 2017, 01:16:05 PM
in void filter_process(struct dsp_filter *f, int32_t * const buf[], int count, unsigned int channels), is "count" the number of enabled EQ filters?

Count is the number of samples to process.  filter_process is called for each band, so it doesn't actually need to know how many bands there are.

Quote from: arom on September 17, 2017, 01:16:05 PM
I thought I'd figured out a way to make the EQ apply to only one channel, by changing the "0" in "for (unsigned int c = 0; c < channels; c++)" to 1, assuming the number of channels is 2, it would no longer apply the EQ to the second channel due to c<channels no longer being true. I did that, compiled it and tried it on my Clip+, but it still applies the EQ to both channels; I tried equaling c to several other numbers up to 100, same result. I tried doing the same thing for "for (int i = 0; i < count; i++)" also, same result.

The c version of that function is not used on ARM devices like your clip, rather the ARM version I linked above is called instead for performance reasons.  Compile the simulator version on your PC if you want to test the c version of that code, or just change the value of channels when filter_process is called. 
Logged

Offline arom

  • Member
  • *
  • Posts: 7
Re: Sansa Clip Zip: EQ-settings different for each channel?
« Reply #14 on: September 17, 2017, 08:47:00 PM »
I counted the Bass/Treble tone controls as additional bands.

In the ARM assembly file, if r3=channels, how would I represent a single channel? I see the comment "@ r3 = ch = channels - 1", would it be "r3 - 1" then? Something else?
« Last Edit: September 17, 2017, 09:22:01 PM by arom »
Logged

  • Print
Pages: [1] 2
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Hardware
| | |-+  Sansa Clip Zip: EQ-settings different for each channel?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.092 seconds with 14 queries.